
(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}
Sampling outcomes in binary64 precision:
Herbie found 12 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 (sin (* 30.0 x)))
(t_1 (sin (* y 30.0)))
(t_2 (cos (* y 30.0)))
(t_3 (sin (* z 30.0))))
(if (<= y -2.3e+33)
(fmax (- (* (hypot y x) 30.0) 25.0) (- (fabs (fma t_0 t_2 t_1)) 0.2))
(if (<= y 1.4e+97)
(fmax
(- (hypot (* z 30.0) (* 30.0 x)) 25.0)
(-
(fabs
(+
(* t_3 (cos (* x 30.0)))
(+ (* (sin (* x 30.0)) t_2) (* t_1 (cos (* z 30.0))))))
0.2))
(fmax
(- (hypot (* y 30.0) (* 30.0 x)) 25.0)
(- (fabs (fma t_3 (cos (* 30.0 x)) t_0)) 0.2))))))
double code(double x, double y, double z) {
double t_0 = sin((30.0 * x));
double t_1 = sin((y * 30.0));
double t_2 = cos((y * 30.0));
double t_3 = sin((z * 30.0));
double tmp;
if (y <= -2.3e+33) {
tmp = fmax(((hypot(y, x) * 30.0) - 25.0), (fabs(fma(t_0, t_2, t_1)) - 0.2));
} else if (y <= 1.4e+97) {
tmp = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), (fabs(((t_3 * cos((x * 30.0))) + ((sin((x * 30.0)) * t_2) + (t_1 * cos((z * 30.0)))))) - 0.2));
} else {
tmp = fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), (fabs(fma(t_3, cos((30.0 * x)), t_0)) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = sin(Float64(30.0 * x)) t_1 = sin(Float64(y * 30.0)) t_2 = cos(Float64(y * 30.0)) t_3 = sin(Float64(z * 30.0)) tmp = 0.0 if (y <= -2.3e+33) tmp = fmax(Float64(Float64(hypot(y, x) * 30.0) - 25.0), Float64(abs(fma(t_0, t_2, t_1)) - 0.2)); elseif (y <= 1.4e+97) tmp = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(Float64(t_3 * cos(Float64(x * 30.0))) + Float64(Float64(sin(Float64(x * 30.0)) * t_2) + Float64(t_1 * cos(Float64(z * 30.0)))))) - 0.2)); else tmp = fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(fma(t_3, cos(Float64(30.0 * x)), t_0)) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, -2.3e+33], N[Max[N[(N[(N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision] * 30.0), $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * t$95$2 + t$95$1), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 1.4e+97], N[Max[N[(N[Sqrt[N[(z * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[(t$95$3 * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision] + N[(t$95$1 * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[Sqrt[N[(y * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$3 * N[Cos[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(30 \cdot x\right)\\
t_1 := \sin \left(y \cdot 30\right)\\
t_2 := \cos \left(y \cdot 30\right)\\
t_3 := \sin \left(z \cdot 30\right)\\
\mathbf{if}\;y \leq -2.3 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(y, x\right) \cdot 30 - 25, \left|\mathsf{fma}\left(t\_0, t\_2, t\_1\right)\right| - 0.2\right)\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+97}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, \left|t\_3 \cdot \cos \left(x \cdot 30\right) + \left(\sin \left(x \cdot 30\right) \cdot t\_2 + t\_1 \cdot \cos \left(z \cdot 30\right)\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(y \cdot 30, 30 \cdot x\right) - 25, \left|\mathsf{fma}\left(t\_3, \cos \left(30 \cdot x\right), t\_0\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if y < -2.30000000000000011e33Initial program 43.1%
Taylor expanded in z around 0
Applied rewrites43.1%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
+-commutativeN/A
unpow2N/A
unpow-prod-downN/A
metadata-evalN/A
unpow-prod-downN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites43.1%
Taylor expanded in z around 0
Applied rewrites92.2%
if -2.30000000000000011e33 < y < 1.4e97Initial program 51.1%
Taylor expanded in y around 0
Applied rewrites95.2%
if 1.4e97 < y Initial program 17.7%
Taylor expanded in z around 0
Applied rewrites93.8%
Taylor expanded in y around 0
Applied rewrites93.8%
Final simplification94.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sin (* 30.0 x))) (t_1 (sin (* y 30.0))) (t_2 (cos (* y 30.0))))
(if (<=
(fmax
(-
(sqrt
(+
(+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0))
(pow (* z 30.0) 2.0)))
25.0)
(-
(fabs
(+
(* (sin (* z 30.0)) (cos (* x 30.0)))
(+ (* (sin (* x 30.0)) t_2) (* t_1 (cos (* z 30.0))))))
0.2))
1e+154)
(fmax
(- (sqrt (fma (* z 30.0) (* z 30.0) (* 900.0 (fma x x (* y y))))) 25.0)
(- (fabs (fma t_0 t_2 t_1)) 0.2))
(fmax (* -30.0 x) (- (fabs (fma (* z 30.0) 1.0 t_0)) 0.2)))))
double code(double x, double y, double z) {
double t_0 = sin((30.0 * x));
double t_1 = sin((y * 30.0));
double t_2 = cos((y * 30.0));
double tmp;
if (fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs(((sin((z * 30.0)) * cos((x * 30.0))) + ((sin((x * 30.0)) * t_2) + (t_1 * cos((z * 30.0)))))) - 0.2)) <= 1e+154) {
tmp = fmax((sqrt(fma((z * 30.0), (z * 30.0), (900.0 * fma(x, x, (y * y))))) - 25.0), (fabs(fma(t_0, t_2, t_1)) - 0.2));
} else {
tmp = fmax((-30.0 * x), (fabs(fma((z * 30.0), 1.0, t_0)) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = sin(Float64(30.0 * x)) t_1 = sin(Float64(y * 30.0)) t_2 = cos(Float64(y * 30.0)) tmp = 0.0 if (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(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))) + Float64(Float64(sin(Float64(x * 30.0)) * t_2) + Float64(t_1 * cos(Float64(z * 30.0)))))) - 0.2)) <= 1e+154) tmp = fmax(Float64(sqrt(fma(Float64(z * 30.0), Float64(z * 30.0), Float64(900.0 * fma(x, x, Float64(y * y))))) - 25.0), Float64(abs(fma(t_0, t_2, t_1)) - 0.2)); else tmp = fmax(Float64(-30.0 * x), Float64(abs(fma(Float64(z * 30.0), 1.0, t_0)) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[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[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision] + N[(t$95$1 * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], 1e+154], N[Max[N[(N[Sqrt[N[(N[(z * 30.0), $MachinePrecision] * N[(z * 30.0), $MachinePrecision] + N[(900.0 * N[(x * x + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * t$95$2 + t$95$1), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(N[(z * 30.0), $MachinePrecision] * 1.0 + t$95$0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(30 \cdot x\right)\\
t_1 := \sin \left(y \cdot 30\right)\\
t_2 := \cos \left(y \cdot 30\right)\\
\mathbf{if}\;\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|\sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right) + \left(\sin \left(x \cdot 30\right) \cdot t\_2 + t\_1 \cdot \cos \left(z \cdot 30\right)\right)\right| - 0.2\right) \leq 10^{+154}:\\
\;\;\;\;\mathsf{max}\left(\sqrt{\mathsf{fma}\left(z \cdot 30, z \cdot 30, 900 \cdot \mathsf{fma}\left(x, x, y \cdot y\right)\right)} - 25, \left|\mathsf{fma}\left(t\_0, t\_2, t\_1\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(z \cdot 30, 1, t\_0\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) < 1.00000000000000004e154Initial program 99.9%
Taylor expanded in z around 0
Applied rewrites98.1%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
+-commutativeN/A
unpow2N/A
unpow-prod-downN/A
metadata-evalN/A
unpow-prod-downN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites98.0%
if 1.00000000000000004e154 < (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) Initial program 9.0%
Taylor expanded in x around -inf
Applied rewrites21.8%
Taylor expanded in y around 0
Applied rewrites21.6%
Taylor expanded in z around 0
Applied rewrites38.6%
Taylor expanded in x around 0
Applied rewrites50.6%
Final simplification68.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sin (* y 30.0))))
(if (<=
(fmax
(-
(sqrt
(+
(+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0))
(pow (* z 30.0) 2.0)))
25.0)
(-
(fabs
(+
(* (sin (* z 30.0)) (cos (* x 30.0)))
(+
(* (sin (* x 30.0)) (cos (* y 30.0)))
(* t_0 (cos (* z 30.0))))))
0.2))
1e+154)
(fmax
(- (sqrt (fma (* z 30.0) (* z 30.0) (* 900.0 (fma x x (* y y))))) 25.0)
(- (fabs t_0) 0.2))
(fmax (* -30.0 x) (- (fabs (fma (* z 30.0) 1.0 (sin (* 30.0 x)))) 0.2)))))
double code(double x, double y, double z) {
double t_0 = sin((y * 30.0));
double tmp;
if (fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs(((sin((z * 30.0)) * cos((x * 30.0))) + ((sin((x * 30.0)) * cos((y * 30.0))) + (t_0 * cos((z * 30.0)))))) - 0.2)) <= 1e+154) {
tmp = fmax((sqrt(fma((z * 30.0), (z * 30.0), (900.0 * fma(x, x, (y * y))))) - 25.0), (fabs(t_0) - 0.2));
} else {
tmp = fmax((-30.0 * x), (fabs(fma((z * 30.0), 1.0, sin((30.0 * x)))) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = sin(Float64(y * 30.0)) tmp = 0.0 if (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(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))) + Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(t_0 * cos(Float64(z * 30.0)))))) - 0.2)) <= 1e+154) tmp = fmax(Float64(sqrt(fma(Float64(z * 30.0), Float64(z * 30.0), Float64(900.0 * fma(x, x, Float64(y * y))))) - 25.0), Float64(abs(t_0) - 0.2)); else tmp = fmax(Float64(-30.0 * x), Float64(abs(fma(Float64(z * 30.0), 1.0, sin(Float64(30.0 * x)))) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[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[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], 1e+154], N[Max[N[(N[Sqrt[N[(N[(z * 30.0), $MachinePrecision] * N[(z * 30.0), $MachinePrecision] + N[(900.0 * N[(x * x + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[t$95$0], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(N[(z * 30.0), $MachinePrecision] * 1.0 + N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(y \cdot 30\right)\\
\mathbf{if}\;\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|\sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right) + \left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + t\_0 \cdot \cos \left(z \cdot 30\right)\right)\right| - 0.2\right) \leq 10^{+154}:\\
\;\;\;\;\mathsf{max}\left(\sqrt{\mathsf{fma}\left(z \cdot 30, z \cdot 30, 900 \cdot \mathsf{fma}\left(x, x, y \cdot y\right)\right)} - 25, \left|t\_0\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(z \cdot 30, 1, \sin \left(30 \cdot x\right)\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) < 1.00000000000000004e154Initial program 99.9%
Taylor expanded in z around 0
Applied rewrites98.1%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
+-commutativeN/A
unpow2N/A
unpow-prod-downN/A
metadata-evalN/A
unpow-prod-downN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites98.0%
Taylor expanded in x around 0
Applied rewrites97.4%
if 1.00000000000000004e154 < (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) Initial program 9.0%
Taylor expanded in x around -inf
Applied rewrites21.8%
Taylor expanded in y around 0
Applied rewrites21.6%
Taylor expanded in z around 0
Applied rewrites38.6%
Taylor expanded in x around 0
Applied rewrites50.6%
Final simplification68.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sin (* y 30.0))))
(if (<=
(fmax
(-
(sqrt
(+
(+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0))
(pow (* z 30.0) 2.0)))
25.0)
(-
(fabs
(+
(* (sin (* z 30.0)) (cos (* x 30.0)))
(+
(* (sin (* x 30.0)) (cos (* y 30.0)))
(* t_0 (cos (* z 30.0))))))
0.2))
20.0)
(fmax (- (sqrt (* (* y y) 900.0)) 25.0) (- (fabs t_0) 0.2))
(fmax
(* -30.0 x)
(- (fabs (fma (* z 30.0) (cos (* 30.0 x)) (* 30.0 x))) 0.2)))))
double code(double x, double y, double z) {
double t_0 = sin((y * 30.0));
double tmp;
if (fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs(((sin((z * 30.0)) * cos((x * 30.0))) + ((sin((x * 30.0)) * cos((y * 30.0))) + (t_0 * cos((z * 30.0)))))) - 0.2)) <= 20.0) {
tmp = fmax((sqrt(((y * y) * 900.0)) - 25.0), (fabs(t_0) - 0.2));
} else {
tmp = fmax((-30.0 * x), (fabs(fma((z * 30.0), cos((30.0 * x)), (30.0 * x))) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = sin(Float64(y * 30.0)) tmp = 0.0 if (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(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))) + Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(t_0 * cos(Float64(z * 30.0)))))) - 0.2)) <= 20.0) tmp = fmax(Float64(sqrt(Float64(Float64(y * y) * 900.0)) - 25.0), Float64(abs(t_0) - 0.2)); else tmp = fmax(Float64(-30.0 * x), Float64(abs(fma(Float64(z * 30.0), cos(Float64(30.0 * x)), Float64(30.0 * x))) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[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[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], 20.0], N[Max[N[(N[Sqrt[N[(N[(y * y), $MachinePrecision] * 900.0), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[t$95$0], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(N[(z * 30.0), $MachinePrecision] * N[Cos[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(y \cdot 30\right)\\
\mathbf{if}\;\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|\sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right) + \left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + t\_0 \cdot \cos \left(z \cdot 30\right)\right)\right| - 0.2\right) \leq 20:\\
\;\;\;\;\mathsf{max}\left(\sqrt{\left(y \cdot y\right) \cdot 900} - 25, \left|t\_0\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(z \cdot 30, \cos \left(30 \cdot x\right), 30 \cdot x\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) < 20Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites92.7%
Taylor expanded in y around inf
Applied rewrites92.7%
Taylor expanded in x around 0
Applied rewrites90.2%
if 20 < (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) Initial program 37.4%
Taylor expanded in x around -inf
Applied rewrites22.1%
Taylor expanded in y around 0
Applied rewrites21.8%
Taylor expanded in z around 0
Applied rewrites40.6%
Taylor expanded in x around 0
Applied rewrites51.9%
Final simplification55.6%
(FPCore (x y z)
:precision binary64
(if (<=
(fmax
(-
(sqrt
(+
(+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0))
(pow (* z 30.0) 2.0)))
25.0)
(-
(fabs
(+
(* (sin (* z 30.0)) (cos (* x 30.0)))
(+
(* (sin (* x 30.0)) (cos (* y 30.0)))
(* (sin (* y 30.0)) (cos (* z 30.0))))))
0.2))
20.0)
(fmax (- (sqrt (* (* y y) 900.0)) 25.0) (- (fabs (sin (* 30.0 x))) 0.2))
(fmax
(* -30.0 x)
(- (fabs (fma (* z 30.0) (cos (* 30.0 x)) (* 30.0 x))) 0.2))))
double code(double x, double y, double z) {
double tmp;
if (fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs(((sin((z * 30.0)) * cos((x * 30.0))) + ((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))))) - 0.2)) <= 20.0) {
tmp = fmax((sqrt(((y * y) * 900.0)) - 25.0), (fabs(sin((30.0 * x))) - 0.2));
} else {
tmp = fmax((-30.0 * x), (fabs(fma((z * 30.0), cos((30.0 * x)), (30.0 * x))) - 0.2));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (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(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))) + Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(sin(Float64(y * 30.0)) * cos(Float64(z * 30.0)))))) - 0.2)) <= 20.0) tmp = fmax(Float64(sqrt(Float64(Float64(y * y) * 900.0)) - 25.0), Float64(abs(sin(Float64(30.0 * x))) - 0.2)); else tmp = fmax(Float64(-30.0 * x), Float64(abs(fma(Float64(z * 30.0), cos(Float64(30.0 * x)), Float64(30.0 * x))) - 0.2)); end return tmp end
code[x_, y_, z_] := If[LessEqual[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[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 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]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], 20.0], N[Max[N[(N[Sqrt[N[(N[(y * y), $MachinePrecision] * 900.0), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(N[(z * 30.0), $MachinePrecision] * N[Cos[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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|\sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right) + \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)\right| - 0.2\right) \leq 20:\\
\;\;\;\;\mathsf{max}\left(\sqrt{\left(y \cdot y\right) \cdot 900} - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(z \cdot 30, \cos \left(30 \cdot x\right), 30 \cdot x\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) < 20Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites92.7%
Taylor expanded in y around inf
Applied rewrites92.7%
Taylor expanded in y around 0
Applied rewrites88.8%
if 20 < (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) Initial program 37.4%
Taylor expanded in x around -inf
Applied rewrites22.1%
Taylor expanded in y around 0
Applied rewrites21.8%
Taylor expanded in z around 0
Applied rewrites40.6%
Taylor expanded in x around 0
Applied rewrites51.9%
Final simplification55.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin (* z 30.0)) (cos (* x 30.0)))))
(if (or (<= z -1.15e+30) (not (<= z 1.3e+69)))
(fmax
(- (hypot (* z 30.0) (* 30.0 x)) 25.0)
(- (fabs (+ t_0 (sin (* 30.0 x)))) 0.2))
(fmax
(- (hypot (* y 30.0) (* 30.0 x)) 25.0)
(-
(fabs
(+
t_0
(+
(* (sin (* x 30.0)) (cos (* y 30.0)))
(* (sin (* y 30.0)) (cos (* z 30.0))))))
0.2)))))
double code(double x, double y, double z) {
double t_0 = sin((z * 30.0)) * cos((x * 30.0));
double tmp;
if ((z <= -1.15e+30) || !(z <= 1.3e+69)) {
tmp = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), (fabs((t_0 + sin((30.0 * x)))) - 0.2));
} else {
tmp = fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), (fabs((t_0 + ((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))))) - 0.2));
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = Math.sin((z * 30.0)) * Math.cos((x * 30.0));
double tmp;
if ((z <= -1.15e+30) || !(z <= 1.3e+69)) {
tmp = fmax((Math.hypot((z * 30.0), (30.0 * x)) - 25.0), (Math.abs((t_0 + Math.sin((30.0 * x)))) - 0.2));
} else {
tmp = fmax((Math.hypot((y * 30.0), (30.0 * x)) - 25.0), (Math.abs((t_0 + ((Math.sin((x * 30.0)) * Math.cos((y * 30.0))) + (Math.sin((y * 30.0)) * Math.cos((z * 30.0)))))) - 0.2));
}
return tmp;
}
def code(x, y, z): t_0 = math.sin((z * 30.0)) * math.cos((x * 30.0)) tmp = 0 if (z <= -1.15e+30) or not (z <= 1.3e+69): tmp = fmax((math.hypot((z * 30.0), (30.0 * x)) - 25.0), (math.fabs((t_0 + math.sin((30.0 * x)))) - 0.2)) else: tmp = fmax((math.hypot((y * 30.0), (30.0 * x)) - 25.0), (math.fabs((t_0 + ((math.sin((x * 30.0)) * math.cos((y * 30.0))) + (math.sin((y * 30.0)) * math.cos((z * 30.0)))))) - 0.2)) return tmp
function code(x, y, z) t_0 = Float64(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))) tmp = 0.0 if ((z <= -1.15e+30) || !(z <= 1.3e+69)) tmp = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(t_0 + sin(Float64(30.0 * x)))) - 0.2)); else tmp = fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(t_0 + Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(sin(Float64(y * 30.0)) * cos(Float64(z * 30.0)))))) - 0.2)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin((z * 30.0)) * cos((x * 30.0)); tmp = 0.0; if ((z <= -1.15e+30) || ~((z <= 1.3e+69))) tmp = max((hypot((z * 30.0), (30.0 * x)) - 25.0), (abs((t_0 + sin((30.0 * x)))) - 0.2)); else tmp = max((hypot((y * 30.0), (30.0 * x)) - 25.0), (abs((t_0 + ((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))))) - 0.2)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[z, -1.15e+30], N[Not[LessEqual[z, 1.3e+69]], $MachinePrecision]], N[Max[N[(N[Sqrt[N[(z * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 + N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[Sqrt[N[(y * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 + 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]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+30} \lor \neg \left(z \leq 1.3 \cdot 10^{+69}\right):\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, \left|t\_0 + \sin \left(30 \cdot x\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(y \cdot 30, 30 \cdot x\right) - 25, \left|t\_0 + \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)\right| - 0.2\right)\\
\end{array}
\end{array}
if z < -1.15e30 or 1.3000000000000001e69 < z Initial program 32.1%
Taylor expanded in y around 0
Applied rewrites89.9%
Taylor expanded in y around 0
Applied rewrites89.9%
if -1.15e30 < z < 1.3000000000000001e69Initial program 50.9%
Taylor expanded in z around 0
Applied rewrites97.0%
Final simplification94.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sin (* z 30.0))) (t_1 (sin (* 30.0 x))))
(if (or (<= z -1.15e+30) (not (<= z 1.3e+69)))
(fmax
(- (hypot (* z 30.0) (* 30.0 x)) 25.0)
(- (fabs (+ (* t_0 (cos (* x 30.0))) t_1)) 0.2))
(fmax
(- (hypot (* y 30.0) (* 30.0 x)) 25.0)
(- (fabs (fma t_0 (cos (* 30.0 x)) t_1)) 0.2)))))
double code(double x, double y, double z) {
double t_0 = sin((z * 30.0));
double t_1 = sin((30.0 * x));
double tmp;
if ((z <= -1.15e+30) || !(z <= 1.3e+69)) {
tmp = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), (fabs(((t_0 * cos((x * 30.0))) + t_1)) - 0.2));
} else {
tmp = fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), (fabs(fma(t_0, cos((30.0 * x)), t_1)) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = sin(Float64(z * 30.0)) t_1 = sin(Float64(30.0 * x)) tmp = 0.0 if ((z <= -1.15e+30) || !(z <= 1.3e+69)) tmp = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(Float64(t_0 * cos(Float64(x * 30.0))) + t_1)) - 0.2)); else tmp = fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(fma(t_0, cos(Float64(30.0 * x)), t_1)) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[z, -1.15e+30], N[Not[LessEqual[z, 1.3e+69]], $MachinePrecision]], N[Max[N[(N[Sqrt[N[(z * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[(t$95$0 * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[Sqrt[N[(y * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * N[Cos[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(z \cdot 30\right)\\
t_1 := \sin \left(30 \cdot x\right)\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+30} \lor \neg \left(z \leq 1.3 \cdot 10^{+69}\right):\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, \left|t\_0 \cdot \cos \left(x \cdot 30\right) + t\_1\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(y \cdot 30, 30 \cdot x\right) - 25, \left|\mathsf{fma}\left(t\_0, \cos \left(30 \cdot x\right), t\_1\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if z < -1.15e30 or 1.3000000000000001e69 < z Initial program 32.1%
Taylor expanded in y around 0
Applied rewrites89.9%
Taylor expanded in y around 0
Applied rewrites89.9%
if -1.15e30 < z < 1.3000000000000001e69Initial program 50.9%
Taylor expanded in z around 0
Applied rewrites97.0%
Taylor expanded in y around 0
Applied rewrites96.3%
Final simplification93.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sin (* 30.0 x))))
(if (or (<= z -1.4e+102) (not (<= z 1.3e+69)))
(fmax (* -30.0 x) (- (fabs (fma (* z 30.0) 1.0 t_0)) 0.2))
(fmax
(- (hypot (* y 30.0) (* 30.0 x)) 25.0)
(- (fabs (fma (sin (* z 30.0)) (cos (* 30.0 x)) t_0)) 0.2)))))
double code(double x, double y, double z) {
double t_0 = sin((30.0 * x));
double tmp;
if ((z <= -1.4e+102) || !(z <= 1.3e+69)) {
tmp = fmax((-30.0 * x), (fabs(fma((z * 30.0), 1.0, t_0)) - 0.2));
} else {
tmp = fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), (fabs(fma(sin((z * 30.0)), cos((30.0 * x)), t_0)) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = sin(Float64(30.0 * x)) tmp = 0.0 if ((z <= -1.4e+102) || !(z <= 1.3e+69)) tmp = fmax(Float64(-30.0 * x), Float64(abs(fma(Float64(z * 30.0), 1.0, t_0)) - 0.2)); else tmp = fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(fma(sin(Float64(z * 30.0)), cos(Float64(30.0 * x)), t_0)) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[z, -1.4e+102], N[Not[LessEqual[z, 1.3e+69]], $MachinePrecision]], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(N[(z * 30.0), $MachinePrecision] * 1.0 + t$95$0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[Sqrt[N[(y * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(30 \cdot x\right)\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{+102} \lor \neg \left(z \leq 1.3 \cdot 10^{+69}\right):\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(z \cdot 30, 1, t\_0\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(y \cdot 30, 30 \cdot x\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), t\_0\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if z < -1.40000000000000009e102 or 1.3000000000000001e69 < z Initial program 28.0%
Taylor expanded in x around -inf
Applied rewrites16.4%
Taylor expanded in y around 0
Applied rewrites16.5%
Taylor expanded in z around 0
Applied rewrites58.0%
Taylor expanded in x around 0
Applied rewrites82.5%
if -1.40000000000000009e102 < z < 1.3000000000000001e69Initial program 52.4%
Taylor expanded in z around 0
Applied rewrites95.7%
Taylor expanded in y around 0
Applied rewrites95.1%
Final simplification90.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sin (* 30.0 x))))
(if (or (<= z -9.8e+101) (not (<= z 1.3e+69)))
(fmax (* -30.0 x) (- (fabs (fma (* z 30.0) 1.0 t_0)) 0.2))
(fmax
(- (* (hypot y x) 30.0) 25.0)
(- (fabs (fma t_0 (cos (* y 30.0)) (sin (* y 30.0)))) 0.2)))))
double code(double x, double y, double z) {
double t_0 = sin((30.0 * x));
double tmp;
if ((z <= -9.8e+101) || !(z <= 1.3e+69)) {
tmp = fmax((-30.0 * x), (fabs(fma((z * 30.0), 1.0, t_0)) - 0.2));
} else {
tmp = fmax(((hypot(y, x) * 30.0) - 25.0), (fabs(fma(t_0, cos((y * 30.0)), sin((y * 30.0)))) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = sin(Float64(30.0 * x)) tmp = 0.0 if ((z <= -9.8e+101) || !(z <= 1.3e+69)) tmp = fmax(Float64(-30.0 * x), Float64(abs(fma(Float64(z * 30.0), 1.0, t_0)) - 0.2)); else tmp = fmax(Float64(Float64(hypot(y, x) * 30.0) - 25.0), Float64(abs(fma(t_0, cos(Float64(y * 30.0)), sin(Float64(y * 30.0)))) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[z, -9.8e+101], N[Not[LessEqual[z, 1.3e+69]], $MachinePrecision]], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(N[(z * 30.0), $MachinePrecision] * 1.0 + t$95$0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[(N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision] * 30.0), $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] + N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(30 \cdot x\right)\\
\mathbf{if}\;z \leq -9.8 \cdot 10^{+101} \lor \neg \left(z \leq 1.3 \cdot 10^{+69}\right):\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(z \cdot 30, 1, t\_0\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(y, x\right) \cdot 30 - 25, \left|\mathsf{fma}\left(t\_0, \cos \left(y \cdot 30\right), \sin \left(y \cdot 30\right)\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if z < -9.79999999999999965e101 or 1.3000000000000001e69 < z Initial program 28.0%
Taylor expanded in x around -inf
Applied rewrites16.4%
Taylor expanded in y around 0
Applied rewrites16.5%
Taylor expanded in z around 0
Applied rewrites58.0%
Taylor expanded in x around 0
Applied rewrites82.5%
if -9.79999999999999965e101 < z < 1.3000000000000001e69Initial program 52.4%
Taylor expanded in z around 0
Applied rewrites51.4%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
+-commutativeN/A
unpow2N/A
unpow-prod-downN/A
metadata-evalN/A
unpow-prod-downN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites51.3%
Taylor expanded in z around 0
Applied rewrites94.4%
Final simplification90.0%
(FPCore (x y z) :precision binary64 (if (<= x 3.2e+161) (fmax (* -30.0 x) (- (fabs (fma (* z 30.0) 1.0 (sin (* 30.0 x)))) 0.2)) (fmax (* -30.0 x) (- (fabs (* 30.0 x)) 0.2))))
double code(double x, double y, double z) {
double tmp;
if (x <= 3.2e+161) {
tmp = fmax((-30.0 * x), (fabs(fma((z * 30.0), 1.0, sin((30.0 * x)))) - 0.2));
} else {
tmp = fmax((-30.0 * x), (fabs((30.0 * x)) - 0.2));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 3.2e+161) tmp = fmax(Float64(-30.0 * x), Float64(abs(fma(Float64(z * 30.0), 1.0, sin(Float64(30.0 * x)))) - 0.2)); else tmp = fmax(Float64(-30.0 * x), Float64(abs(Float64(30.0 * x)) - 0.2)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 3.2e+161], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(N[(z * 30.0), $MachinePrecision] * 1.0 + N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.2 \cdot 10^{+161}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(z \cdot 30, 1, \sin \left(30 \cdot x\right)\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)\\
\end{array}
\end{array}
if x < 3.20000000000000002e161Initial program 47.4%
Taylor expanded in x around -inf
Applied rewrites23.1%
Taylor expanded in y around 0
Applied rewrites22.7%
Taylor expanded in z around 0
Applied rewrites41.3%
Taylor expanded in x around 0
Applied rewrites50.8%
if 3.20000000000000002e161 < x Initial program 13.5%
Taylor expanded in x around -inf
Applied rewrites3.1%
Taylor expanded in y around 0
Applied rewrites3.4%
Taylor expanded in z around 0
Applied rewrites3.4%
Taylor expanded in x around 0
Applied rewrites73.1%
(FPCore (x y z) :precision binary64 (fmax (* -30.0 x) (- (fabs (fma 30.0 x (sin (* z 30.0)))) 0.2)))
double code(double x, double y, double z) {
return fmax((-30.0 * x), (fabs(fma(30.0, x, sin((z * 30.0)))) - 0.2));
}
function code(x, y, z) return fmax(Float64(-30.0 * x), Float64(abs(fma(30.0, x, sin(Float64(z * 30.0)))) - 0.2)) end
code[x_, y_, z_] := N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(30.0 * x + N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(30, x, \sin \left(z \cdot 30\right)\right)\right| - 0.2\right)
\end{array}
Initial program 43.5%
Taylor expanded in x around -inf
Applied rewrites20.8%
Taylor expanded in y around 0
Applied rewrites20.5%
Taylor expanded in x around 0
Applied rewrites31.8%
(FPCore (x y z) :precision binary64 (fmax (* -30.0 x) (- (fabs (* 30.0 x)) 0.2)))
double code(double x, double y, double z) {
return fmax((-30.0 * x), (fabs((30.0 * x)) - 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(((-30.0d0) * x), (abs((30.0d0 * x)) - 0.2d0))
end function
public static double code(double x, double y, double z) {
return fmax((-30.0 * x), (Math.abs((30.0 * x)) - 0.2));
}
def code(x, y, z): return fmax((-30.0 * x), (math.fabs((30.0 * x)) - 0.2))
function code(x, y, z) return fmax(Float64(-30.0 * x), Float64(abs(Float64(30.0 * x)) - 0.2)) end
function tmp = code(x, y, z) tmp = max((-30.0 * x), (abs((30.0 * x)) - 0.2)); end
code[x_, y_, z_] := N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)
\end{array}
Initial program 43.5%
Taylor expanded in x around -inf
Applied rewrites20.8%
Taylor expanded in y around 0
Applied rewrites20.5%
Taylor expanded in z around 0
Applied rewrites19.6%
Taylor expanded in x around 0
Applied rewrites30.9%
herbie shell --seed 2025026
(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)))