
(FPCore (x y z)
:precision binary64
:pre TRUE
(fmax
(-
(sqrt
(+
(+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0))
(pow (* z 30.0) 2.0)))
25.0)
(-
(fabs
(+
(+
(* (sin (* x 30.0)) (cos (* y 30.0)))
(* (sin (* y 30.0)) (cos (* z 30.0))))
(* (sin (* z 30.0)) (cos (* x 30.0)))))
0.2)))double code(double x, double y, double z) {
return fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2));
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = fmax((sqrt(((((x * 30.0d0) ** 2.0d0) + ((y * 30.0d0) ** 2.0d0)) + ((z * 30.0d0) ** 2.0d0))) - 25.0d0), (abs((((sin((x * 30.0d0)) * cos((y * 30.0d0))) + (sin((y * 30.0d0)) * cos((z * 30.0d0)))) + (sin((z * 30.0d0)) * cos((x * 30.0d0))))) - 0.2d0))
end function
public static double code(double x, double y, double z) {
return fmax((Math.sqrt(((Math.pow((x * 30.0), 2.0) + Math.pow((y * 30.0), 2.0)) + Math.pow((z * 30.0), 2.0))) - 25.0), (Math.abs((((Math.sin((x * 30.0)) * Math.cos((y * 30.0))) + (Math.sin((y * 30.0)) * Math.cos((z * 30.0)))) + (Math.sin((z * 30.0)) * Math.cos((x * 30.0))))) - 0.2));
}
def code(x, y, z): return fmax((math.sqrt(((math.pow((x * 30.0), 2.0) + math.pow((y * 30.0), 2.0)) + math.pow((z * 30.0), 2.0))) - 25.0), (math.fabs((((math.sin((x * 30.0)) * math.cos((y * 30.0))) + (math.sin((y * 30.0)) * math.cos((z * 30.0)))) + (math.sin((z * 30.0)) * math.cos((x * 30.0))))) - 0.2))
function code(x, y, z) return fmax(Float64(sqrt(Float64(Float64((Float64(x * 30.0) ^ 2.0) + (Float64(y * 30.0) ^ 2.0)) + (Float64(z * 30.0) ^ 2.0))) - 25.0), Float64(abs(Float64(Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(sin(Float64(y * 30.0)) * cos(Float64(z * 30.0)))) + Float64(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))))) - 0.2)) end
function tmp = code(x, y, z) tmp = max((sqrt(((((x * 30.0) ^ 2.0) + ((y * 30.0) ^ 2.0)) + ((z * 30.0) ^ 2.0))) - 25.0), (abs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2)); end
code[x_, y_, z_] := N[Max[N[(N[Sqrt[N[(N[(N[Power[N[(x * 30.0), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(y * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[(z * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET tmp = IF (((sqrt(((((x * (30)) ^ (2)) + ((y * (30)) ^ (2))) + ((z * (30)) ^ (2))))) - (25)) > ((abs(((((sin((x * (30)))) * (cos((y * (30))))) + ((sin((y * (30)))) * (cos((z * (30)))))) + ((sin((z * (30)))) * (cos((x * (30)))))))) - (200000000000000011102230246251565404236316680908203125e-54))) THEN ((sqrt(((((x * (30)) ^ (2)) + ((y * (30)) ^ (2))) + ((z * (30)) ^ (2))))) - (25)) ELSE ((abs(((((sin((x * (30)))) * (cos((y * (30))))) + ((sin((y * (30)))) * (cos((z * (30)))))) + ((sin((z * (30)))) * (cos((x * (30)))))))) - (200000000000000011102230246251565404236316680908203125e-54)) ENDIF IN tmp END code
\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right)
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z)
:precision binary64
:pre TRUE
(fmax
(-
(sqrt
(+
(+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0))
(pow (* z 30.0) 2.0)))
25.0)
(-
(fabs
(+
(+
(* (sin (* x 30.0)) (cos (* y 30.0)))
(* (sin (* y 30.0)) (cos (* z 30.0))))
(* (sin (* z 30.0)) (cos (* x 30.0)))))
0.2)))double code(double x, double y, double z) {
return fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2));
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = fmax((sqrt(((((x * 30.0d0) ** 2.0d0) + ((y * 30.0d0) ** 2.0d0)) + ((z * 30.0d0) ** 2.0d0))) - 25.0d0), (abs((((sin((x * 30.0d0)) * cos((y * 30.0d0))) + (sin((y * 30.0d0)) * cos((z * 30.0d0)))) + (sin((z * 30.0d0)) * cos((x * 30.0d0))))) - 0.2d0))
end function
public static double code(double x, double y, double z) {
return fmax((Math.sqrt(((Math.pow((x * 30.0), 2.0) + Math.pow((y * 30.0), 2.0)) + Math.pow((z * 30.0), 2.0))) - 25.0), (Math.abs((((Math.sin((x * 30.0)) * Math.cos((y * 30.0))) + (Math.sin((y * 30.0)) * Math.cos((z * 30.0)))) + (Math.sin((z * 30.0)) * Math.cos((x * 30.0))))) - 0.2));
}
def code(x, y, z): return fmax((math.sqrt(((math.pow((x * 30.0), 2.0) + math.pow((y * 30.0), 2.0)) + math.pow((z * 30.0), 2.0))) - 25.0), (math.fabs((((math.sin((x * 30.0)) * math.cos((y * 30.0))) + (math.sin((y * 30.0)) * math.cos((z * 30.0)))) + (math.sin((z * 30.0)) * math.cos((x * 30.0))))) - 0.2))
function code(x, y, z) return fmax(Float64(sqrt(Float64(Float64((Float64(x * 30.0) ^ 2.0) + (Float64(y * 30.0) ^ 2.0)) + (Float64(z * 30.0) ^ 2.0))) - 25.0), Float64(abs(Float64(Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(sin(Float64(y * 30.0)) * cos(Float64(z * 30.0)))) + Float64(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))))) - 0.2)) end
function tmp = code(x, y, z) tmp = max((sqrt(((((x * 30.0) ^ 2.0) + ((y * 30.0) ^ 2.0)) + ((z * 30.0) ^ 2.0))) - 25.0), (abs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2)); end
code[x_, y_, z_] := N[Max[N[(N[Sqrt[N[(N[(N[Power[N[(x * 30.0), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(y * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[(z * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET tmp = IF (((sqrt(((((x * (30)) ^ (2)) + ((y * (30)) ^ (2))) + ((z * (30)) ^ (2))))) - (25)) > ((abs(((((sin((x * (30)))) * (cos((y * (30))))) + ((sin((y * (30)))) * (cos((z * (30)))))) + ((sin((z * (30)))) * (cos((x * (30)))))))) - (200000000000000011102230246251565404236316680908203125e-54))) THEN ((sqrt(((((x * (30)) ^ (2)) + ((y * (30)) ^ (2))) + ((z * (30)) ^ (2))))) - (25)) ELSE ((abs(((((sin((x * (30)))) * (cos((y * (30))))) + ((sin((y * (30)))) * (cos((z * (30)))))) + ((sin((z * (30)))) * (cos((x * (30)))))))) - (200000000000000011102230246251565404236316680908203125e-54)) ENDIF IN tmp END code
\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right)
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0 (sin (* 30.0 y)))
(t_1 (* -1.0 (* y (+ 30.0 (* 25.0 (/ 1.0 y)))))))
(if (<= (* y 30.0) -5e+44)
(fmax t_1 (- (fabs (+ t_0 (* 30.0 z))) 0.2))
(if (<= (* y 30.0) 5000.0)
(fmax
(- (* -30.0 z) 25.0)
(-
(fabs (+ t_0 (fma 30.0 z (* 30.0 (* x (cos (* 30.0 y)))))))
0.2))
(fmax t_1 (- (fabs (fma 30.0 y (* 30.0 z))) 0.2))))))double code(double x, double y, double z) {
double t_0 = sin((30.0 * y));
double t_1 = -1.0 * (y * (30.0 + (25.0 * (1.0 / y))));
double tmp;
if ((y * 30.0) <= -5e+44) {
tmp = fmax(t_1, (fabs((t_0 + (30.0 * z))) - 0.2));
} else if ((y * 30.0) <= 5000.0) {
tmp = fmax(((-30.0 * z) - 25.0), (fabs((t_0 + fma(30.0, z, (30.0 * (x * cos((30.0 * y))))))) - 0.2));
} else {
tmp = fmax(t_1, (fabs(fma(30.0, y, (30.0 * z))) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = sin(Float64(30.0 * y)) t_1 = Float64(-1.0 * Float64(y * Float64(30.0 + Float64(25.0 * Float64(1.0 / y))))) tmp = 0.0 if (Float64(y * 30.0) <= -5e+44) tmp = fmax(t_1, Float64(abs(Float64(t_0 + Float64(30.0 * z))) - 0.2)); elseif (Float64(y * 30.0) <= 5000.0) tmp = fmax(Float64(Float64(-30.0 * z) - 25.0), Float64(abs(Float64(t_0 + fma(30.0, z, Float64(30.0 * Float64(x * cos(Float64(30.0 * y))))))) - 0.2)); else tmp = fmax(t_1, Float64(abs(fma(30.0, y, Float64(30.0 * z))) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 * N[(y * N[(30.0 + N[(25.0 * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * 30.0), $MachinePrecision], -5e+44], N[Max[t$95$1, N[(N[Abs[N[(t$95$0 + N[(30.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(y * 30.0), $MachinePrecision], 5000.0], N[Max[N[(N[(-30.0 * z), $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 + N[(30.0 * z + N[(30.0 * N[(x * N[Cos[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[t$95$1, N[(N[Abs[N[(30.0 * y + N[(30.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET t_0 = (sin(((30) * y))) IN LET t_1 = ((-1) * (y * ((30) + ((25) * ((1) / y))))) IN LET tmp_2 = IF (t_1 > ((abs((t_0 + ((30) * z)))) - (200000000000000011102230246251565404236316680908203125e-54))) THEN t_1 ELSE ((abs((t_0 + ((30) * z)))) - (200000000000000011102230246251565404236316680908203125e-54)) ENDIF IN LET tmp_5 = IF ((((-30) * z) - (25)) > ((abs((t_0 + (((30) * z) + ((30) * (x * (cos(((30) * y))))))))) - (200000000000000011102230246251565404236316680908203125e-54))) THEN (((-30) * z) - (25)) ELSE ((abs((t_0 + (((30) * z) + ((30) * (x * (cos(((30) * y))))))))) - (200000000000000011102230246251565404236316680908203125e-54)) ENDIF IN LET tmp_6 = IF (t_1 > ((abs((((30) * y) + ((30) * z)))) - (200000000000000011102230246251565404236316680908203125e-54))) THEN t_1 ELSE ((abs((((30) * y) + ((30) * z)))) - (200000000000000011102230246251565404236316680908203125e-54)) ENDIF IN LET tmp_4 = IF ((y * (30)) <= (5000)) THEN tmp_5 ELSE tmp_6 ENDIF IN LET tmp_1 = IF ((y * (30)) <= (-499999999999999964878644512267775609965379584)) THEN tmp_2 ELSE tmp_4 ENDIF IN tmp_1 END code
\begin{array}{l}
t_0 := \sin \left(30 \cdot y\right)\\
t_1 := -1 \cdot \left(y \cdot \left(30 + 25 \cdot \frac{1}{y}\right)\right)\\
\mathbf{if}\;y \cdot 30 \leq -5 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{max}\left(t\_1, \left|t\_0 + 30 \cdot z\right| - 0.2\right)\\
\mathbf{elif}\;y \cdot 30 \leq 5000:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot z - 25, \left|t\_0 + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(t\_1, \left|\mathsf{fma}\left(30, y, 30 \cdot z\right)\right| - 0.2\right)\\
\end{array}
if (*.f64 y #s(literal 30 binary64)) < -4.9999999999999996e44Initial program 46.2%
Taylor expanded in x around 0
Applied rewrites45.8%
Taylor expanded in z around 0
Applied rewrites45.4%
Taylor expanded in y around -inf
Applied rewrites56.2%
if -4.9999999999999996e44 < (*.f64 y #s(literal 30 binary64)) < 5e3Initial program 46.2%
Taylor expanded in z around -inf
Applied rewrites30.0%
Taylor expanded in z around 0
Applied rewrites39.5%
Taylor expanded in x around 0
Applied rewrites63.2%
if 5e3 < (*.f64 y #s(literal 30 binary64)) Initial program 46.2%
Taylor expanded in x around 0
Applied rewrites45.8%
Taylor expanded in z around 0
Applied rewrites45.4%
Taylor expanded in y around -inf
Applied rewrites56.2%
Taylor expanded in y around 0
Applied rewrites69.0%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0
(fmax
(- (* -30.0 z) 25.0)
(- (fabs (+ (sin (* 30.0 z)) (* 30.0 x))) 0.2))))
(if (<= (* x 30.0) -1e+85)
t_0
(if (<= (* x 30.0) 5e+133)
(fmax
(* -1.0 (* y (+ 30.0 (* 25.0 (/ 1.0 y)))))
(- (fabs (fma 30.0 y (* 30.0 z))) 0.2))
t_0))))double code(double x, double y, double z) {
double t_0 = fmax(((-30.0 * z) - 25.0), (fabs((sin((30.0 * z)) + (30.0 * x))) - 0.2));
double tmp;
if ((x * 30.0) <= -1e+85) {
tmp = t_0;
} else if ((x * 30.0) <= 5e+133) {
tmp = fmax((-1.0 * (y * (30.0 + (25.0 * (1.0 / y))))), (fabs(fma(30.0, y, (30.0 * z))) - 0.2));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fmax(Float64(Float64(-30.0 * z) - 25.0), Float64(abs(Float64(sin(Float64(30.0 * z)) + Float64(30.0 * x))) - 0.2)) tmp = 0.0 if (Float64(x * 30.0) <= -1e+85) tmp = t_0; elseif (Float64(x * 30.0) <= 5e+133) tmp = fmax(Float64(-1.0 * Float64(y * Float64(30.0 + Float64(25.0 * Float64(1.0 / y))))), Float64(abs(fma(30.0, y, Float64(30.0 * z))) - 0.2)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[(N[(-30.0 * z), $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(x * 30.0), $MachinePrecision], -1e+85], t$95$0, If[LessEqual[N[(x * 30.0), $MachinePrecision], 5e+133], N[Max[N[(-1.0 * N[(y * N[(30.0 + N[(25.0 * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(30.0 * y + N[(30.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], t$95$0]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET tmp = IF ((((-30) * z) - (25)) > ((abs(((sin(((30) * z))) + ((30) * x)))) - (200000000000000011102230246251565404236316680908203125e-54))) THEN (((-30) * z) - (25)) ELSE ((abs(((sin(((30) * z))) + ((30) * x)))) - (200000000000000011102230246251565404236316680908203125e-54)) ENDIF IN LET t_0 = tmp IN LET tmp_4 = IF (((-1) * (y * ((30) + ((25) * ((1) / y))))) > ((abs((((30) * y) + ((30) * z)))) - (200000000000000011102230246251565404236316680908203125e-54))) THEN ((-1) * (y * ((30) + ((25) * ((1) / y))))) ELSE ((abs((((30) * y) + ((30) * z)))) - (200000000000000011102230246251565404236316680908203125e-54)) ENDIF IN LET tmp_3 = IF ((x * (30)) <= (49999999999999996074101824835349657503774913686486230752187555524924150803830162236428630807572544714024682228918922745266209965473792)) THEN tmp_4 ELSE t_0 ENDIF IN LET tmp_1 = IF ((x * (30)) <= (-10000000000000000146306952306748730309700429878646550592786107871697963642511482159104)) THEN t_0 ELSE tmp_3 ENDIF IN tmp_1 END code
\begin{array}{l}
t_0 := \mathsf{max}\left(-30 \cdot z - 25, \left|\sin \left(30 \cdot z\right) + 30 \cdot x\right| - 0.2\right)\\
\mathbf{if}\;x \cdot 30 \leq -1 \cdot 10^{+85}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \cdot 30 \leq 5 \cdot 10^{+133}:\\
\;\;\;\;\mathsf{max}\left(-1 \cdot \left(y \cdot \left(30 + 25 \cdot \frac{1}{y}\right)\right), \left|\mathsf{fma}\left(30, y, 30 \cdot z\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (*.f64 x #s(literal 30 binary64)) < -1e85 or 4.9999999999999996e133 < (*.f64 x #s(literal 30 binary64)) Initial program 46.2%
Taylor expanded in y around 0
Applied rewrites45.9%
Taylor expanded in x around 0
Applied rewrites45.5%
Taylor expanded in z around -inf
Applied rewrites57.4%
Taylor expanded in z around 0
Applied rewrites57.4%
if -1e85 < (*.f64 x #s(literal 30 binary64)) < 4.9999999999999996e133Initial program 46.2%
Taylor expanded in x around 0
Applied rewrites45.8%
Taylor expanded in z around 0
Applied rewrites45.4%
Taylor expanded in y around -inf
Applied rewrites56.2%
Taylor expanded in y around 0
Applied rewrites69.0%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0
(fmax
(* y 30.0)
(- (fabs (+ (sin (* 30.0 z)) (* 30.0 x))) 0.2))))
(if (<= (* x 30.0) -5e+100)
t_0
(if (<= (* x 30.0) 1e+175)
(fmax
(* -1.0 (* y (+ 30.0 (* 25.0 (/ 1.0 y)))))
(- (fabs (fma 30.0 y (* 30.0 z))) 0.2))
t_0))))double code(double x, double y, double z) {
double t_0 = fmax((y * 30.0), (fabs((sin((30.0 * z)) + (30.0 * x))) - 0.2));
double tmp;
if ((x * 30.0) <= -5e+100) {
tmp = t_0;
} else if ((x * 30.0) <= 1e+175) {
tmp = fmax((-1.0 * (y * (30.0 + (25.0 * (1.0 / y))))), (fabs(fma(30.0, y, (30.0 * z))) - 0.2));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fmax(Float64(y * 30.0), Float64(abs(Float64(sin(Float64(30.0 * z)) + Float64(30.0 * x))) - 0.2)) tmp = 0.0 if (Float64(x * 30.0) <= -5e+100) tmp = t_0; elseif (Float64(x * 30.0) <= 1e+175) tmp = fmax(Float64(-1.0 * Float64(y * Float64(30.0 + Float64(25.0 * Float64(1.0 / y))))), Float64(abs(fma(30.0, y, Float64(30.0 * z))) - 0.2)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(x * 30.0), $MachinePrecision], -5e+100], t$95$0, If[LessEqual[N[(x * 30.0), $MachinePrecision], 1e+175], N[Max[N[(-1.0 * N[(y * N[(30.0 + N[(25.0 * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(30.0 * y + N[(30.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], t$95$0]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET tmp = IF ((y * (30)) > ((abs(((sin(((30) * z))) + ((30) * x)))) - (200000000000000011102230246251565404236316680908203125e-54))) THEN (y * (30)) ELSE ((abs(((sin(((30) * z))) + ((30) * x)))) - (200000000000000011102230246251565404236316680908203125e-54)) ENDIF IN LET t_0 = tmp IN LET tmp_4 = IF (((-1) * (y * ((30) + ((25) * ((1) / y))))) > ((abs((((30) * y) + ((30) * z)))) - (200000000000000011102230246251565404236316680908203125e-54))) THEN ((-1) * (y * ((30) + ((25) * ((1) / y))))) ELSE ((abs((((30) * y) + ((30) * z)))) - (200000000000000011102230246251565404236316680908203125e-54)) ENDIF IN LET tmp_3 = IF ((x * (30)) <= (9999999999999999371534524623368764100273307559896873275206250678451924602685103382037576783819090846734548822294900033162112051840457868829614121240178061963384891963422539776)) THEN tmp_4 ELSE t_0 ENDIF IN LET tmp_1 = IF ((x * (30)) <= (-49999999999999998852475663262266831422342135996207500306499798736599672609039495565163064724075577344)) THEN t_0 ELSE tmp_3 ENDIF IN tmp_1 END code
\begin{array}{l}
t_0 := \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot z\right) + 30 \cdot x\right| - 0.2\right)\\
\mathbf{if}\;x \cdot 30 \leq -5 \cdot 10^{+100}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \cdot 30 \leq 10^{+175}:\\
\;\;\;\;\mathsf{max}\left(-1 \cdot \left(y \cdot \left(30 + 25 \cdot \frac{1}{y}\right)\right), \left|\mathsf{fma}\left(30, y, 30 \cdot z\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (*.f64 x #s(literal 30 binary64)) < -4.9999999999999999e100 or 9.9999999999999994e174 < (*.f64 x #s(literal 30 binary64)) Initial program 46.2%
Taylor expanded in y around 0
Applied rewrites45.9%
Taylor expanded in x around 0
Applied rewrites45.5%
Taylor expanded in y around inf
Applied rewrites57.5%
Taylor expanded in y around inf
Applied rewrites45.9%
if -4.9999999999999999e100 < (*.f64 x #s(literal 30 binary64)) < 9.9999999999999994e174Initial program 46.2%
Taylor expanded in x around 0
Applied rewrites45.8%
Taylor expanded in z around 0
Applied rewrites45.4%
Taylor expanded in y around -inf
Applied rewrites56.2%
Taylor expanded in y around 0
Applied rewrites69.0%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0
(fmax -25.0 (- (fabs (+ (sin (* 30.0 z)) (* 30.0 x))) 0.2))))
(if (<= (* x 30.0) -1e+158)
t_0
(if (<= (* x 30.0) 1e+175)
(fmax
(* -1.0 (* y (+ 30.0 (* 25.0 (/ 1.0 y)))))
(- (fabs (fma 30.0 y (* 30.0 z))) 0.2))
t_0))))double code(double x, double y, double z) {
double t_0 = fmax(-25.0, (fabs((sin((30.0 * z)) + (30.0 * x))) - 0.2));
double tmp;
if ((x * 30.0) <= -1e+158) {
tmp = t_0;
} else if ((x * 30.0) <= 1e+175) {
tmp = fmax((-1.0 * (y * (30.0 + (25.0 * (1.0 / y))))), (fabs(fma(30.0, y, (30.0 * z))) - 0.2));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fmax(-25.0, Float64(abs(Float64(sin(Float64(30.0 * z)) + Float64(30.0 * x))) - 0.2)) tmp = 0.0 if (Float64(x * 30.0) <= -1e+158) tmp = t_0; elseif (Float64(x * 30.0) <= 1e+175) tmp = fmax(Float64(-1.0 * Float64(y * Float64(30.0 + Float64(25.0 * Float64(1.0 / y))))), Float64(abs(fma(30.0, y, Float64(30.0 * z))) - 0.2)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[-25.0, N[(N[Abs[N[(N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(x * 30.0), $MachinePrecision], -1e+158], t$95$0, If[LessEqual[N[(x * 30.0), $MachinePrecision], 1e+175], N[Max[N[(-1.0 * N[(y * N[(30.0 + N[(25.0 * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(30.0 * y + N[(30.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], t$95$0]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET tmp = IF ((-25) > ((abs(((sin(((30) * z))) + ((30) * x)))) - (200000000000000011102230246251565404236316680908203125e-54))) THEN (-25) ELSE ((abs(((sin(((30) * z))) + ((30) * x)))) - (200000000000000011102230246251565404236316680908203125e-54)) ENDIF IN LET t_0 = tmp IN LET tmp_4 = IF (((-1) * (y * ((30) + ((25) * ((1) / y))))) > ((abs((((30) * y) + ((30) * z)))) - (200000000000000011102230246251565404236316680908203125e-54))) THEN ((-1) * (y * ((30) + ((25) * ((1) / y))))) ELSE ((abs((((30) * y) + ((30) * z)))) - (200000000000000011102230246251565404236316680908203125e-54)) ENDIF IN LET tmp_3 = IF ((x * (30)) <= (9999999999999999371534524623368764100273307559896873275206250678451924602685103382037576783819090846734548822294900033162112051840457868829614121240178061963384891963422539776)) THEN tmp_4 ELSE t_0 ENDIF IN LET tmp_1 = IF ((x * (30)) <= (-99999999999999995287335453651211007997446182781858083179085387749785952239205787068995699003416510776387310061494932420984963311567802202010637287727642443776)) THEN t_0 ELSE tmp_3 ENDIF IN tmp_1 END code
\begin{array}{l}
t_0 := \mathsf{max}\left(-25, \left|\sin \left(30 \cdot z\right) + 30 \cdot x\right| - 0.2\right)\\
\mathbf{if}\;x \cdot 30 \leq -1 \cdot 10^{+158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \cdot 30 \leq 10^{+175}:\\
\;\;\;\;\mathsf{max}\left(-1 \cdot \left(y \cdot \left(30 + 25 \cdot \frac{1}{y}\right)\right), \left|\mathsf{fma}\left(30, y, 30 \cdot z\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (*.f64 x #s(literal 30 binary64)) < -9.9999999999999995e157 or 9.9999999999999994e174 < (*.f64 x #s(literal 30 binary64)) Initial program 46.2%
Taylor expanded in y around 0
Applied rewrites45.9%
Taylor expanded in x around 0
Applied rewrites45.5%
Taylor expanded in y around inf
Applied rewrites57.5%
Taylor expanded in y around 0
Applied rewrites43.7%
if -9.9999999999999995e157 < (*.f64 x #s(literal 30 binary64)) < 9.9999999999999994e174Initial program 46.2%
Taylor expanded in x around 0
Applied rewrites45.8%
Taylor expanded in z around 0
Applied rewrites45.4%
Taylor expanded in y around -inf
Applied rewrites56.2%
Taylor expanded in y around 0
Applied rewrites69.0%
(FPCore (x y z) :precision binary64 :pre TRUE (fmax (* -1.0 (* y (+ 30.0 (* 25.0 (/ 1.0 y))))) (- (fabs (fma 30.0 y (* 30.0 z))) 0.2)))
double code(double x, double y, double z) {
return fmax((-1.0 * (y * (30.0 + (25.0 * (1.0 / y))))), (fabs(fma(30.0, y, (30.0 * z))) - 0.2));
}
function code(x, y, z) return fmax(Float64(-1.0 * Float64(y * Float64(30.0 + Float64(25.0 * Float64(1.0 / y))))), Float64(abs(fma(30.0, y, Float64(30.0 * z))) - 0.2)) end
code[x_, y_, z_] := N[Max[N[(-1.0 * N[(y * N[(30.0 + N[(25.0 * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(30.0 * y + N[(30.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET tmp = IF (((-1) * (y * ((30) + ((25) * ((1) / y))))) > ((abs((((30) * y) + ((30) * z)))) - (200000000000000011102230246251565404236316680908203125e-54))) THEN ((-1) * (y * ((30) + ((25) * ((1) / y))))) ELSE ((abs((((30) * y) + ((30) * z)))) - (200000000000000011102230246251565404236316680908203125e-54)) ENDIF IN tmp END code
\mathsf{max}\left(-1 \cdot \left(y \cdot \left(30 + 25 \cdot \frac{1}{y}\right)\right), \left|\mathsf{fma}\left(30, y, 30 \cdot z\right)\right| - 0.2\right)
Initial program 46.2%
Taylor expanded in x around 0
Applied rewrites45.8%
Taylor expanded in z around 0
Applied rewrites45.4%
Taylor expanded in y around -inf
Applied rewrites56.2%
Taylor expanded in y around 0
Applied rewrites69.0%
herbie shell --seed 2026084
(FPCore (x y z)
:name "Gyroid sphere"
:precision binary64
(fmax (- (sqrt (+ (+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0)) (pow (* z 30.0) 2.0))) 25.0) (- (fabs (+ (+ (* (sin (* x 30.0)) (cos (* y 30.0))) (* (sin (* y 30.0)) (cos (* z 30.0)))) (* (sin (* z 30.0)) (cos (* x 30.0))))) 0.2)))