Merge pull request #766 from abhijay94/Development

Cast the second operand of Math.pow to double - SonarQube analysis
This commit is contained in:
Libin Yang 2019-05-23 14:47:32 +08:00 committed by GitHub
commit ceae5ee44a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -184,7 +184,7 @@ public class Base64 {
decodedBlock[0] = (byte) (decodeAlphabet[block[0]] << 2 | decodeAlphabet[block[1]] >>> 4); decodedBlock[0] = (byte) (decodeAlphabet[block[0]] << 2 | decodeAlphabet[block[1]] >>> 4);
decodedBlock[1] = (byte) (decodeAlphabet[block[1]] << 4 | decodeAlphabet[block[2]] >>> 2); decodedBlock[1] = (byte) (decodeAlphabet[block[1]] << 4 | decodeAlphabet[block[2]] >>> 2);
decodedBlock[2] = (byte) (decodeAlphabet[block[2]] << 6 | decodeAlphabet[block[3]]); decodedBlock[2] = (byte) (decodeAlphabet[block[2]] << 6 | decodeAlphabet[block[3]] & 0xff);
return decodedBlock; return decodedBlock;
} }

View File

@ -36,7 +36,7 @@ public class SimplexNoise {
this.octaves[index] = new SimplexNoiseOctave(random.nextInt()); this.octaves[index] = new SimplexNoiseOctave(random.nextInt());
this.frequencys[index] = Math.pow(2, index); this.frequencys[index] = Math.pow(2, index);
this.amplitudes[index] = Math.pow(persistence, octaveCount - index); this.amplitudes[index] = Math.pow(persistence, (double) octaveCount - index);
} }
} }
@ -103,7 +103,7 @@ public class SimplexNoise {
for (int index = 0; index < this.octaves.length; index++) { for (int index = 0; index < this.octaves.length; index++) {
double frequency = Math.pow(2, index); double frequency = Math.pow(2, index);
double amplitude = Math.pow(this.persistance, this.octaves.length - index); double amplitude = Math.pow(this.persistance, (double) this.octaves.length - index);
result += this.octaves[index].noise(x / frequency, y / frequency, z / frequency) * amplitude; result += this.octaves[index].noise(x / frequency, y / frequency, z / frequency) * amplitude;
} }