T
Thomas
Hope I will not get banned for too many posts
The code below does not want to compile. I get ""Possible Loss of Precision"
in the lines:
'j=last;'
'sito[j]=i;'
'increase(i,last);'
Whats wrong with it ?
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
package narzedzia;
public class LiczbyPierwsze {
protected final static long length = 21;
protected final static long sito [] = new long [(long)1<<length];
// inicjalizacja sita :
{
sito[0]=1;
sito[1]=1;
long last = 0L;
long j;
long i =2;
while(i<length){ // in i we got the following prime
j=last;
while(j<length){ // we mark the numbers whose smallest divisor is i
if(sito[j]== j);
sito[j]=i;
j+=i;
}
increase(i,last); // we count the next prime for the sive
}
}
public final static long czyPierwsza(long x ){
;
return 0;
}
public final static long naCzynnikiPierwsze(long x){
;
return 0;
}
private final static void increase(long x, long last){
while(sito[last++]!=(long)0);
x =(long)sito[last];
}
}
The code below does not want to compile. I get ""Possible Loss of Precision"
in the lines:
'j=last;'
'sito[j]=i;'
'increase(i,last);'
Whats wrong with it ?
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
package narzedzia;
public class LiczbyPierwsze {
protected final static long length = 21;
protected final static long sito [] = new long [(long)1<<length];
// inicjalizacja sita :
{
sito[0]=1;
sito[1]=1;
long last = 0L;
long j;
long i =2;
while(i<length){ // in i we got the following prime
j=last;
while(j<length){ // we mark the numbers whose smallest divisor is i
if(sito[j]== j);
sito[j]=i;
j+=i;
}
increase(i,last); // we count the next prime for the sive
}
}
public final static long czyPierwsza(long x ){
;
return 0;
}
public final static long naCzynnikiPierwsze(long x){
;
return 0;
}
private final static void increase(long x, long last){
while(sito[last++]!=(long)0);
x =(long)sito[last];
}
}