Math.pow(x, -1) seems to be faster than 1/x on my machine

This commit is contained in:
Zoë Gidiere
2023-10-08 01:32:43 -06:00
parent 2144da5466
commit 6d67a0747d

View File

@@ -325,7 +325,7 @@ public class PseudoErosionSampler implements NoiseSampler {
double ldx = x1 - x2;
double ldy = y1 - y2;
double invLineLengthSquared = 1 / (Math.pow(ldx, 2) + Math.pow(ldy, 2));
double invLineLengthSquared = Math.pow((Math.pow(ldx, 2) + Math.pow(ldy, 2)), -1);
double x2dx = x - x2;
double y2dx = y - y2;