
(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 8 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 (+ (sin (* 30.0 x)) (* 30.0 (* z (cos (* 30.0 x)))))) 0.2)))
(if (<= y -2.65e+19)
(fmax (* -30.0 y) t_0)
(if (<= y 165000.0)
(fmax
(* z (- 30.0 (* 25.0 (/ 1.0 z))))
(- (fabs (+ (sin (* 30.0 z)) (* 30.0 x))) 0.2))
(fmax (* y (- 30.0 (* 25.0 (/ 1.0 y)))) t_0)))))
double code(double x, double y, double z) {
double t_0 = fabs((sin((30.0 * x)) + (30.0 * (z * cos((30.0 * x)))))) - 0.2;
double tmp;
if (y <= -2.65e+19) {
tmp = fmax((-30.0 * y), t_0);
} else if (y <= 165000.0) {
tmp = fmax((z * (30.0 - (25.0 * (1.0 / z)))), (fabs((sin((30.0 * z)) + (30.0 * x))) - 0.2));
} else {
tmp = fmax((y * (30.0 - (25.0 * (1.0 / y)))), t_0);
}
return tmp;
}
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
real(8) :: t_0
real(8) :: tmp
t_0 = abs((sin((30.0d0 * x)) + (30.0d0 * (z * cos((30.0d0 * x)))))) - 0.2d0
if (y <= (-2.65d+19)) then
tmp = fmax(((-30.0d0) * y), t_0)
else if (y <= 165000.0d0) then
tmp = fmax((z * (30.0d0 - (25.0d0 * (1.0d0 / z)))), (abs((sin((30.0d0 * z)) + (30.0d0 * x))) - 0.2d0))
else
tmp = fmax((y * (30.0d0 - (25.0d0 * (1.0d0 / y)))), t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((Math.sin((30.0 * x)) + (30.0 * (z * Math.cos((30.0 * x)))))) - 0.2;
double tmp;
if (y <= -2.65e+19) {
tmp = fmax((-30.0 * y), t_0);
} else if (y <= 165000.0) {
tmp = fmax((z * (30.0 - (25.0 * (1.0 / z)))), (Math.abs((Math.sin((30.0 * z)) + (30.0 * x))) - 0.2));
} else {
tmp = fmax((y * (30.0 - (25.0 * (1.0 / y)))), t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((math.sin((30.0 * x)) + (30.0 * (z * math.cos((30.0 * x)))))) - 0.2 tmp = 0 if y <= -2.65e+19: tmp = fmax((-30.0 * y), t_0) elif y <= 165000.0: tmp = fmax((z * (30.0 - (25.0 * (1.0 / z)))), (math.fabs((math.sin((30.0 * z)) + (30.0 * x))) - 0.2)) else: tmp = fmax((y * (30.0 - (25.0 * (1.0 / y)))), t_0) return tmp
function code(x, y, z) t_0 = Float64(abs(Float64(sin(Float64(30.0 * x)) + Float64(30.0 * Float64(z * cos(Float64(30.0 * x)))))) - 0.2) tmp = 0.0 if (y <= -2.65e+19) tmp = fmax(Float64(-30.0 * y), t_0); elseif (y <= 165000.0) tmp = fmax(Float64(z * Float64(30.0 - Float64(25.0 * Float64(1.0 / z)))), Float64(abs(Float64(sin(Float64(30.0 * z)) + Float64(30.0 * x))) - 0.2)); else tmp = fmax(Float64(y * Float64(30.0 - Float64(25.0 * Float64(1.0 / y)))), t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((sin((30.0 * x)) + (30.0 * (z * cos((30.0 * x)))))) - 0.2; tmp = 0.0; if (y <= -2.65e+19) tmp = max((-30.0 * y), t_0); elseif (y <= 165000.0) tmp = max((z * (30.0 - (25.0 * (1.0 / z)))), (abs((sin((30.0 * z)) + (30.0 * x))) - 0.2)); else tmp = max((y * (30.0 - (25.0 * (1.0 / y)))), t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[N[(N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + N[(30.0 * N[(z * N[Cos[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, If[LessEqual[y, -2.65e+19], N[Max[N[(-30.0 * y), $MachinePrecision], t$95$0], $MachinePrecision], If[LessEqual[y, 165000.0], N[Max[N[(z * N[(30.0 - N[(25.0 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(y * N[(30.0 - N[(25.0 * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\sin \left(30 \cdot x\right) + 30 \cdot \left(z \cdot \cos \left(30 \cdot x\right)\right)\right| - 0.2\\
\mathbf{if}\;y \leq -2.65 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y, t\_0\right)\\
\mathbf{elif}\;y \leq 165000:\\
\;\;\;\;\mathsf{max}\left(z \cdot \left(30 - 25 \cdot \frac{1}{z}\right), \left|\sin \left(30 \cdot z\right) + 30 \cdot x\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(y \cdot \left(30 - 25 \cdot \frac{1}{y}\right), t\_0\right)\\
\end{array}
\end{array}
if y < -2.65e19Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
Taylor expanded in y around -inf
lower-*.f6437.3
Applied rewrites37.3%
if -2.65e19 < y < 165000Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in x around 0
lower-*.f6457.3
Applied rewrites57.3%
Taylor expanded in x around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f6457.5
Applied rewrites57.5%
if 165000 < y Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6448.5
Applied rewrites48.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* z z) 900.0))
(t_1 (sin (* 30.0 x)))
(t_2 (fma (* x x) 900.0 (* 900.0 (* y y)))))
(if (<= y -2.65e+19)
(fmax (* -30.0 y) (- (fabs (+ t_1 (* 30.0 (* z (cos (* 30.0 x)))))) 0.2))
(if (<= y 0.006)
(fmax
(* z (- 30.0 (* 25.0 (/ 1.0 z))))
(- (fabs (+ (sin (* 30.0 z)) (* 30.0 x))) 0.2))
(if (<= y 1.8e+135)
(fmax
(- (sqrt (fma (* z z) 900.0 t_2)) 25.0)
(+ (fabs (fma y 30.0 t_1)) -0.2))
(fmax
(- (sqrt (* (+ 1.0 (/ t_2 t_0)) t_0)) 25.0)
(* (+ 1.0 (/ (fabs (+ t_1 (* 30.0 y))) -0.2)) -0.2)))))))
double code(double x, double y, double z) {
double t_0 = (z * z) * 900.0;
double t_1 = sin((30.0 * x));
double t_2 = fma((x * x), 900.0, (900.0 * (y * y)));
double tmp;
if (y <= -2.65e+19) {
tmp = fmax((-30.0 * y), (fabs((t_1 + (30.0 * (z * cos((30.0 * x)))))) - 0.2));
} else if (y <= 0.006) {
tmp = fmax((z * (30.0 - (25.0 * (1.0 / z)))), (fabs((sin((30.0 * z)) + (30.0 * x))) - 0.2));
} else if (y <= 1.8e+135) {
tmp = fmax((sqrt(fma((z * z), 900.0, t_2)) - 25.0), (fabs(fma(y, 30.0, t_1)) + -0.2));
} else {
tmp = fmax((sqrt(((1.0 + (t_2 / t_0)) * t_0)) - 25.0), ((1.0 + (fabs((t_1 + (30.0 * y))) / -0.2)) * -0.2));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(z * z) * 900.0) t_1 = sin(Float64(30.0 * x)) t_2 = fma(Float64(x * x), 900.0, Float64(900.0 * Float64(y * y))) tmp = 0.0 if (y <= -2.65e+19) tmp = fmax(Float64(-30.0 * y), Float64(abs(Float64(t_1 + Float64(30.0 * Float64(z * cos(Float64(30.0 * x)))))) - 0.2)); elseif (y <= 0.006) tmp = fmax(Float64(z * Float64(30.0 - Float64(25.0 * Float64(1.0 / z)))), Float64(abs(Float64(sin(Float64(30.0 * z)) + Float64(30.0 * x))) - 0.2)); elseif (y <= 1.8e+135) tmp = fmax(Float64(sqrt(fma(Float64(z * z), 900.0, t_2)) - 25.0), Float64(abs(fma(y, 30.0, t_1)) + -0.2)); else tmp = fmax(Float64(sqrt(Float64(Float64(1.0 + Float64(t_2 / t_0)) * t_0)) - 25.0), Float64(Float64(1.0 + Float64(abs(Float64(t_1 + Float64(30.0 * y))) / -0.2)) * -0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * z), $MachinePrecision] * 900.0), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * x), $MachinePrecision] * 900.0 + N[(900.0 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.65e+19], N[Max[N[(-30.0 * y), $MachinePrecision], N[(N[Abs[N[(t$95$1 + N[(30.0 * N[(z * N[Cos[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 0.006], N[Max[N[(z * N[(30.0 - N[(25.0 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 1.8e+135], N[Max[N[(N[Sqrt[N[(N[(z * z), $MachinePrecision] * 900.0 + t$95$2), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(y * 30.0 + t$95$1), $MachinePrecision]], $MachinePrecision] + -0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[Sqrt[N[(N[(1.0 + N[(t$95$2 / t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[(1.0 + N[(N[Abs[N[(t$95$1 + N[(30.0 * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / -0.2), $MachinePrecision]), $MachinePrecision] * -0.2), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot z\right) \cdot 900\\
t_1 := \sin \left(30 \cdot x\right)\\
t_2 := \mathsf{fma}\left(x \cdot x, 900, 900 \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq -2.65 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y, \left|t\_1 + 30 \cdot \left(z \cdot \cos \left(30 \cdot x\right)\right)\right| - 0.2\right)\\
\mathbf{elif}\;y \leq 0.006:\\
\;\;\;\;\mathsf{max}\left(z \cdot \left(30 - 25 \cdot \frac{1}{z}\right), \left|\sin \left(30 \cdot z\right) + 30 \cdot x\right| - 0.2\right)\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+135}:\\
\;\;\;\;\mathsf{max}\left(\sqrt{\mathsf{fma}\left(z \cdot z, 900, t\_2\right)} - 25, \left|\mathsf{fma}\left(y, 30, t\_1\right)\right| + -0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\sqrt{\left(1 + \frac{t\_2}{t\_0}\right) \cdot t\_0} - 25, \left(1 + \frac{\left|t\_1 + 30 \cdot y\right|}{-0.2}\right) \cdot -0.2\right)\\
\end{array}
\end{array}
if y < -2.65e19Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
Taylor expanded in y around -inf
lower-*.f6437.3
Applied rewrites37.3%
if -2.65e19 < y < 0.0060000000000000001Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in x around 0
lower-*.f6457.3
Applied rewrites57.3%
Taylor expanded in x around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f6457.5
Applied rewrites57.5%
if 0.0060000000000000001 < y < 1.7999999999999999e135Initial program 46.6%
Applied rewrites46.6%
Taylor expanded in z around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f6446.0
Applied rewrites46.0%
Applied rewrites45.9%
if 1.7999999999999999e135 < y Initial program 46.6%
Applied rewrites46.6%
Taylor expanded in z around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f6446.0
Applied rewrites46.0%
lift-+.f64N/A
+-commutativeN/A
sum-to-multN/A
lower-special-*.f64N/A
Applied rewrites45.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* x x) 900.0)) (t_1 (sin (* 30.0 x))))
(if (<= y -2.65e+19)
(fmax (* -30.0 y) (- (fabs (+ t_1 (* 30.0 (* z (cos (* 30.0 x)))))) 0.2))
(if (<= y 2.8e+84)
(fmax
(* z (- 30.0 (* 25.0 (/ 1.0 z))))
(- (fabs (+ (sin (* 30.0 z)) (* 30.0 x))) 0.2))
(fmax
(-
(sqrt (* (+ 1.0 (/ (fma (* z z) 900.0 (* 900.0 (* y y))) t_0)) t_0))
25.0)
(* (+ 1.0 (/ (fabs (+ t_1 (* 30.0 y))) -0.2)) -0.2))))))
double code(double x, double y, double z) {
double t_0 = (x * x) * 900.0;
double t_1 = sin((30.0 * x));
double tmp;
if (y <= -2.65e+19) {
tmp = fmax((-30.0 * y), (fabs((t_1 + (30.0 * (z * cos((30.0 * x)))))) - 0.2));
} else if (y <= 2.8e+84) {
tmp = fmax((z * (30.0 - (25.0 * (1.0 / z)))), (fabs((sin((30.0 * z)) + (30.0 * x))) - 0.2));
} else {
tmp = fmax((sqrt(((1.0 + (fma((z * z), 900.0, (900.0 * (y * y))) / t_0)) * t_0)) - 25.0), ((1.0 + (fabs((t_1 + (30.0 * y))) / -0.2)) * -0.2));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(x * x) * 900.0) t_1 = sin(Float64(30.0 * x)) tmp = 0.0 if (y <= -2.65e+19) tmp = fmax(Float64(-30.0 * y), Float64(abs(Float64(t_1 + Float64(30.0 * Float64(z * cos(Float64(30.0 * x)))))) - 0.2)); elseif (y <= 2.8e+84) tmp = fmax(Float64(z * Float64(30.0 - Float64(25.0 * Float64(1.0 / z)))), Float64(abs(Float64(sin(Float64(30.0 * z)) + Float64(30.0 * x))) - 0.2)); else tmp = fmax(Float64(sqrt(Float64(Float64(1.0 + Float64(fma(Float64(z * z), 900.0, Float64(900.0 * Float64(y * y))) / t_0)) * t_0)) - 25.0), Float64(Float64(1.0 + Float64(abs(Float64(t_1 + Float64(30.0 * y))) / -0.2)) * -0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * 900.0), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, -2.65e+19], N[Max[N[(-30.0 * y), $MachinePrecision], N[(N[Abs[N[(t$95$1 + N[(30.0 * N[(z * N[Cos[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 2.8e+84], N[Max[N[(z * N[(30.0 - N[(25.0 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[Sqrt[N[(N[(1.0 + N[(N[(N[(z * z), $MachinePrecision] * 900.0 + N[(900.0 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[(1.0 + N[(N[Abs[N[(t$95$1 + N[(30.0 * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / -0.2), $MachinePrecision]), $MachinePrecision] * -0.2), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot 900\\
t_1 := \sin \left(30 \cdot x\right)\\
\mathbf{if}\;y \leq -2.65 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y, \left|t\_1 + 30 \cdot \left(z \cdot \cos \left(30 \cdot x\right)\right)\right| - 0.2\right)\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+84}:\\
\;\;\;\;\mathsf{max}\left(z \cdot \left(30 - 25 \cdot \frac{1}{z}\right), \left|\sin \left(30 \cdot z\right) + 30 \cdot x\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\sqrt{\left(1 + \frac{\mathsf{fma}\left(z \cdot z, 900, 900 \cdot \left(y \cdot y\right)\right)}{t\_0}\right) \cdot t\_0} - 25, \left(1 + \frac{\left|t\_1 + 30 \cdot y\right|}{-0.2}\right) \cdot -0.2\right)\\
\end{array}
\end{array}
if y < -2.65e19Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
Taylor expanded in y around -inf
lower-*.f6437.3
Applied rewrites37.3%
if -2.65e19 < y < 2.79999999999999982e84Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in x around 0
lower-*.f6457.3
Applied rewrites57.3%
Taylor expanded in x around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f6457.5
Applied rewrites57.5%
if 2.79999999999999982e84 < y Initial program 46.6%
Applied rewrites46.6%
Taylor expanded in z around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f6446.0
Applied rewrites46.0%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
sum-to-multN/A
lower-special-*.f64N/A
Applied rewrites44.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- 30.0 (* 25.0 (/ 1.0 z))))))
(if (<= z -3.3e+149)
(fmax t_0 (- (fabs (+ (sin (* 30.0 x)) (* 30.0 z))) 0.2))
(if (<= z -1.6e-207)
(fmax
(- (* (sqrt (fma x x (fma z z (* y y)))) (sqrt 900.0)) 25.0)
(- (fabs (sin (* z 30.0))) 0.2))
(fmax t_0 (- (fabs (+ (sin (* 30.0 z)) (* 30.0 x))) 0.2))))))
double code(double x, double y, double z) {
double t_0 = z * (30.0 - (25.0 * (1.0 / z)));
double tmp;
if (z <= -3.3e+149) {
tmp = fmax(t_0, (fabs((sin((30.0 * x)) + (30.0 * z))) - 0.2));
} else if (z <= -1.6e-207) {
tmp = fmax(((sqrt(fma(x, x, fma(z, z, (y * y)))) * sqrt(900.0)) - 25.0), (fabs(sin((z * 30.0))) - 0.2));
} else {
tmp = fmax(t_0, (fabs((sin((30.0 * z)) + (30.0 * x))) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(z * Float64(30.0 - Float64(25.0 * Float64(1.0 / z)))) tmp = 0.0 if (z <= -3.3e+149) tmp = fmax(t_0, Float64(abs(Float64(sin(Float64(30.0 * x)) + Float64(30.0 * z))) - 0.2)); elseif (z <= -1.6e-207) tmp = fmax(Float64(Float64(sqrt(fma(x, x, fma(z, z, Float64(y * y)))) * sqrt(900.0)) - 25.0), Float64(abs(sin(Float64(z * 30.0))) - 0.2)); else tmp = fmax(t_0, Float64(abs(Float64(sin(Float64(30.0 * z)) + Float64(30.0 * x))) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(30.0 - N[(25.0 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+149], N[Max[t$95$0, N[(N[Abs[N[(N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + N[(30.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, -1.6e-207], N[Max[N[(N[(N[Sqrt[N[(x * x + N[(z * z + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[900.0], $MachinePrecision]), $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[t$95$0, N[(N[Abs[N[(N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(30 - 25 \cdot \frac{1}{z}\right)\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+149}:\\
\;\;\;\;\mathsf{max}\left(t\_0, \left|\sin \left(30 \cdot x\right) + 30 \cdot z\right| - 0.2\right)\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{-207}:\\
\;\;\;\;\mathsf{max}\left(\sqrt{\mathsf{fma}\left(x, x, \mathsf{fma}\left(z, z, y \cdot y\right)\right)} \cdot \sqrt{900} - 25, \left|\sin \left(z \cdot 30\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(t\_0, \left|\sin \left(30 \cdot z\right) + 30 \cdot x\right| - 0.2\right)\\
\end{array}
\end{array}
if z < -3.3e149Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
Taylor expanded in x around 0
Applied rewrites42.5%
if -3.3e149 < z < -1.6000000000000002e-207Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6446.0
Applied rewrites46.0%
Applied rewrites45.9%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lower-special-*.f64N/A
lower-special-sqrt.f64N/A
lower-special-sqrt.f6446.3
Applied rewrites46.3%
if -1.6000000000000002e-207 < z Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in x around 0
lower-*.f6457.3
Applied rewrites57.3%
Taylor expanded in x around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f6457.5
Applied rewrites57.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- 30.0 (* 25.0 (/ 1.0 z))))))
(if (<= z -8.5e+148)
(fmax t_0 (- (fabs (+ (sin (* 30.0 x)) (* 30.0 z))) 0.2))
(if (<= z -1.6e-207)
(fmax
(- (sqrt (* (fma x x (fma z z (* y y))) 900.0)) 25.0)
(- (fabs (sin (* z 30.0))) 0.2))
(fmax t_0 (- (fabs (+ (sin (* 30.0 z)) (* 30.0 x))) 0.2))))))
double code(double x, double y, double z) {
double t_0 = z * (30.0 - (25.0 * (1.0 / z)));
double tmp;
if (z <= -8.5e+148) {
tmp = fmax(t_0, (fabs((sin((30.0 * x)) + (30.0 * z))) - 0.2));
} else if (z <= -1.6e-207) {
tmp = fmax((sqrt((fma(x, x, fma(z, z, (y * y))) * 900.0)) - 25.0), (fabs(sin((z * 30.0))) - 0.2));
} else {
tmp = fmax(t_0, (fabs((sin((30.0 * z)) + (30.0 * x))) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(z * Float64(30.0 - Float64(25.0 * Float64(1.0 / z)))) tmp = 0.0 if (z <= -8.5e+148) tmp = fmax(t_0, Float64(abs(Float64(sin(Float64(30.0 * x)) + Float64(30.0 * z))) - 0.2)); elseif (z <= -1.6e-207) tmp = fmax(Float64(sqrt(Float64(fma(x, x, fma(z, z, Float64(y * y))) * 900.0)) - 25.0), Float64(abs(sin(Float64(z * 30.0))) - 0.2)); else tmp = fmax(t_0, Float64(abs(Float64(sin(Float64(30.0 * z)) + Float64(30.0 * x))) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(30.0 - N[(25.0 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e+148], N[Max[t$95$0, N[(N[Abs[N[(N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + N[(30.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, -1.6e-207], N[Max[N[(N[Sqrt[N[(N[(x * x + N[(z * z + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 900.0), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[t$95$0, N[(N[Abs[N[(N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(30 - 25 \cdot \frac{1}{z}\right)\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{max}\left(t\_0, \left|\sin \left(30 \cdot x\right) + 30 \cdot z\right| - 0.2\right)\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{-207}:\\
\;\;\;\;\mathsf{max}\left(\sqrt{\mathsf{fma}\left(x, x, \mathsf{fma}\left(z, z, y \cdot y\right)\right) \cdot 900} - 25, \left|\sin \left(z \cdot 30\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(t\_0, \left|\sin \left(30 \cdot z\right) + 30 \cdot x\right| - 0.2\right)\\
\end{array}
\end{array}
if z < -8.4999999999999996e148Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
Taylor expanded in x around 0
Applied rewrites42.5%
if -8.4999999999999996e148 < z < -1.6000000000000002e-207Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6446.0
Applied rewrites46.0%
Applied rewrites45.9%
if -1.6000000000000002e-207 < z Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in x around 0
lower-*.f6457.3
Applied rewrites57.3%
Taylor expanded in x around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f6457.5
Applied rewrites57.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- 30.0 (* 25.0 (/ 1.0 z))))))
(if (<= z -9.5e+31)
(fmax t_0 (- (fabs (+ (sin (* 30.0 x)) (* 30.0 z))) 0.2))
(fmax t_0 (- (fabs (+ (sin (* 30.0 z)) (* 30.0 x))) 0.2)))))
double code(double x, double y, double z) {
double t_0 = z * (30.0 - (25.0 * (1.0 / z)));
double tmp;
if (z <= -9.5e+31) {
tmp = fmax(t_0, (fabs((sin((30.0 * x)) + (30.0 * z))) - 0.2));
} else {
tmp = fmax(t_0, (fabs((sin((30.0 * z)) + (30.0 * x))) - 0.2));
}
return tmp;
}
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
real(8) :: t_0
real(8) :: tmp
t_0 = z * (30.0d0 - (25.0d0 * (1.0d0 / z)))
if (z <= (-9.5d+31)) then
tmp = fmax(t_0, (abs((sin((30.0d0 * x)) + (30.0d0 * z))) - 0.2d0))
else
tmp = fmax(t_0, (abs((sin((30.0d0 * z)) + (30.0d0 * x))) - 0.2d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (30.0 - (25.0 * (1.0 / z)));
double tmp;
if (z <= -9.5e+31) {
tmp = fmax(t_0, (Math.abs((Math.sin((30.0 * x)) + (30.0 * z))) - 0.2));
} else {
tmp = fmax(t_0, (Math.abs((Math.sin((30.0 * z)) + (30.0 * x))) - 0.2));
}
return tmp;
}
def code(x, y, z): t_0 = z * (30.0 - (25.0 * (1.0 / z))) tmp = 0 if z <= -9.5e+31: tmp = fmax(t_0, (math.fabs((math.sin((30.0 * x)) + (30.0 * z))) - 0.2)) else: tmp = fmax(t_0, (math.fabs((math.sin((30.0 * z)) + (30.0 * x))) - 0.2)) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(30.0 - Float64(25.0 * Float64(1.0 / z)))) tmp = 0.0 if (z <= -9.5e+31) tmp = fmax(t_0, Float64(abs(Float64(sin(Float64(30.0 * x)) + Float64(30.0 * z))) - 0.2)); else tmp = fmax(t_0, Float64(abs(Float64(sin(Float64(30.0 * z)) + Float64(30.0 * x))) - 0.2)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (30.0 - (25.0 * (1.0 / z))); tmp = 0.0; if (z <= -9.5e+31) tmp = max(t_0, (abs((sin((30.0 * x)) + (30.0 * z))) - 0.2)); else tmp = max(t_0, (abs((sin((30.0 * z)) + (30.0 * x))) - 0.2)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(30.0 - N[(25.0 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.5e+31], N[Max[t$95$0, N[(N[Abs[N[(N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] + N[(30.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[t$95$0, N[(N[Abs[N[(N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(30 - 25 \cdot \frac{1}{z}\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{max}\left(t\_0, \left|\sin \left(30 \cdot x\right) + 30 \cdot z\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(t\_0, \left|\sin \left(30 \cdot z\right) + 30 \cdot x\right| - 0.2\right)\\
\end{array}
\end{array}
if z < -9.5000000000000008e31Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
Taylor expanded in x around 0
Applied rewrites42.5%
if -9.5000000000000008e31 < z Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in x around 0
lower-*.f6457.3
Applied rewrites57.3%
Taylor expanded in x around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f6457.5
Applied rewrites57.5%
(FPCore (x y z) :precision binary64 (fmax (* z (- 30.0 (* 25.0 (/ 1.0 z)))) (- (fabs (+ (sin (* 30.0 z)) (* 30.0 x))) 0.2)))
double code(double x, double y, double z) {
return fmax((z * (30.0 - (25.0 * (1.0 / z)))), (fabs((sin((30.0 * z)) + (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((z * (30.0d0 - (25.0d0 * (1.0d0 / z)))), (abs((sin((30.0d0 * z)) + (30.0d0 * x))) - 0.2d0))
end function
public static double code(double x, double y, double z) {
return fmax((z * (30.0 - (25.0 * (1.0 / z)))), (Math.abs((Math.sin((30.0 * z)) + (30.0 * x))) - 0.2));
}
def code(x, y, z): return fmax((z * (30.0 - (25.0 * (1.0 / z)))), (math.fabs((math.sin((30.0 * z)) + (30.0 * x))) - 0.2))
function code(x, y, z) return fmax(Float64(z * Float64(30.0 - Float64(25.0 * Float64(1.0 / z)))), Float64(abs(Float64(sin(Float64(30.0 * z)) + Float64(30.0 * x))) - 0.2)) end
function tmp = code(x, y, z) tmp = max((z * (30.0 - (25.0 * (1.0 / z)))), (abs((sin((30.0 * z)) + (30.0 * x))) - 0.2)); end
code[x_, y_, z_] := N[Max[N[(z * N[(30.0 - N[(25.0 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(z \cdot \left(30 - 25 \cdot \frac{1}{z}\right), \left|\sin \left(30 \cdot z\right) + 30 \cdot x\right| - 0.2\right)
\end{array}
Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in x around 0
lower-*.f6457.3
Applied rewrites57.3%
Taylor expanded in x around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f6457.5
Applied rewrites57.5%
(FPCore (x y z) :precision binary64 (fmax (* z (- 30.0 (* 25.0 (/ 1.0 z)))) (- (fabs (sin (* 30.0 z))) 0.2)))
double code(double x, double y, double z) {
return fmax((z * (30.0 - (25.0 * (1.0 / z)))), (fabs(sin((30.0 * z))) - 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((z * (30.0d0 - (25.0d0 * (1.0d0 / z)))), (abs(sin((30.0d0 * z))) - 0.2d0))
end function
public static double code(double x, double y, double z) {
return fmax((z * (30.0 - (25.0 * (1.0 / z)))), (Math.abs(Math.sin((30.0 * z))) - 0.2));
}
def code(x, y, z): return fmax((z * (30.0 - (25.0 * (1.0 / z)))), (math.fabs(math.sin((30.0 * z))) - 0.2))
function code(x, y, z) return fmax(Float64(z * Float64(30.0 - Float64(25.0 * Float64(1.0 / z)))), Float64(abs(sin(Float64(30.0 * z))) - 0.2)) end
function tmp = code(x, y, z) tmp = max((z * (30.0 - (25.0 * (1.0 / z)))), (abs(sin((30.0 * z))) - 0.2)); end
code[x_, y_, z_] := N[Max[N[(z * N[(30.0 - N[(25.0 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(z \cdot \left(30 - 25 \cdot \frac{1}{z}\right), \left|\sin \left(30 \cdot z\right)\right| - 0.2\right)
\end{array}
Initial program 46.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
Taylor expanded in x around 0
lower-*.f6457.3
Applied rewrites57.3%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6428.6
Applied rewrites28.6%
herbie shell --seed 2025151
(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)))