
(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 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 (* z 30.0)))
(t_1
(fmax
(- (hypot (* z 30.0) (* 30.0 x)) 25.0)
(- (fabs (fma 30.0 x t_0)) 0.2))))
(if (<= z -8e+93)
t_1
(if (<= z 2.6e+38)
(fmax
(- (hypot (* y 30.0) (* 30.0 x)) 25.0)
(-
(fabs
(+
(+
(* (sin (* x 30.0)) (cos (* y 30.0)))
(* (sin (* y 30.0)) (cos (* z 30.0))))
(* t_0 (cos (* x 30.0)))))
0.2))
t_1))))
double code(double x, double y, double z) {
double t_0 = sin((z * 30.0));
double t_1 = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), (fabs(fma(30.0, x, t_0)) - 0.2));
double tmp;
if (z <= -8e+93) {
tmp = t_1;
} else if (z <= 2.6e+38) {
tmp = fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), (fabs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (t_0 * cos((x * 30.0))))) - 0.2));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = sin(Float64(z * 30.0)) t_1 = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(fma(30.0, x, t_0)) - 0.2)) tmp = 0.0 if (z <= -8e+93) tmp = t_1; elseif (z <= 2.6e+38) tmp = fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 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(t_0 * cos(Float64(x * 30.0))))) - 0.2)); else tmp = t_1; 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[Max[N[(N[Sqrt[N[(z * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(30.0 * x + t$95$0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -8e+93], t$95$1, If[LessEqual[z, 2.6e+38], 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[(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[(t$95$0 * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(z \cdot 30\right)\\
t_1 := \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, \left|\mathsf{fma}\left(30, x, t\_0\right)\right| - 0.2\right)\\
\mathbf{if}\;z \leq -8 \cdot 10^{+93}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(y \cdot 30, 30 \cdot x\right) - 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) + t\_0 \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.00000000000000035e93 or 2.5999999999999999e38 < z Initial program 26.1%
Taylor expanded in y around 0
Applied rewrites83.4%
Taylor expanded in y around 0
Applied rewrites83.4%
Taylor expanded in x around 0
Applied rewrites83.4%
if -8.00000000000000035e93 < z < 2.5999999999999999e38Initial program 59.9%
Taylor expanded in z around 0
Applied rewrites95.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sin (* z 30.0)))
(t_1
(fmax
(- (hypot (* z 30.0) (* 30.0 x)) 25.0)
(- (fabs (fma 30.0 x t_0)) 0.2))))
(if (<= z -8e+93)
t_1
(if (<= z 2.6e+38)
(fmax
(- (hypot (* y 30.0) (* 30.0 x)) 25.0)
(- (fabs (fma t_0 (cos (* 30.0 x)) (sin (* 30.0 x)))) 0.2))
t_1))))
double code(double x, double y, double z) {
double t_0 = sin((z * 30.0));
double t_1 = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), (fabs(fma(30.0, x, t_0)) - 0.2));
double tmp;
if (z <= -8e+93) {
tmp = t_1;
} else if (z <= 2.6e+38) {
tmp = fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), (fabs(fma(t_0, cos((30.0 * x)), sin((30.0 * x)))) - 0.2));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = sin(Float64(z * 30.0)) t_1 = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(fma(30.0, x, t_0)) - 0.2)) tmp = 0.0 if (z <= -8e+93) tmp = t_1; elseif (z <= 2.6e+38) tmp = fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(fma(t_0, cos(Float64(30.0 * x)), sin(Float64(30.0 * x)))) - 0.2)); else tmp = t_1; 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[Max[N[(N[Sqrt[N[(z * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(30.0 * x + t$95$0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -8e+93], t$95$1, If[LessEqual[z, 2.6e+38], 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] + N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(z \cdot 30\right)\\
t_1 := \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, \left|\mathsf{fma}\left(30, x, t\_0\right)\right| - 0.2\right)\\
\mathbf{if}\;z \leq -8 \cdot 10^{+93}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+38}:\\
\;\;\;\;\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), \sin \left(30 \cdot x\right)\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.00000000000000035e93 or 2.5999999999999999e38 < z Initial program 26.1%
Taylor expanded in y around 0
Applied rewrites83.4%
Taylor expanded in y around 0
Applied rewrites83.4%
Taylor expanded in x around 0
Applied rewrites83.4%
if -8.00000000000000035e93 < z < 2.5999999999999999e38Initial program 59.9%
Taylor expanded in y around 0
Applied rewrites64.7%
Taylor expanded in y around 0
Applied rewrites63.5%
Taylor expanded in z around 0
Applied rewrites94.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (fabs (fma 30.0 x (sin (* z 30.0)))) 0.2))
(t_1 (fmax (- (hypot (* z 30.0) (* 30.0 x)) 25.0) t_0)))
(if (<= z -8e+93)
t_1
(if (<= z 2.6e+38)
(fmax (- (hypot (* y 30.0) (* 30.0 x)) 25.0) t_0)
t_1))))
double code(double x, double y, double z) {
double t_0 = fabs(fma(30.0, x, sin((z * 30.0)))) - 0.2;
double t_1 = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), t_0);
double tmp;
if (z <= -8e+93) {
tmp = t_1;
} else if (z <= 2.6e+38) {
tmp = fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), t_0);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(abs(fma(30.0, x, sin(Float64(z * 30.0)))) - 0.2) t_1 = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), t_0) tmp = 0.0 if (z <= -8e+93) tmp = t_1; elseif (z <= 2.6e+38) tmp = fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 25.0), t_0); else tmp = t_1; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[N[(30.0 * x + N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, Block[{t$95$1 = N[Max[N[(N[Sqrt[N[(z * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], t$95$0], $MachinePrecision]}, If[LessEqual[z, -8e+93], t$95$1, If[LessEqual[z, 2.6e+38], N[Max[N[(N[Sqrt[N[(y * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], t$95$0], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\mathsf{fma}\left(30, x, \sin \left(z \cdot 30\right)\right)\right| - 0.2\\
t_1 := \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, t\_0\right)\\
\mathbf{if}\;z \leq -8 \cdot 10^{+93}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(y \cdot 30, 30 \cdot x\right) - 25, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.00000000000000035e93 or 2.5999999999999999e38 < z Initial program 26.1%
Taylor expanded in y around 0
Applied rewrites83.4%
Taylor expanded in y around 0
Applied rewrites83.4%
Taylor expanded in x around 0
Applied rewrites83.4%
if -8.00000000000000035e93 < z < 2.5999999999999999e38Initial program 59.9%
Taylor expanded in y around 0
Applied rewrites64.7%
Taylor expanded in y around 0
Applied rewrites63.5%
Taylor expanded in x around 0
Applied rewrites62.8%
Taylor expanded in z around 0
Applied rewrites94.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(fmax
(- (hypot (* z 30.0) (* 30.0 x)) 25.0)
(- (fabs (* 30.0 x)) 0.2))))
(if (<= z -8e+93)
t_0
(if (<= z 2.6e+38)
(fmax
(- (hypot (* y 30.0) (* 30.0 x)) 25.0)
(- (fabs (fma 30.0 x (sin (* z 30.0)))) 0.2))
t_0))))
double code(double x, double y, double z) {
double t_0 = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), (fabs((30.0 * x)) - 0.2));
double tmp;
if (z <= -8e+93) {
tmp = t_0;
} else if (z <= 2.6e+38) {
tmp = fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), (fabs(fma(30.0, x, sin((z * 30.0)))) - 0.2));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(30.0 * x)) - 0.2)) tmp = 0.0 if (z <= -8e+93) tmp = t_0; elseif (z <= 2.6e+38) tmp = fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(fma(30.0, x, sin(Float64(z * 30.0)))) - 0.2)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = 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[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -8e+93], t$95$0, If[LessEqual[z, 2.6e+38], 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[(30.0 * x + N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, \left|30 \cdot x\right| - 0.2\right)\\
\mathbf{if}\;z \leq -8 \cdot 10^{+93}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(y \cdot 30, 30 \cdot x\right) - 25, \left|\mathsf{fma}\left(30, x, \sin \left(z \cdot 30\right)\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -8.00000000000000035e93 or 2.5999999999999999e38 < z Initial program 26.1%
Taylor expanded in y around 0
Applied rewrites83.4%
Taylor expanded in y around 0
Applied rewrites83.4%
Taylor expanded in x around 0
Applied rewrites83.4%
Taylor expanded in x around inf
Applied rewrites83.4%
if -8.00000000000000035e93 < z < 2.5999999999999999e38Initial program 59.9%
Taylor expanded in y around 0
Applied rewrites64.7%
Taylor expanded in y around 0
Applied rewrites63.5%
Taylor expanded in x around 0
Applied rewrites62.8%
Taylor expanded in z around 0
Applied rewrites94.0%
(FPCore (x y z)
:precision binary64
(if (<= x -4.1e+123)
(fmax (* 30.0 x) (- (fabs (fma y 30.0 (* 30.0 x))) 0.2))
(if (<= x 8.5e+31)
(fmax
(- (hypot (* z 30.0) (* y 30.0)) 25.0)
(- (fabs (sin (* 30.0 x))) 0.2))
(fmax (- (hypot (* z 30.0) (* 30.0 x)) 25.0) (- (fabs (* 30.0 x)) 0.2)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.1e+123) {
tmp = fmax((30.0 * x), (fabs(fma(y, 30.0, (30.0 * x))) - 0.2));
} else if (x <= 8.5e+31) {
tmp = fmax((hypot((z * 30.0), (y * 30.0)) - 25.0), (fabs(sin((30.0 * x))) - 0.2));
} else {
tmp = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), (fabs((30.0 * x)) - 0.2));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -4.1e+123) tmp = fmax(Float64(30.0 * x), Float64(abs(fma(y, 30.0, Float64(30.0 * x))) - 0.2)); elseif (x <= 8.5e+31) tmp = fmax(Float64(hypot(Float64(z * 30.0), Float64(y * 30.0)) - 25.0), Float64(abs(sin(Float64(30.0 * x))) - 0.2)); else tmp = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(30.0 * x)) - 0.2)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -4.1e+123], N[Max[N[(30.0 * x), $MachinePrecision], N[(N[Abs[N[(y * 30.0 + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 8.5e+31], N[Max[N[(N[Sqrt[N[(z * 30.0), $MachinePrecision] ^ 2 + N[(y * 30.0), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $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[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{+123}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot x, \left|\mathsf{fma}\left(y, 30, 30 \cdot x\right)\right| - 0.2\right)\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, \left|30 \cdot x\right| - 0.2\right)\\
\end{array}
\end{array}
if x < -4.09999999999999989e123Initial program 17.7%
Taylor expanded in x around inf
Applied rewrites3.4%
Taylor expanded in z around 0
Applied rewrites3.4%
Taylor expanded in y around 0
Applied rewrites17.9%
Taylor expanded in x around 0
Applied rewrites86.2%
if -4.09999999999999989e123 < x < 8.49999999999999947e31Initial program 60.2%
Taylor expanded in x around 0
Applied rewrites93.2%
Taylor expanded in z around 0
Applied rewrites92.5%
Taylor expanded in y around 0
Applied rewrites92.1%
if 8.49999999999999947e31 < x Initial program 29.6%
Taylor expanded in y around 0
Applied rewrites82.0%
Taylor expanded in y around 0
Applied rewrites82.0%
Taylor expanded in x around 0
Applied rewrites82.0%
Taylor expanded in x around inf
Applied rewrites82.0%
(FPCore (x y z)
:precision binary64
(if (<= x -1.8e+123)
(fmax (* 30.0 x) (- (fabs (fma y 30.0 (* 30.0 x))) 0.2))
(if (<= x 8.5e+31)
(fmax (- (hypot (* z 30.0) (* y 30.0)) 25.0) (- (fabs (* y 30.0)) 0.2))
(fmax (- (hypot (* z 30.0) (* 30.0 x)) 25.0) (- (fabs (* 30.0 x)) 0.2)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.8e+123) {
tmp = fmax((30.0 * x), (fabs(fma(y, 30.0, (30.0 * x))) - 0.2));
} else if (x <= 8.5e+31) {
tmp = fmax((hypot((z * 30.0), (y * 30.0)) - 25.0), (fabs((y * 30.0)) - 0.2));
} else {
tmp = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), (fabs((30.0 * x)) - 0.2));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -1.8e+123) tmp = fmax(Float64(30.0 * x), Float64(abs(fma(y, 30.0, Float64(30.0 * x))) - 0.2)); elseif (x <= 8.5e+31) tmp = fmax(Float64(hypot(Float64(z * 30.0), Float64(y * 30.0)) - 25.0), Float64(abs(Float64(y * 30.0)) - 0.2)); else tmp = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(30.0 * x)) - 0.2)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -1.8e+123], N[Max[N[(30.0 * x), $MachinePrecision], N[(N[Abs[N[(y * 30.0 + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 8.5e+31], N[Max[N[(N[Sqrt[N[(z * 30.0), $MachinePrecision] ^ 2 + N[(y * 30.0), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $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[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+123}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot x, \left|\mathsf{fma}\left(y, 30, 30 \cdot x\right)\right| - 0.2\right)\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|y \cdot 30\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, \left|30 \cdot x\right| - 0.2\right)\\
\end{array}
\end{array}
if x < -1.79999999999999999e123Initial program 17.7%
Taylor expanded in x around inf
Applied rewrites3.4%
Taylor expanded in z around 0
Applied rewrites3.4%
Taylor expanded in y around 0
Applied rewrites17.8%
Taylor expanded in x around 0
Applied rewrites86.1%
if -1.79999999999999999e123 < x < 8.49999999999999947e31Initial program 60.2%
Taylor expanded in x around 0
Applied rewrites93.2%
Taylor expanded in z around 0
Applied rewrites92.5%
Taylor expanded in x around 0
Applied rewrites91.7%
Taylor expanded in y around 0
Applied rewrites91.1%
if 8.49999999999999947e31 < x Initial program 29.6%
Taylor expanded in y around 0
Applied rewrites82.0%
Taylor expanded in y around 0
Applied rewrites82.0%
Taylor expanded in x around 0
Applied rewrites82.0%
Taylor expanded in x around inf
Applied rewrites82.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fmax (* 30.0 x) (- (fabs (fma y 30.0 (* 30.0 x))) 0.2))))
(if (<= y -1.08e+99)
t_0
(if (<= y 1.55e+126)
(fmax (- (hypot (* z 30.0) (* 30.0 x)) 25.0) (- (fabs (* 30.0 x)) 0.2))
t_0))))
double code(double x, double y, double z) {
double t_0 = fmax((30.0 * x), (fabs(fma(y, 30.0, (30.0 * x))) - 0.2));
double tmp;
if (y <= -1.08e+99) {
tmp = t_0;
} else if (y <= 1.55e+126) {
tmp = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), (fabs((30.0 * x)) - 0.2));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fmax(Float64(30.0 * x), Float64(abs(fma(y, 30.0, Float64(30.0 * x))) - 0.2)) tmp = 0.0 if (y <= -1.08e+99) tmp = t_0; elseif (y <= 1.55e+126) tmp = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(30.0 * x)) - 0.2)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[(30.0 * x), $MachinePrecision], N[(N[Abs[N[(y * 30.0 + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, -1.08e+99], t$95$0, If[LessEqual[y, 1.55e+126], 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[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{max}\left(30 \cdot x, \left|\mathsf{fma}\left(y, 30, 30 \cdot x\right)\right| - 0.2\right)\\
\mathbf{if}\;y \leq -1.08 \cdot 10^{+99}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, \left|30 \cdot x\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.08e99 or 1.55e126 < y Initial program 18.8%
Taylor expanded in x around inf
Applied rewrites11.0%
Taylor expanded in z around 0
Applied rewrites11.0%
Taylor expanded in y around 0
Applied rewrites78.2%
Taylor expanded in x around 0
Applied rewrites84.5%
if -1.08e99 < y < 1.55e126Initial program 59.4%
Taylor expanded in y around 0
Applied rewrites90.0%
Taylor expanded in y around 0
Applied rewrites89.2%
Taylor expanded in x around 0
Applied rewrites88.6%
Taylor expanded in x around inf
Applied rewrites88.0%
(FPCore (x y z)
:precision binary64
(if (<= z -1.05e+94)
(fmax (* -30.0 x) (- (fabs (* z 30.0)) 0.2))
(if (<= z 1.45e-205)
(fmax (* 30.0 x) (- (fabs (fma y 30.0 (* 30.0 x))) 0.2))
(fmax (- (* z 30.0) 25.0) (- (fabs (fma 30.0 x (sin (* z 30.0)))) 0.2)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.05e+94) {
tmp = fmax((-30.0 * x), (fabs((z * 30.0)) - 0.2));
} else if (z <= 1.45e-205) {
tmp = fmax((30.0 * x), (fabs(fma(y, 30.0, (30.0 * x))) - 0.2));
} else {
tmp = fmax(((z * 30.0) - 25.0), (fabs(fma(30.0, x, sin((z * 30.0)))) - 0.2));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1.05e+94) tmp = fmax(Float64(-30.0 * x), Float64(abs(Float64(z * 30.0)) - 0.2)); elseif (z <= 1.45e-205) tmp = fmax(Float64(30.0 * x), Float64(abs(fma(y, 30.0, Float64(30.0 * x))) - 0.2)); else tmp = fmax(Float64(Float64(z * 30.0) - 25.0), Float64(abs(fma(30.0, x, sin(Float64(z * 30.0)))) - 0.2)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1.05e+94], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 1.45e-205], N[Max[N[(30.0 * x), $MachinePrecision], N[(N[Abs[N[(y * 30.0 + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[(z * 30.0), $MachinePrecision] - 25.0), $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}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+94}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|z \cdot 30\right| - 0.2\right)\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-205}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot x, \left|\mathsf{fma}\left(y, 30, 30 \cdot x\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(z \cdot 30 - 25, \left|\mathsf{fma}\left(30, x, \sin \left(z \cdot 30\right)\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if z < -1.04999999999999995e94Initial program 21.7%
Taylor expanded in x around -inf
Applied rewrites10.8%
Taylor expanded in y around 0
Applied rewrites10.8%
Taylor expanded in x around 0
Applied rewrites10.7%
Taylor expanded in z around 0
Applied rewrites76.6%
if -1.04999999999999995e94 < z < 1.45000000000000009e-205Initial program 59.8%
Taylor expanded in x around inf
Applied rewrites22.1%
Taylor expanded in z around 0
Applied rewrites21.8%
Taylor expanded in y around 0
Applied rewrites55.7%
Taylor expanded in x around 0
Applied rewrites72.5%
if 1.45000000000000009e-205 < z Initial program 44.0%
Taylor expanded in y around 0
Applied rewrites73.8%
Taylor expanded in y around 0
Applied rewrites73.3%
Taylor expanded in x around 0
Applied rewrites73.0%
Taylor expanded in z around inf
Applied rewrites72.7%
(FPCore (x y z)
:precision binary64
(if (<= z -1.05e+94)
(fmax (* -30.0 x) (- (fabs (* z 30.0)) 0.2))
(if (<= z 2.6e+38)
(fmax (* 30.0 x) (- (fabs (fma y 30.0 (* 30.0 x))) 0.2))
(fmax (* z 30.0) (- (fabs (fma 30.0 x (sin (* z 30.0)))) 0.2)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.05e+94) {
tmp = fmax((-30.0 * x), (fabs((z * 30.0)) - 0.2));
} else if (z <= 2.6e+38) {
tmp = fmax((30.0 * x), (fabs(fma(y, 30.0, (30.0 * x))) - 0.2));
} else {
tmp = fmax((z * 30.0), (fabs(fma(30.0, x, sin((z * 30.0)))) - 0.2));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1.05e+94) tmp = fmax(Float64(-30.0 * x), Float64(abs(Float64(z * 30.0)) - 0.2)); elseif (z <= 2.6e+38) tmp = fmax(Float64(30.0 * x), Float64(abs(fma(y, 30.0, Float64(30.0 * x))) - 0.2)); else tmp = fmax(Float64(z * 30.0), Float64(abs(fma(30.0, x, sin(Float64(z * 30.0)))) - 0.2)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1.05e+94], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 2.6e+38], N[Max[N[(30.0 * x), $MachinePrecision], N[(N[Abs[N[(y * 30.0 + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(z * 30.0), $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}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+94}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|z \cdot 30\right| - 0.2\right)\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot x, \left|\mathsf{fma}\left(y, 30, 30 \cdot x\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(z \cdot 30, \left|\mathsf{fma}\left(30, x, \sin \left(z \cdot 30\right)\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if z < -1.04999999999999995e94Initial program 21.7%
Taylor expanded in x around -inf
Applied rewrites10.8%
Taylor expanded in y around 0
Applied rewrites10.8%
Taylor expanded in x around 0
Applied rewrites10.7%
Taylor expanded in z around 0
Applied rewrites76.6%
if -1.04999999999999995e94 < z < 2.5999999999999999e38Initial program 59.9%
Taylor expanded in x around inf
Applied rewrites22.1%
Taylor expanded in z around 0
Applied rewrites21.8%
Taylor expanded in y around 0
Applied rewrites56.1%
Taylor expanded in x around 0
Applied rewrites73.0%
if 2.5999999999999999e38 < z Initial program 29.8%
Taylor expanded in y around 0
Applied rewrites82.5%
Taylor expanded in y around 0
Applied rewrites82.5%
Taylor expanded in x around 0
Applied rewrites82.5%
Taylor expanded in z around inf
Applied rewrites81.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fmax (* -30.0 x) (- (fabs (* z 30.0)) 0.2))))
(if (<= z -1.05e+94)
t_0
(if (<= z 9.2e+108)
(fmax (* 30.0 x) (- (fabs (fma y 30.0 (* 30.0 x))) 0.2))
t_0))))
double code(double x, double y, double z) {
double t_0 = fmax((-30.0 * x), (fabs((z * 30.0)) - 0.2));
double tmp;
if (z <= -1.05e+94) {
tmp = t_0;
} else if (z <= 9.2e+108) {
tmp = fmax((30.0 * x), (fabs(fma(y, 30.0, (30.0 * x))) - 0.2));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fmax(Float64(-30.0 * x), Float64(abs(Float64(z * 30.0)) - 0.2)) tmp = 0.0 if (z <= -1.05e+94) tmp = t_0; elseif (z <= 9.2e+108) tmp = fmax(Float64(30.0 * x), Float64(abs(fma(y, 30.0, Float64(30.0 * x))) - 0.2)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -1.05e+94], t$95$0, If[LessEqual[z, 9.2e+108], N[Max[N[(30.0 * x), $MachinePrecision], N[(N[Abs[N[(y * 30.0 + N[(30.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{max}\left(-30 \cdot x, \left|z \cdot 30\right| - 0.2\right)\\
\mathbf{if}\;z \leq -1.05 \cdot 10^{+94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+108}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot x, \left|\mathsf{fma}\left(y, 30, 30 \cdot x\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.04999999999999995e94 or 9.1999999999999996e108 < z Initial program 20.5%
Taylor expanded in x around -inf
Applied rewrites11.4%
Taylor expanded in y around 0
Applied rewrites11.4%
Taylor expanded in x around 0
Applied rewrites11.4%
Taylor expanded in z around 0
Applied rewrites78.2%
if -1.04999999999999995e94 < z < 9.1999999999999996e108Initial program 59.8%
Taylor expanded in x around inf
Applied rewrites22.0%
Taylor expanded in z around 0
Applied rewrites21.7%
Taylor expanded in y around 0
Applied rewrites55.3%
Taylor expanded in x around 0
Applied rewrites72.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fmax (* -30.0 x) (- (fabs (* z 30.0)) 0.2))))
(if (<= z -1e+94)
t_0
(if (<= z 3.15e+106) (fmax (* 30.0 x) (- (fabs (* y 30.0)) 0.2)) t_0))))
double code(double x, double y, double z) {
double t_0 = fmax((-30.0 * x), (fabs((z * 30.0)) - 0.2));
double tmp;
if (z <= -1e+94) {
tmp = t_0;
} else if (z <= 3.15e+106) {
tmp = fmax((30.0 * x), (fabs((y * 30.0)) - 0.2));
} else {
tmp = 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 = fmax(((-30.0d0) * x), (abs((z * 30.0d0)) - 0.2d0))
if (z <= (-1d+94)) then
tmp = t_0
else if (z <= 3.15d+106) then
tmp = fmax((30.0d0 * x), (abs((y * 30.0d0)) - 0.2d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = fmax((-30.0 * x), (Math.abs((z * 30.0)) - 0.2));
double tmp;
if (z <= -1e+94) {
tmp = t_0;
} else if (z <= 3.15e+106) {
tmp = fmax((30.0 * x), (Math.abs((y * 30.0)) - 0.2));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = fmax((-30.0 * x), (math.fabs((z * 30.0)) - 0.2)) tmp = 0 if z <= -1e+94: tmp = t_0 elif z <= 3.15e+106: tmp = fmax((30.0 * x), (math.fabs((y * 30.0)) - 0.2)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = fmax(Float64(-30.0 * x), Float64(abs(Float64(z * 30.0)) - 0.2)) tmp = 0.0 if (z <= -1e+94) tmp = t_0; elseif (z <= 3.15e+106) tmp = fmax(Float64(30.0 * x), Float64(abs(Float64(y * 30.0)) - 0.2)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = max((-30.0 * x), (abs((z * 30.0)) - 0.2)); tmp = 0.0; if (z <= -1e+94) tmp = t_0; elseif (z <= 3.15e+106) tmp = max((30.0 * x), (abs((y * 30.0)) - 0.2)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -1e+94], t$95$0, If[LessEqual[z, 3.15e+106], N[Max[N[(30.0 * x), $MachinePrecision], N[(N[Abs[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{max}\left(-30 \cdot x, \left|z \cdot 30\right| - 0.2\right)\\
\mathbf{if}\;z \leq -1 \cdot 10^{+94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.15 \cdot 10^{+106}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot x, \left|y \cdot 30\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1e94 or 3.14999999999999987e106 < z Initial program 20.8%
Taylor expanded in x around -inf
Applied rewrites11.5%
Taylor expanded in y around 0
Applied rewrites11.5%
Taylor expanded in x around 0
Applied rewrites11.5%
Taylor expanded in z around 0
Applied rewrites78.1%
if -1e94 < z < 3.14999999999999987e106Initial program 59.8%
Taylor expanded in x around inf
Applied rewrites22.1%
Taylor expanded in z around 0
Applied rewrites21.7%
Taylor expanded in y around 0
Applied rewrites55.4%
Taylor expanded in x around 0
Applied rewrites54.9%
(FPCore (x y z) :precision binary64 (fmax (* -30.0 x) (- (fabs (* z 30.0)) 0.2)))
double code(double x, double y, double z) {
return fmax((-30.0 * x), (fabs((z * 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(((-30.0d0) * x), (abs((z * 30.0d0)) - 0.2d0))
end function
public static double code(double x, double y, double z) {
return fmax((-30.0 * x), (Math.abs((z * 30.0)) - 0.2));
}
def code(x, y, z): return fmax((-30.0 * x), (math.fabs((z * 30.0)) - 0.2))
function code(x, y, z) return fmax(Float64(-30.0 * x), Float64(abs(Float64(z * 30.0)) - 0.2)) end
function tmp = code(x, y, z) tmp = max((-30.0 * x), (abs((z * 30.0)) - 0.2)); end
code[x_, y_, z_] := N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(-30 \cdot x, \left|z \cdot 30\right| - 0.2\right)
\end{array}
Initial program 46.7%
Taylor expanded in x around -inf
Applied rewrites18.8%
Taylor expanded in y around 0
Applied rewrites18.4%
Taylor expanded in x around 0
Applied rewrites18.0%
Taylor expanded in z around 0
Applied rewrites44.9%
herbie shell --seed 2025101
(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)))