
(FPCore (x y z)
: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)))
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));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
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]
\begin{array}{l}
\\
\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)
\end{array}
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z)
: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)))
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));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
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]
\begin{array}{l}
\\
\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)
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0
(-
(fabs
(fma
(cos (* -30.0 x))
(sin (* 30.0 z))
(fma
(cos (* -30.0 y))
(sin (* 30.0 x))
(* (cos (* -30.0 z)) (sin (* 30.0 y))))))
0.2))
(t_1 (fmax (fma 30.0 (hypot z y) -25.0) t_0)))
(if (<= z -5.2e+17)
t_1
(if (<= z 102000000.0) (fmax (fma 30.0 (hypot x y) -25.0) t_0) t_1))))
double code(double x, double y, double z) {
double t_0 = fabs(fma(cos((-30.0 * x)), sin((30.0 * z)), fma(cos((-30.0 * y)), sin((30.0 * x)), (cos((-30.0 * z)) * sin((30.0 * y)))))) - 0.2;
double t_1 = fmax(fma(30.0, hypot(z, y), -25.0), t_0);
double tmp;
if (z <= -5.2e+17) {
tmp = t_1;
} else if (z <= 102000000.0) {
tmp = fmax(fma(30.0, hypot(x, y), -25.0), t_0);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(abs(fma(cos(Float64(-30.0 * x)), sin(Float64(30.0 * z)), fma(cos(Float64(-30.0 * y)), sin(Float64(30.0 * x)), Float64(cos(Float64(-30.0 * z)) * sin(Float64(30.0 * y)))))) - 0.2) t_1 = fmax(fma(30.0, hypot(z, y), -25.0), t_0) tmp = 0.0 if (z <= -5.2e+17) tmp = t_1; elseif (z <= 102000000.0) tmp = fmax(fma(30.0, hypot(x, y), -25.0), t_0); else tmp = t_1; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[N[(N[Cos[N[(-30.0 * x), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(N[Cos[N[(-30.0 * y), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + N[(N[Cos[N[(-30.0 * z), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, Block[{t$95$1 = N[Max[N[(30.0 * N[Sqrt[z ^ 2 + y ^ 2], $MachinePrecision] + -25.0), $MachinePrecision], t$95$0], $MachinePrecision]}, If[LessEqual[z, -5.2e+17], t$95$1, If[LessEqual[z, 102000000.0], N[Max[N[(30.0 * N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision] + -25.0), $MachinePrecision], t$95$0], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\mathsf{fma}\left(\cos \left(-30 \cdot x\right), \sin \left(30 \cdot z\right), \mathsf{fma}\left(\cos \left(-30 \cdot y\right), \sin \left(30 \cdot x\right), \cos \left(-30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right)\right)\right| - 0.2\\
t_1 := \mathsf{max}\left(\mathsf{fma}\left(30, \mathsf{hypot}\left(z, y\right), -25\right), t\_0\right)\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 102000000:\\
\;\;\;\;\mathsf{max}\left(\mathsf{fma}\left(30, \mathsf{hypot}\left(x, y\right), -25\right), t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.2e17 or 1.02e8 < z Initial program 31.6%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6431.6
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6431.6
Applied rewrites31.6%
Applied rewrites32.1%
Applied rewrites32.1%
Taylor expanded in x around 0
+-commutativeN/A
pow2N/A
pow2N/A
lower-hypot.f6480.3
Applied rewrites80.3%
if -5.2e17 < z < 1.02e8Initial program 58.7%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6458.7
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.6
Applied rewrites58.6%
Applied rewrites58.9%
Applied rewrites58.9%
Taylor expanded in z around 0
pow2N/A
pow2N/A
lower-hypot.f6498.9
Applied rewrites98.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sin (* 30.0 z)))
(t_1 (cos (* -30.0 y)))
(t_2 (sin (* 30.0 x)))
(t_3 (sin (* 30.0 y)))
(t_4 (cos (* -30.0 x)))
(t_5 (cos (* -30.0 z)))
(t_6 (- (fabs (fma t_4 t_0 (fma t_1 t_2 (* t_5 t_3)))) 0.2)))
(if (<= z -2e+133)
(fmax (fma 30.0 (- z) -25.0) t_6)
(if (<= z 8.5e+29)
(fmax (fma 30.0 (hypot x y) -25.0) t_6)
(if (<= z 3.75e+143)
(fmax
(fma 30.0 (sqrt (fma z z (fma y y (* x x)))) -25.0)
(- (fabs (fma t_1 t_2 t_3)) 0.2))
(fmax
(* 30.0 z)
(-
(fabs
(fma t_4 t_0 (fma (sin (* x 30.0)) t_1 (* t_5 (sin (* y 30.0))))))
0.2)))))))
double code(double x, double y, double z) {
double t_0 = sin((30.0 * z));
double t_1 = cos((-30.0 * y));
double t_2 = sin((30.0 * x));
double t_3 = sin((30.0 * y));
double t_4 = cos((-30.0 * x));
double t_5 = cos((-30.0 * z));
double t_6 = fabs(fma(t_4, t_0, fma(t_1, t_2, (t_5 * t_3)))) - 0.2;
double tmp;
if (z <= -2e+133) {
tmp = fmax(fma(30.0, -z, -25.0), t_6);
} else if (z <= 8.5e+29) {
tmp = fmax(fma(30.0, hypot(x, y), -25.0), t_6);
} else if (z <= 3.75e+143) {
tmp = fmax(fma(30.0, sqrt(fma(z, z, fma(y, y, (x * x)))), -25.0), (fabs(fma(t_1, t_2, t_3)) - 0.2));
} else {
tmp = fmax((30.0 * z), (fabs(fma(t_4, t_0, fma(sin((x * 30.0)), t_1, (t_5 * sin((y * 30.0)))))) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = sin(Float64(30.0 * z)) t_1 = cos(Float64(-30.0 * y)) t_2 = sin(Float64(30.0 * x)) t_3 = sin(Float64(30.0 * y)) t_4 = cos(Float64(-30.0 * x)) t_5 = cos(Float64(-30.0 * z)) t_6 = Float64(abs(fma(t_4, t_0, fma(t_1, t_2, Float64(t_5 * t_3)))) - 0.2) tmp = 0.0 if (z <= -2e+133) tmp = fmax(fma(30.0, Float64(-z), -25.0), t_6); elseif (z <= 8.5e+29) tmp = fmax(fma(30.0, hypot(x, y), -25.0), t_6); elseif (z <= 3.75e+143) tmp = fmax(fma(30.0, sqrt(fma(z, z, fma(y, y, Float64(x * x)))), -25.0), Float64(abs(fma(t_1, t_2, t_3)) - 0.2)); else tmp = fmax(Float64(30.0 * z), Float64(abs(fma(t_4, t_0, fma(sin(Float64(x * 30.0)), t_1, Float64(t_5 * sin(Float64(y * 30.0)))))) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(-30.0 * y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Cos[N[(-30.0 * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Cos[N[(-30.0 * z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(N[Abs[N[(t$95$4 * t$95$0 + N[(t$95$1 * t$95$2 + N[(t$95$5 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, If[LessEqual[z, -2e+133], N[Max[N[(30.0 * (-z) + -25.0), $MachinePrecision], t$95$6], $MachinePrecision], If[LessEqual[z, 8.5e+29], N[Max[N[(30.0 * N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision] + -25.0), $MachinePrecision], t$95$6], $MachinePrecision], If[LessEqual[z, 3.75e+143], N[Max[N[(30.0 * N[Sqrt[N[(z * z + N[(y * y + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + -25.0), $MachinePrecision], N[(N[Abs[N[(t$95$1 * t$95$2 + t$95$3), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(30.0 * z), $MachinePrecision], N[(N[Abs[N[(t$95$4 * t$95$0 + N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * t$95$1 + N[(t$95$5 * N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(30 \cdot z\right)\\
t_1 := \cos \left(-30 \cdot y\right)\\
t_2 := \sin \left(30 \cdot x\right)\\
t_3 := \sin \left(30 \cdot y\right)\\
t_4 := \cos \left(-30 \cdot x\right)\\
t_5 := \cos \left(-30 \cdot z\right)\\
t_6 := \left|\mathsf{fma}\left(t\_4, t\_0, \mathsf{fma}\left(t\_1, t\_2, t\_5 \cdot t\_3\right)\right)\right| - 0.2\\
\mathbf{if}\;z \leq -2 \cdot 10^{+133}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{fma}\left(30, -z, -25\right), t\_6\right)\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{fma}\left(30, \mathsf{hypot}\left(x, y\right), -25\right), t\_6\right)\\
\mathbf{elif}\;z \leq 3.75 \cdot 10^{+143}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{fma}\left(30, \sqrt{\mathsf{fma}\left(z, z, \mathsf{fma}\left(y, y, x \cdot x\right)\right)}, -25\right), \left|\mathsf{fma}\left(t\_1, t\_2, t\_3\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot z, \left|\mathsf{fma}\left(t\_4, t\_0, \mathsf{fma}\left(\sin \left(x \cdot 30\right), t\_1, t\_5 \cdot \sin \left(y \cdot 30\right)\right)\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if z < -2e133Initial program 13.2%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6413.2
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6413.2
Applied rewrites13.2%
Applied rewrites13.8%
Applied rewrites13.8%
Taylor expanded in z around -inf
mul-1-negN/A
lower-neg.f6475.5
Applied rewrites75.5%
if -2e133 < z < 8.5000000000000006e29Initial program 58.8%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6458.8
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.8
Applied rewrites58.8%
Applied rewrites59.1%
Applied rewrites59.1%
Taylor expanded in z around 0
pow2N/A
pow2N/A
lower-hypot.f6492.7
Applied rewrites92.7%
if 8.5000000000000006e29 < z < 3.74999999999999987e143Initial program 54.4%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6454.4
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6454.4
Applied rewrites54.4%
Applied rewrites54.9%
Applied rewrites54.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f6454.9
Applied rewrites54.9%
if 3.74999999999999987e143 < z Initial program 12.2%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6412.2
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6412.2
Applied rewrites12.2%
Applied rewrites12.2%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
metadata-evalN/A
unpow1/2N/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6412.9
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6412.9
Applied rewrites12.9%
Taylor expanded in z around inf
lift-*.f6476.3
Applied rewrites76.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (cos (* -30.0 y)))
(t_1
(-
(fabs
(fma
(cos (* -30.0 x))
(sin (* 30.0 z))
(fma (sin (* x 30.0)) t_0 (* (cos (* -30.0 z)) (sin (* y 30.0))))))
0.2)))
(if (<= y -4.6e+128)
(fmax (* -30.0 y) t_1)
(if (<= y 6.6e+142)
(fmax
(fma 30.0 (sqrt (fma z z (fma y y (* x x)))) -25.0)
(- (fabs (fma t_0 (sin (* 30.0 x)) (sin (* 30.0 y)))) 0.2))
(fmax (* 30.0 y) t_1)))))
double code(double x, double y, double z) {
double t_0 = cos((-30.0 * y));
double t_1 = fabs(fma(cos((-30.0 * x)), sin((30.0 * z)), fma(sin((x * 30.0)), t_0, (cos((-30.0 * z)) * sin((y * 30.0)))))) - 0.2;
double tmp;
if (y <= -4.6e+128) {
tmp = fmax((-30.0 * y), t_1);
} else if (y <= 6.6e+142) {
tmp = fmax(fma(30.0, sqrt(fma(z, z, fma(y, y, (x * x)))), -25.0), (fabs(fma(t_0, sin((30.0 * x)), sin((30.0 * y)))) - 0.2));
} else {
tmp = fmax((30.0 * y), t_1);
}
return tmp;
}
function code(x, y, z) t_0 = cos(Float64(-30.0 * y)) t_1 = Float64(abs(fma(cos(Float64(-30.0 * x)), sin(Float64(30.0 * z)), fma(sin(Float64(x * 30.0)), t_0, Float64(cos(Float64(-30.0 * z)) * sin(Float64(y * 30.0)))))) - 0.2) tmp = 0.0 if (y <= -4.6e+128) tmp = fmax(Float64(-30.0 * y), t_1); elseif (y <= 6.6e+142) tmp = fmax(fma(30.0, sqrt(fma(z, z, fma(y, y, Float64(x * x)))), -25.0), Float64(abs(fma(t_0, sin(Float64(30.0 * x)), sin(Float64(30.0 * y)))) - 0.2)); else tmp = fmax(Float64(30.0 * y), t_1); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Cos[N[(-30.0 * y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[N[(N[Cos[N[(-30.0 * x), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * t$95$0 + N[(N[Cos[N[(-30.0 * z), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, If[LessEqual[y, -4.6e+128], N[Max[N[(-30.0 * y), $MachinePrecision], t$95$1], $MachinePrecision], If[LessEqual[y, 6.6e+142], N[Max[N[(30.0 * N[Sqrt[N[(z * z + N[(y * y + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + -25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(30.0 * y), $MachinePrecision], t$95$1], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(-30 \cdot y\right)\\
t_1 := \left|\mathsf{fma}\left(\cos \left(-30 \cdot x\right), \sin \left(30 \cdot z\right), \mathsf{fma}\left(\sin \left(x \cdot 30\right), t\_0, \cos \left(-30 \cdot z\right) \cdot \sin \left(y \cdot 30\right)\right)\right)\right| - 0.2\\
\mathbf{if}\;y \leq -4.6 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y, t\_1\right)\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+142}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{fma}\left(30, \sqrt{\mathsf{fma}\left(z, z, \mathsf{fma}\left(y, y, x \cdot x\right)\right)}, -25\right), \left|\mathsf{fma}\left(t\_0, \sin \left(30 \cdot x\right), \sin \left(30 \cdot y\right)\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot y, t\_1\right)\\
\end{array}
\end{array}
if y < -4.59999999999999996e128Initial program 16.9%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6416.9
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6416.9
Applied rewrites16.9%
Applied rewrites16.9%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
metadata-evalN/A
unpow1/2N/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6417.1
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6417.1
Applied rewrites17.1%
Taylor expanded in y around -inf
lift-*.f6476.1
Applied rewrites76.1%
if -4.59999999999999996e128 < y < 6.6000000000000004e142Initial program 58.0%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6458.0
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.0
Applied rewrites58.0%
Applied rewrites58.4%
Applied rewrites58.4%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f6457.8
Applied rewrites57.8%
if 6.6000000000000004e142 < y Initial program 11.5%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6411.5
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6411.5
Applied rewrites11.5%
Applied rewrites11.5%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
metadata-evalN/A
unpow1/2N/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6412.1
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6412.1
Applied rewrites12.1%
Taylor expanded in y around inf
lift-*.f6475.5
Applied rewrites75.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (cos (* -30.0 y)))
(t_1
(-
(fabs
(fma
(cos (* -30.0 x))
(sin (* 30.0 z))
(fma (sin (* x 30.0)) t_0 (* (cos (* -30.0 z)) (sin (* y 30.0))))))
0.2)))
(if (<= x -1.55e+142)
(fmax (* -30.0 x) t_1)
(if (<= x 1e+118)
(fmax
(fma 30.0 (sqrt (fma z z (fma y y (* x x)))) -25.0)
(- (fabs (fma t_0 (sin (* 30.0 x)) (sin (* 30.0 y)))) 0.2))
(fmax (* 30.0 x) t_1)))))
double code(double x, double y, double z) {
double t_0 = cos((-30.0 * y));
double t_1 = fabs(fma(cos((-30.0 * x)), sin((30.0 * z)), fma(sin((x * 30.0)), t_0, (cos((-30.0 * z)) * sin((y * 30.0)))))) - 0.2;
double tmp;
if (x <= -1.55e+142) {
tmp = fmax((-30.0 * x), t_1);
} else if (x <= 1e+118) {
tmp = fmax(fma(30.0, sqrt(fma(z, z, fma(y, y, (x * x)))), -25.0), (fabs(fma(t_0, sin((30.0 * x)), sin((30.0 * y)))) - 0.2));
} else {
tmp = fmax((30.0 * x), t_1);
}
return tmp;
}
function code(x, y, z) t_0 = cos(Float64(-30.0 * y)) t_1 = Float64(abs(fma(cos(Float64(-30.0 * x)), sin(Float64(30.0 * z)), fma(sin(Float64(x * 30.0)), t_0, Float64(cos(Float64(-30.0 * z)) * sin(Float64(y * 30.0)))))) - 0.2) tmp = 0.0 if (x <= -1.55e+142) tmp = fmax(Float64(-30.0 * x), t_1); elseif (x <= 1e+118) tmp = fmax(fma(30.0, sqrt(fma(z, z, fma(y, y, Float64(x * x)))), -25.0), Float64(abs(fma(t_0, sin(Float64(30.0 * x)), sin(Float64(30.0 * y)))) - 0.2)); else tmp = fmax(Float64(30.0 * x), t_1); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Cos[N[(-30.0 * y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[N[(N[Cos[N[(-30.0 * x), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * t$95$0 + N[(N[Cos[N[(-30.0 * z), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, If[LessEqual[x, -1.55e+142], N[Max[N[(-30.0 * x), $MachinePrecision], t$95$1], $MachinePrecision], If[LessEqual[x, 1e+118], N[Max[N[(30.0 * N[Sqrt[N[(z * z + N[(y * y + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + -25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(30.0 * x), $MachinePrecision], t$95$1], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(-30 \cdot y\right)\\
t_1 := \left|\mathsf{fma}\left(\cos \left(-30 \cdot x\right), \sin \left(30 \cdot z\right), \mathsf{fma}\left(\sin \left(x \cdot 30\right), t\_0, \cos \left(-30 \cdot z\right) \cdot \sin \left(y \cdot 30\right)\right)\right)\right| - 0.2\\
\mathbf{if}\;x \leq -1.55 \cdot 10^{+142}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, t\_1\right)\\
\mathbf{elif}\;x \leq 10^{+118}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{fma}\left(30, \sqrt{\mathsf{fma}\left(z, z, \mathsf{fma}\left(y, y, x \cdot x\right)\right)}, -25\right), \left|\mathsf{fma}\left(t\_0, \sin \left(30 \cdot x\right), \sin \left(30 \cdot y\right)\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot x, t\_1\right)\\
\end{array}
\end{array}
if x < -1.55e142Initial program 12.4%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6412.4
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6412.4
Applied rewrites12.4%
Applied rewrites12.4%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
metadata-evalN/A
unpow1/2N/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6412.7
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6412.7
Applied rewrites12.7%
Taylor expanded in x around -inf
lift-*.f6478.0
Applied rewrites78.0%
if -1.55e142 < x < 9.99999999999999967e117Initial program 58.4%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6458.4
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.4
Applied rewrites58.4%
Applied rewrites58.8%
Applied rewrites58.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f6458.2
Applied rewrites58.2%
if 9.99999999999999967e117 < x Initial program 17.7%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6417.7
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6417.7
Applied rewrites17.7%
Applied rewrites17.7%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
metadata-evalN/A
unpow1/2N/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6418.2
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6418.2
Applied rewrites18.2%
Taylor expanded in x around inf
lift-*.f6474.5
Applied rewrites74.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (cos (* -30.0 y))))
(if (<= y -4.6e+128)
(fmax
(* -30.0 y)
(-
(fabs
(fma
(cos (* -30.0 x))
(sin (* 30.0 z))
(fma (sin (* x 30.0)) t_0 (* (cos (* -30.0 z)) (sin (* y 30.0))))))
0.2))
(fmax
(fma 30.0 (sqrt (fma z z (fma y y (* x x)))) -25.0)
(- (fabs (fma t_0 (sin (* 30.0 x)) (sin (* 30.0 y)))) 0.2)))))
double code(double x, double y, double z) {
double t_0 = cos((-30.0 * y));
double tmp;
if (y <= -4.6e+128) {
tmp = fmax((-30.0 * y), (fabs(fma(cos((-30.0 * x)), sin((30.0 * z)), fma(sin((x * 30.0)), t_0, (cos((-30.0 * z)) * sin((y * 30.0)))))) - 0.2));
} else {
tmp = fmax(fma(30.0, sqrt(fma(z, z, fma(y, y, (x * x)))), -25.0), (fabs(fma(t_0, sin((30.0 * x)), sin((30.0 * y)))) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = cos(Float64(-30.0 * y)) tmp = 0.0 if (y <= -4.6e+128) tmp = fmax(Float64(-30.0 * y), Float64(abs(fma(cos(Float64(-30.0 * x)), sin(Float64(30.0 * z)), fma(sin(Float64(x * 30.0)), t_0, Float64(cos(Float64(-30.0 * z)) * sin(Float64(y * 30.0)))))) - 0.2)); else tmp = fmax(fma(30.0, sqrt(fma(z, z, fma(y, y, Float64(x * x)))), -25.0), Float64(abs(fma(t_0, sin(Float64(30.0 * x)), sin(Float64(30.0 * y)))) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Cos[N[(-30.0 * y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, -4.6e+128], N[Max[N[(-30.0 * y), $MachinePrecision], N[(N[Abs[N[(N[Cos[N[(-30.0 * x), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * t$95$0 + N[(N[Cos[N[(-30.0 * z), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(30.0 * N[Sqrt[N[(z * z + N[(y * y + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + -25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(-30 \cdot y\right)\\
\mathbf{if}\;y \leq -4.6 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y, \left|\mathsf{fma}\left(\cos \left(-30 \cdot x\right), \sin \left(30 \cdot z\right), \mathsf{fma}\left(\sin \left(x \cdot 30\right), t\_0, \cos \left(-30 \cdot z\right) \cdot \sin \left(y \cdot 30\right)\right)\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{fma}\left(30, \sqrt{\mathsf{fma}\left(z, z, \mathsf{fma}\left(y, y, x \cdot x\right)\right)}, -25\right), \left|\mathsf{fma}\left(t\_0, \sin \left(30 \cdot x\right), \sin \left(30 \cdot y\right)\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if y < -4.59999999999999996e128Initial program 16.9%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6416.9
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6416.9
Applied rewrites16.9%
Applied rewrites16.9%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
metadata-evalN/A
unpow1/2N/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6417.1
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6417.1
Applied rewrites17.1%
Taylor expanded in y around -inf
lift-*.f6476.1
Applied rewrites76.1%
if -4.59999999999999996e128 < y Initial program 50.7%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6450.7
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.6
Applied rewrites50.6%
Applied rewrites51.1%
Applied rewrites51.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f6450.6
Applied rewrites50.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (cos (* -30.0 y))))
(if (<= x -1.55e+142)
(fmax
(* -30.0 x)
(-
(fabs
(fma
(cos (* -30.0 x))
(sin (* 30.0 z))
(fma (sin (* x 30.0)) t_0 (* (cos (* -30.0 z)) (sin (* y 30.0))))))
0.2))
(fmax
(fma 30.0 (sqrt (fma z z (fma y y (* x x)))) -25.0)
(- (fabs (fma t_0 (sin (* 30.0 x)) (sin (* 30.0 y)))) 0.2)))))
double code(double x, double y, double z) {
double t_0 = cos((-30.0 * y));
double tmp;
if (x <= -1.55e+142) {
tmp = fmax((-30.0 * x), (fabs(fma(cos((-30.0 * x)), sin((30.0 * z)), fma(sin((x * 30.0)), t_0, (cos((-30.0 * z)) * sin((y * 30.0)))))) - 0.2));
} else {
tmp = fmax(fma(30.0, sqrt(fma(z, z, fma(y, y, (x * x)))), -25.0), (fabs(fma(t_0, sin((30.0 * x)), sin((30.0 * y)))) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = cos(Float64(-30.0 * y)) tmp = 0.0 if (x <= -1.55e+142) tmp = fmax(Float64(-30.0 * x), Float64(abs(fma(cos(Float64(-30.0 * x)), sin(Float64(30.0 * z)), fma(sin(Float64(x * 30.0)), t_0, Float64(cos(Float64(-30.0 * z)) * sin(Float64(y * 30.0)))))) - 0.2)); else tmp = fmax(fma(30.0, sqrt(fma(z, z, fma(y, y, Float64(x * x)))), -25.0), Float64(abs(fma(t_0, sin(Float64(30.0 * x)), sin(Float64(30.0 * y)))) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Cos[N[(-30.0 * y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.55e+142], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(N[Cos[N[(-30.0 * x), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * t$95$0 + N[(N[Cos[N[(-30.0 * z), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(30.0 * N[Sqrt[N[(z * z + N[(y * y + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + -25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(-30 \cdot y\right)\\
\mathbf{if}\;x \leq -1.55 \cdot 10^{+142}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\cos \left(-30 \cdot x\right), \sin \left(30 \cdot z\right), \mathsf{fma}\left(\sin \left(x \cdot 30\right), t\_0, \cos \left(-30 \cdot z\right) \cdot \sin \left(y \cdot 30\right)\right)\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{fma}\left(30, \sqrt{\mathsf{fma}\left(z, z, \mathsf{fma}\left(y, y, x \cdot x\right)\right)}, -25\right), \left|\mathsf{fma}\left(t\_0, \sin \left(30 \cdot x\right), \sin \left(30 \cdot y\right)\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if x < -1.55e142Initial program 12.4%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6412.4
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6412.4
Applied rewrites12.4%
Applied rewrites12.4%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
metadata-evalN/A
unpow1/2N/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6412.7
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6412.7
Applied rewrites12.7%
Taylor expanded in x around -inf
lift-*.f6478.0
Applied rewrites78.0%
if -1.55e142 < x Initial program 51.0%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6451.0
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6451.0
Applied rewrites51.0%
Applied rewrites51.4%
Applied rewrites51.4%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f6450.9
Applied rewrites50.9%
(FPCore (x y z) :precision binary64 (fmax (fma 30.0 (sqrt (fma z z (fma y y (* x x)))) -25.0) (- (fabs (fma (cos (* -30.0 y)) (sin (* 30.0 x)) (sin (* 30.0 y)))) 0.2)))
double code(double x, double y, double z) {
return fmax(fma(30.0, sqrt(fma(z, z, fma(y, y, (x * x)))), -25.0), (fabs(fma(cos((-30.0 * y)), sin((30.0 * x)), sin((30.0 * y)))) - 0.2));
}
function code(x, y, z) return fmax(fma(30.0, sqrt(fma(z, z, fma(y, y, Float64(x * x)))), -25.0), Float64(abs(fma(cos(Float64(-30.0 * y)), sin(Float64(30.0 * x)), sin(Float64(30.0 * y)))) - 0.2)) end
code[x_, y_, z_] := N[Max[N[(30.0 * N[Sqrt[N[(z * z + N[(y * y + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + -25.0), $MachinePrecision], N[(N[Abs[N[(N[Cos[N[(-30.0 * y), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(\mathsf{fma}\left(30, \sqrt{\mathsf{fma}\left(z, z, \mathsf{fma}\left(y, y, x \cdot x\right)\right)}, -25\right), \left|\mathsf{fma}\left(\cos \left(-30 \cdot y\right), \sin \left(30 \cdot x\right), \sin \left(30 \cdot y\right)\right)\right| - 0.2\right)
\end{array}
Initial program 45.6%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f6445.6
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
distribute-rgt-outN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6445.6
Applied rewrites45.6%
Applied rewrites46.0%
Applied rewrites46.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-*.f6445.6
Applied rewrites45.6%
herbie shell --seed 2025107
(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)))