
(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 13 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 (* y 30.0) (* z 30.0)) 25.0) (- (fabs t_0) 0.2))))
(if (<= z -3.4e+53)
t_1
(if (<= z 9.6e+63)
(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((y * 30.0), (z * 30.0)) - 25.0), (fabs(t_0) - 0.2));
double tmp;
if (z <= -3.4e+53) {
tmp = t_1;
} else if (z <= 9.6e+63) {
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;
}
public static double code(double x, double y, double z) {
double t_0 = Math.sin((z * 30.0));
double t_1 = fmax((Math.hypot((y * 30.0), (z * 30.0)) - 25.0), (Math.abs(t_0) - 0.2));
double tmp;
if (z <= -3.4e+53) {
tmp = t_1;
} else if (z <= 9.6e+63) {
tmp = fmax((Math.hypot((y * 30.0), (30.0 * x)) - 25.0), (Math.abs((((Math.sin((x * 30.0)) * Math.cos((y * 30.0))) + (Math.sin((y * 30.0)) * Math.cos((z * 30.0)))) + (t_0 * Math.cos((x * 30.0))))) - 0.2));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin((z * 30.0)) t_1 = fmax((math.hypot((y * 30.0), (z * 30.0)) - 25.0), (math.fabs(t_0) - 0.2)) tmp = 0 if z <= -3.4e+53: tmp = t_1 elif z <= 9.6e+63: tmp = fmax((math.hypot((y * 30.0), (30.0 * x)) - 25.0), (math.fabs((((math.sin((x * 30.0)) * math.cos((y * 30.0))) + (math.sin((y * 30.0)) * math.cos((z * 30.0)))) + (t_0 * math.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(y * 30.0), Float64(z * 30.0)) - 25.0), Float64(abs(t_0) - 0.2)) tmp = 0.0 if (z <= -3.4e+53) tmp = t_1; elseif (z <= 9.6e+63) 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
function tmp_2 = code(x, y, z) t_0 = sin((z * 30.0)); t_1 = max((hypot((y * 30.0), (z * 30.0)) - 25.0), (abs(t_0) - 0.2)); tmp = 0.0; if (z <= -3.4e+53) tmp = t_1; elseif (z <= 9.6e+63) tmp = max((hypot((y * 30.0), (30.0 * x)) - 25.0), (abs((((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; end tmp_2 = 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[(y * 30.0), $MachinePrecision] ^ 2 + N[(z * 30.0), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[t$95$0], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -3.4e+53], t$95$1, If[LessEqual[z, 9.6e+63], 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(y \cdot 30, z \cdot 30\right) - 25, \left|t\_0\right| - 0.2\right)\\
\mathbf{if}\;z \leq -3.4 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{+63}:\\
\;\;\;\;\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 < -3.39999999999999998e53 or 9.6e63 < z Initial program 28.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.9
Applied rewrites84.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6484.9
Applied rewrites84.9%
Taylor expanded in x around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6484.9
Applied rewrites84.9%
Taylor expanded in x around 0
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
pow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
pow2N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-hypot.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6482.9
Applied rewrites82.9%
if -3.39999999999999998e53 < z < 9.6e63Initial program 59.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.3
Applied rewrites95.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sin (* z 30.0)))
(t_1 (fmax (- (hypot (* y 30.0) (* z 30.0)) 25.0) (- (fabs t_0) 0.2))))
(if (<= z -3.4e+53)
t_1
(if (<= z 9.6e+63)
(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((y * 30.0), (z * 30.0)) - 25.0), (fabs(t_0) - 0.2));
double tmp;
if (z <= -3.4e+53) {
tmp = t_1;
} else if (z <= 9.6e+63) {
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(y * 30.0), Float64(z * 30.0)) - 25.0), Float64(abs(t_0) - 0.2)) tmp = 0.0 if (z <= -3.4e+53) tmp = t_1; elseif (z <= 9.6e+63) 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[(y * 30.0), $MachinePrecision] ^ 2 + N[(z * 30.0), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[t$95$0], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -3.4e+53], t$95$1, If[LessEqual[z, 9.6e+63], 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(y \cdot 30, z \cdot 30\right) - 25, \left|t\_0\right| - 0.2\right)\\
\mathbf{if}\;z \leq -3.4 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{+63}:\\
\;\;\;\;\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 < -3.39999999999999998e53 or 9.6e63 < z Initial program 28.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.9
Applied rewrites84.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6484.9
Applied rewrites84.9%
Taylor expanded in x around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6484.9
Applied rewrites84.9%
Taylor expanded in x around 0
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
pow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
pow2N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-hypot.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6482.9
Applied rewrites82.9%
if -3.39999999999999998e53 < z < 9.6e63Initial program 59.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.8
Applied rewrites62.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6461.5
Applied rewrites61.5%
Taylor expanded in z around 0
lower--.f64N/A
metadata-evalN/A
pow2N/A
swap-sqrN/A
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
pow2N/A
lift-hypot.f64N/A
lift-*.f64N/A
lift-*.f6494.7
Applied rewrites94.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (fabs (sin (* z 30.0))) 0.2))
(t_1 (fmax (- (hypot (* y 30.0) (* z 30.0)) 25.0) t_0)))
(if (<= z -3.4e+53)
t_1
(if (<= z 9.6e+63)
(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(sin((z * 30.0))) - 0.2;
double t_1 = fmax((hypot((y * 30.0), (z * 30.0)) - 25.0), t_0);
double tmp;
if (z <= -3.4e+53) {
tmp = t_1;
} else if (z <= 9.6e+63) {
tmp = fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), t_0);
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = Math.abs(Math.sin((z * 30.0))) - 0.2;
double t_1 = fmax((Math.hypot((y * 30.0), (z * 30.0)) - 25.0), t_0);
double tmp;
if (z <= -3.4e+53) {
tmp = t_1;
} else if (z <= 9.6e+63) {
tmp = fmax((Math.hypot((y * 30.0), (30.0 * x)) - 25.0), t_0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs(math.sin((z * 30.0))) - 0.2 t_1 = fmax((math.hypot((y * 30.0), (z * 30.0)) - 25.0), t_0) tmp = 0 if z <= -3.4e+53: tmp = t_1 elif z <= 9.6e+63: tmp = fmax((math.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(sin(Float64(z * 30.0))) - 0.2) t_1 = fmax(Float64(hypot(Float64(y * 30.0), Float64(z * 30.0)) - 25.0), t_0) tmp = 0.0 if (z <= -3.4e+53) tmp = t_1; elseif (z <= 9.6e+63) tmp = fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 25.0), t_0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs(sin((z * 30.0))) - 0.2; t_1 = max((hypot((y * 30.0), (z * 30.0)) - 25.0), t_0); tmp = 0.0; if (z <= -3.4e+53) tmp = t_1; elseif (z <= 9.6e+63) tmp = max((hypot((y * 30.0), (30.0 * x)) - 25.0), t_0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, Block[{t$95$1 = N[Max[N[(N[Sqrt[N[(y * 30.0), $MachinePrecision] ^ 2 + N[(z * 30.0), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], t$95$0], $MachinePrecision]}, If[LessEqual[z, -3.4e+53], t$95$1, If[LessEqual[z, 9.6e+63], 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|\sin \left(z \cdot 30\right)\right| - 0.2\\
t_1 := \mathsf{max}\left(\mathsf{hypot}\left(y \cdot 30, z \cdot 30\right) - 25, t\_0\right)\\
\mathbf{if}\;z \leq -3.4 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{+63}:\\
\;\;\;\;\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 < -3.39999999999999998e53 or 9.6e63 < z Initial program 28.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.9
Applied rewrites84.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6484.9
Applied rewrites84.9%
Taylor expanded in x around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6484.9
Applied rewrites84.9%
Taylor expanded in x around 0
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
pow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
pow2N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-hypot.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6482.9
Applied rewrites82.9%
if -3.39999999999999998e53 < z < 9.6e63Initial program 59.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.8
Applied rewrites62.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6461.5
Applied rewrites61.5%
Taylor expanded in x around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6461.0
Applied rewrites61.0%
Taylor expanded in z around 0
metadata-evalN/A
unpow2N/A
swap-sqrN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
pow2N/A
+-commutativeN/A
lift-hypot.f64N/A
lift-*.f64N/A
lift-*.f6494.2
Applied rewrites94.2%
(FPCore (x y z)
:precision binary64
(if (<= y -3.5e+107)
(fmax
(- (hypot (* y 30.0) (* 30.0 x)) 25.0)
(- (fabs (sin (* z 30.0))) 0.2))
(if (<= y 6.5e+138)
(fmax (- (hypot (* z 30.0) (* 30.0 x)) 25.0) (- (fabs (* z 30.0)) 0.2))
(fmax (* y 30.0) (- (fabs (fma z 30.0 (sin (* y 30.0)))) 0.2)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.5e+107) {
tmp = fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), (fabs(sin((z * 30.0))) - 0.2));
} else if (y <= 6.5e+138) {
tmp = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), (fabs((z * 30.0)) - 0.2));
} else {
tmp = fmax((y * 30.0), (fabs(fma(z, 30.0, sin((y * 30.0)))) - 0.2));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -3.5e+107) tmp = fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(sin(Float64(z * 30.0))) - 0.2)); elseif (y <= 6.5e+138) tmp = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(z * 30.0)) - 0.2)); else tmp = fmax(Float64(y * 30.0), Float64(abs(fma(z, 30.0, sin(Float64(y * 30.0)))) - 0.2)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -3.5e+107], 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[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 6.5e+138], 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[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(z * 30.0 + N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+107}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(y \cdot 30, 30 \cdot x\right) - 25, \left|\sin \left(z \cdot 30\right)\right| - 0.2\right)\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, \left|z \cdot 30\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(z, 30, \sin \left(y \cdot 30\right)\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if y < -3.4999999999999997e107Initial program 20.3%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6431.3
Applied rewrites31.3%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6430.5
Applied rewrites30.5%
Taylor expanded in x around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6430.5
Applied rewrites30.5%
Taylor expanded in z around 0
metadata-evalN/A
unpow2N/A
swap-sqrN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
pow2N/A
+-commutativeN/A
lift-hypot.f64N/A
lift-*.f64N/A
lift-*.f6485.8
Applied rewrites85.8%
if -3.4999999999999997e107 < y < 6.50000000000000054e138Initial program 59.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6489.9
Applied rewrites89.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6489.1
Applied rewrites89.1%
Taylor expanded in x around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6488.6
Applied rewrites88.6%
Taylor expanded in z around 0
*-commutativeN/A
lift-*.f6488.0
Applied rewrites88.0%
if 6.50000000000000054e138 < y Initial program 13.8%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6476.7
Applied rewrites76.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites83.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6486.8
Applied rewrites86.8%
(FPCore (x y z)
:precision binary64
(if (<= y -5.8e+107)
(fmax (* -30.0 y) (- (fabs (sin (* z 30.0))) 0.2))
(if (<= y 6.5e+138)
(fmax (- (hypot (* z 30.0) (* 30.0 x)) 25.0) (- (fabs (* z 30.0)) 0.2))
(fmax (* y 30.0) (- (fabs (fma z 30.0 (sin (* y 30.0)))) 0.2)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+107) {
tmp = fmax((-30.0 * y), (fabs(sin((z * 30.0))) - 0.2));
} else if (y <= 6.5e+138) {
tmp = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), (fabs((z * 30.0)) - 0.2));
} else {
tmp = fmax((y * 30.0), (fabs(fma(z, 30.0, sin((y * 30.0)))) - 0.2));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -5.8e+107) tmp = fmax(Float64(-30.0 * y), Float64(abs(sin(Float64(z * 30.0))) - 0.2)); elseif (y <= 6.5e+138) tmp = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(z * 30.0)) - 0.2)); else tmp = fmax(Float64(y * 30.0), Float64(abs(fma(z, 30.0, sin(Float64(y * 30.0)))) - 0.2)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -5.8e+107], N[Max[N[(-30.0 * y), $MachinePrecision], N[(N[Abs[N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 6.5e+138], 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[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(z * 30.0 + N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+107}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y, \left|\sin \left(z \cdot 30\right)\right| - 0.2\right)\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, \left|z \cdot 30\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(z, 30, \sin \left(y \cdot 30\right)\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if y < -5.79999999999999975e107Initial program 20.3%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6431.3
Applied rewrites31.3%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6430.6
Applied rewrites30.6%
Taylor expanded in x around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6430.6
Applied rewrites30.6%
Taylor expanded in y around -inf
lower-*.f6473.1
Applied rewrites73.1%
if -5.79999999999999975e107 < y < 6.50000000000000054e138Initial program 59.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6489.9
Applied rewrites89.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6489.0
Applied rewrites89.0%
Taylor expanded in x around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6488.6
Applied rewrites88.6%
Taylor expanded in z around 0
*-commutativeN/A
lift-*.f6488.0
Applied rewrites88.0%
if 6.50000000000000054e138 < y Initial program 13.8%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6476.7
Applied rewrites76.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites83.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6486.8
Applied rewrites86.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fmax (* y 30.0) (- (fabs (fma z 30.0 (sin (* y 30.0)))) 0.2))))
(if (<= z -1.55e+31)
t_0
(if (<= z 3.8e+63)
(fmax (- (* 30.0 x) 25.0) (- (fabs (sin (* z 30.0))) 0.2))
t_0))))
double code(double x, double y, double z) {
double t_0 = fmax((y * 30.0), (fabs(fma(z, 30.0, sin((y * 30.0)))) - 0.2));
double tmp;
if (z <= -1.55e+31) {
tmp = t_0;
} else if (z <= 3.8e+63) {
tmp = fmax(((30.0 * x) - 25.0), (fabs(sin((z * 30.0))) - 0.2));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fmax(Float64(y * 30.0), Float64(abs(fma(z, 30.0, sin(Float64(y * 30.0)))) - 0.2)) tmp = 0.0 if (z <= -1.55e+31) tmp = t_0; elseif (z <= 3.8e+63) tmp = fmax(Float64(Float64(30.0 * x) - 25.0), Float64(abs(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[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(z * 30.0 + N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -1.55e+31], t$95$0, If[LessEqual[z, 3.8e+63], N[Max[N[(N[(30.0 * x), $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(z, 30, \sin \left(y \cdot 30\right)\right)\right| - 0.2\right)\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{+31}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+63}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot x - 25, \left|\sin \left(z \cdot 30\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.5500000000000001e31 or 3.8000000000000001e63 < z Initial program 30.0%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6412.1
Applied rewrites12.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites54.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6474.3
Applied rewrites74.3%
if -1.5500000000000001e31 < z < 3.8000000000000001e63Initial program 59.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.6
Applied rewrites62.6%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6461.2
Applied rewrites61.2%
Taylor expanded in x around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6460.7
Applied rewrites60.7%
Taylor expanded in x around inf
lift-*.f6439.1
Applied rewrites39.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fmax (* y 30.0) (- (fabs (* z 30.0)) 0.2))))
(if (<= z -1.55e+31)
t_0
(if (<= z 3.8e+63)
(fmax (- (* 30.0 x) 25.0) (- (fabs (sin (* z 30.0))) 0.2))
t_0))))
double code(double x, double y, double z) {
double t_0 = fmax((y * 30.0), (fabs((z * 30.0)) - 0.2));
double tmp;
if (z <= -1.55e+31) {
tmp = t_0;
} else if (z <= 3.8e+63) {
tmp = fmax(((30.0 * x) - 25.0), (fabs(sin((z * 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((y * 30.0d0), (abs((z * 30.0d0)) - 0.2d0))
if (z <= (-1.55d+31)) then
tmp = t_0
else if (z <= 3.8d+63) then
tmp = fmax(((30.0d0 * x) - 25.0d0), (abs(sin((z * 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((y * 30.0), (Math.abs((z * 30.0)) - 0.2));
double tmp;
if (z <= -1.55e+31) {
tmp = t_0;
} else if (z <= 3.8e+63) {
tmp = fmax(((30.0 * x) - 25.0), (Math.abs(Math.sin((z * 30.0))) - 0.2));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = fmax((y * 30.0), (math.fabs((z * 30.0)) - 0.2)) tmp = 0 if z <= -1.55e+31: tmp = t_0 elif z <= 3.8e+63: tmp = fmax(((30.0 * x) - 25.0), (math.fabs(math.sin((z * 30.0))) - 0.2)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = fmax(Float64(y * 30.0), Float64(abs(Float64(z * 30.0)) - 0.2)) tmp = 0.0 if (z <= -1.55e+31) tmp = t_0; elseif (z <= 3.8e+63) tmp = fmax(Float64(Float64(30.0 * x) - 25.0), Float64(abs(sin(Float64(z * 30.0))) - 0.2)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = max((y * 30.0), (abs((z * 30.0)) - 0.2)); tmp = 0.0; if (z <= -1.55e+31) tmp = t_0; elseif (z <= 3.8e+63) tmp = max(((30.0 * x) - 25.0), (abs(sin((z * 30.0))) - 0.2)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -1.55e+31], t$95$0, If[LessEqual[z, 3.8e+63], N[Max[N[(N[(30.0 * x), $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{max}\left(y \cdot 30, \left|z \cdot 30\right| - 0.2\right)\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{+31}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+63}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot x - 25, \left|\sin \left(z \cdot 30\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.5500000000000001e31 or 3.8000000000000001e63 < z Initial program 30.0%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6412.1
Applied rewrites12.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites54.9%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6454.9
Applied rewrites54.9%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6474.3
Applied rewrites74.3%
if -1.5500000000000001e31 < z < 3.8000000000000001e63Initial program 59.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.6
Applied rewrites62.6%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6461.2
Applied rewrites61.2%
Taylor expanded in x around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6460.7
Applied rewrites60.7%
Taylor expanded in x around inf
lift-*.f6439.1
Applied rewrites39.1%
(FPCore (x y z)
:precision binary64
(if (<= x -1.7e+120)
(fmax (* -30.0 x) (- (fabs (sin (* y 30.0))) 0.2))
(if (<= x 1.2e+80)
(fmax (* y 30.0) (- (fabs (* z 30.0)) 0.2))
(fmax (* 30.0 x) (- (fabs (sin (* z 30.0))) 0.2)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.7e+120) {
tmp = fmax((-30.0 * x), (fabs(sin((y * 30.0))) - 0.2));
} else if (x <= 1.2e+80) {
tmp = fmax((y * 30.0), (fabs((z * 30.0)) - 0.2));
} else {
tmp = fmax((30.0 * x), (fabs(sin((z * 30.0))) - 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) :: tmp
if (x <= (-1.7d+120)) then
tmp = fmax(((-30.0d0) * x), (abs(sin((y * 30.0d0))) - 0.2d0))
else if (x <= 1.2d+80) then
tmp = fmax((y * 30.0d0), (abs((z * 30.0d0)) - 0.2d0))
else
tmp = fmax((30.0d0 * x), (abs(sin((z * 30.0d0))) - 0.2d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.7e+120) {
tmp = fmax((-30.0 * x), (Math.abs(Math.sin((y * 30.0))) - 0.2));
} else if (x <= 1.2e+80) {
tmp = fmax((y * 30.0), (Math.abs((z * 30.0)) - 0.2));
} else {
tmp = fmax((30.0 * x), (Math.abs(Math.sin((z * 30.0))) - 0.2));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.7e+120: tmp = fmax((-30.0 * x), (math.fabs(math.sin((y * 30.0))) - 0.2)) elif x <= 1.2e+80: tmp = fmax((y * 30.0), (math.fabs((z * 30.0)) - 0.2)) else: tmp = fmax((30.0 * x), (math.fabs(math.sin((z * 30.0))) - 0.2)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.7e+120) tmp = fmax(Float64(-30.0 * x), Float64(abs(sin(Float64(y * 30.0))) - 0.2)); elseif (x <= 1.2e+80) tmp = fmax(Float64(y * 30.0), Float64(abs(Float64(z * 30.0)) - 0.2)); else tmp = fmax(Float64(30.0 * x), Float64(abs(sin(Float64(z * 30.0))) - 0.2)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.7e+120) tmp = max((-30.0 * x), (abs(sin((y * 30.0))) - 0.2)); elseif (x <= 1.2e+80) tmp = max((y * 30.0), (abs((z * 30.0)) - 0.2)); else tmp = max((30.0 * x), (abs(sin((z * 30.0))) - 0.2)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.7e+120], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.2e+80], N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(30.0 * x), $MachinePrecision], N[(N[Abs[N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+120}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\sin \left(y \cdot 30\right)\right| - 0.2\right)\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+80}:\\
\;\;\;\;\mathsf{max}\left(y \cdot 30, \left|z \cdot 30\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot x, \left|\sin \left(z \cdot 30\right)\right| - 0.2\right)\\
\end{array}
\end{array}
if x < -1.69999999999999999e120Initial program 16.9%
Taylor expanded in x around -inf
lower-*.f6472.8
Applied rewrites72.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in z around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
if -1.69999999999999999e120 < x < 1.1999999999999999e80Initial program 59.3%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6421.9
Applied rewrites21.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites49.9%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6449.0
Applied rewrites49.0%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6455.9
Applied rewrites55.9%
if 1.1999999999999999e80 < x Initial program 24.6%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.0
Applied rewrites84.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6484.0
Applied rewrites84.0%
Taylor expanded in x around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6484.0
Applied rewrites84.0%
Taylor expanded in x around inf
lift-*.f6467.6
Applied rewrites67.6%
(FPCore (x y z) :precision binary64 (if (<= y -4e+97) (fmax (* -30.0 y) (- (fabs (sin (* z 30.0))) 0.2)) (fmax (* y 30.0) (- (fabs (* z 30.0)) 0.2))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4e+97) {
tmp = fmax((-30.0 * y), (fabs(sin((z * 30.0))) - 0.2));
} else {
tmp = fmax((y * 30.0), (fabs((z * 30.0)) - 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) :: tmp
if (y <= (-4d+97)) then
tmp = fmax(((-30.0d0) * y), (abs(sin((z * 30.0d0))) - 0.2d0))
else
tmp = fmax((y * 30.0d0), (abs((z * 30.0d0)) - 0.2d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4e+97) {
tmp = fmax((-30.0 * y), (Math.abs(Math.sin((z * 30.0))) - 0.2));
} else {
tmp = fmax((y * 30.0), (Math.abs((z * 30.0)) - 0.2));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4e+97: tmp = fmax((-30.0 * y), (math.fabs(math.sin((z * 30.0))) - 0.2)) else: tmp = fmax((y * 30.0), (math.fabs((z * 30.0)) - 0.2)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4e+97) tmp = fmax(Float64(-30.0 * y), Float64(abs(sin(Float64(z * 30.0))) - 0.2)); else tmp = fmax(Float64(y * 30.0), Float64(abs(Float64(z * 30.0)) - 0.2)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4e+97) tmp = max((-30.0 * y), (abs(sin((z * 30.0))) - 0.2)); else tmp = max((y * 30.0), (abs((z * 30.0)) - 0.2)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4e+97], N[Max[N[(-30.0 * y), $MachinePrecision], N[(N[Abs[N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+97}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y, \left|\sin \left(z \cdot 30\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(y \cdot 30, \left|z \cdot 30\right| - 0.2\right)\\
\end{array}
\end{array}
if y < -4.0000000000000003e97Initial program 22.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
*-commutativeN/A
metadata-evalN/A
unpow-prod-downN/A
unpow2N/A
lower-hypot.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6432.7
Applied rewrites32.7%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
lower-cos.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lift-*.f6431.9
Applied rewrites31.9%
Taylor expanded in x around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6431.9
Applied rewrites31.9%
Taylor expanded in y around -inf
lower-*.f6471.8
Applied rewrites71.8%
if -4.0000000000000003e97 < y Initial program 51.5%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6421.4
Applied rewrites21.4%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites43.3%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6442.6
Applied rewrites42.6%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6451.7
Applied rewrites51.7%
(FPCore (x y z) :precision binary64 (if (<= x -1.7e+120) (fmax (* -30.0 x) (- (fabs (sin (* y 30.0))) 0.2)) (fmax (* y 30.0) (- (fabs (* z 30.0)) 0.2))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.7e+120) {
tmp = fmax((-30.0 * x), (fabs(sin((y * 30.0))) - 0.2));
} else {
tmp = fmax((y * 30.0), (fabs((z * 30.0)) - 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) :: tmp
if (x <= (-1.7d+120)) then
tmp = fmax(((-30.0d0) * x), (abs(sin((y * 30.0d0))) - 0.2d0))
else
tmp = fmax((y * 30.0d0), (abs((z * 30.0d0)) - 0.2d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.7e+120) {
tmp = fmax((-30.0 * x), (Math.abs(Math.sin((y * 30.0))) - 0.2));
} else {
tmp = fmax((y * 30.0), (Math.abs((z * 30.0)) - 0.2));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.7e+120: tmp = fmax((-30.0 * x), (math.fabs(math.sin((y * 30.0))) - 0.2)) else: tmp = fmax((y * 30.0), (math.fabs((z * 30.0)) - 0.2)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.7e+120) tmp = fmax(Float64(-30.0 * x), Float64(abs(sin(Float64(y * 30.0))) - 0.2)); else tmp = fmax(Float64(y * 30.0), Float64(abs(Float64(z * 30.0)) - 0.2)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.7e+120) tmp = max((-30.0 * x), (abs(sin((y * 30.0))) - 0.2)); else tmp = max((y * 30.0), (abs((z * 30.0)) - 0.2)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.7e+120], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+120}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\sin \left(y \cdot 30\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(y \cdot 30, \left|z \cdot 30\right| - 0.2\right)\\
\end{array}
\end{array}
if x < -1.69999999999999999e120Initial program 16.9%
Taylor expanded in x around -inf
lower-*.f6472.8
Applied rewrites72.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in z around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
if -1.69999999999999999e120 < x Initial program 51.7%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6419.7
Applied rewrites19.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites42.4%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6441.6
Applied rewrites41.6%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6449.7
Applied rewrites49.7%
(FPCore (x y z)
:precision binary64
(if (<= x -1.7e+120)
(fmax
(* -30.0 x)
(- (fabs (* (fma (- (* 202500.0 (* y y)) 4500.0) (* y y) 30.0) y)) 0.2))
(fmax (* y 30.0) (- (fabs (* z 30.0)) 0.2))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.7e+120) {
tmp = fmax((-30.0 * x), (fabs((fma(((202500.0 * (y * y)) - 4500.0), (y * y), 30.0) * y)) - 0.2));
} else {
tmp = fmax((y * 30.0), (fabs((z * 30.0)) - 0.2));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -1.7e+120) tmp = fmax(Float64(-30.0 * x), Float64(abs(Float64(fma(Float64(Float64(202500.0 * Float64(y * y)) - 4500.0), Float64(y * y), 30.0) * y)) - 0.2)); else tmp = fmax(Float64(y * 30.0), Float64(abs(Float64(z * 30.0)) - 0.2)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -1.7e+120], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(N[(N[(N[(202500.0 * N[(y * y), $MachinePrecision]), $MachinePrecision] - 4500.0), $MachinePrecision] * N[(y * y), $MachinePrecision] + 30.0), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+120}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(202500 \cdot \left(y \cdot y\right) - 4500, y \cdot y, 30\right) \cdot y\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(y \cdot 30, \left|z \cdot 30\right| - 0.2\right)\\
\end{array}
\end{array}
if x < -1.69999999999999999e120Initial program 16.9%
Taylor expanded in x around -inf
lower-*.f6472.8
Applied rewrites72.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in z around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6450.4
Applied rewrites50.4%
if -1.69999999999999999e120 < x Initial program 51.7%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6419.7
Applied rewrites19.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites42.4%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6441.6
Applied rewrites41.6%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6449.7
Applied rewrites49.7%
(FPCore (x y z) :precision binary64 (if (<= x -1.7e+120) (fmax (* -30.0 x) (- (fabs (* (fma -4500.0 (* y y) 30.0) y)) 0.2)) (fmax (* y 30.0) (- (fabs (* z 30.0)) 0.2))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.7e+120) {
tmp = fmax((-30.0 * x), (fabs((fma(-4500.0, (y * y), 30.0) * y)) - 0.2));
} else {
tmp = fmax((y * 30.0), (fabs((z * 30.0)) - 0.2));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -1.7e+120) tmp = fmax(Float64(-30.0 * x), Float64(abs(Float64(fma(-4500.0, Float64(y * y), 30.0) * y)) - 0.2)); else tmp = fmax(Float64(y * 30.0), Float64(abs(Float64(z * 30.0)) - 0.2)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -1.7e+120], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(N[(-4500.0 * N[(y * y), $MachinePrecision] + 30.0), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+120}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(-4500, y \cdot y, 30\right) \cdot y\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(y \cdot 30, \left|z \cdot 30\right| - 0.2\right)\\
\end{array}
\end{array}
if x < -1.69999999999999999e120Initial program 16.9%
Taylor expanded in x around -inf
lower-*.f6472.8
Applied rewrites72.8%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in z around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6454.5
Applied rewrites54.5%
if -1.69999999999999999e120 < x Initial program 51.7%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6419.7
Applied rewrites19.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites42.4%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6441.6
Applied rewrites41.6%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6449.7
Applied rewrites49.7%
(FPCore (x y z) :precision binary64 (fmax (* y 30.0) (- (fabs (* z 30.0)) 0.2)))
double code(double x, double y, double z) {
return fmax((y * 30.0), (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((y * 30.0d0), (abs((z * 30.0d0)) - 0.2d0))
end function
public static double code(double x, double y, double z) {
return fmax((y * 30.0), (Math.abs((z * 30.0)) - 0.2));
}
def code(x, y, z): return fmax((y * 30.0), (math.fabs((z * 30.0)) - 0.2))
function code(x, y, z) return fmax(Float64(y * 30.0), Float64(abs(Float64(z * 30.0)) - 0.2)) end
function tmp = code(x, y, z) tmp = max((y * 30.0), (abs((z * 30.0)) - 0.2)); end
code[x_, y_, z_] := N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(y \cdot 30, \left|z \cdot 30\right| - 0.2\right)
\end{array}
Initial program 46.6%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6418.3
Applied rewrites18.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites38.2%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6437.4
Applied rewrites37.4%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6445.8
Applied rewrites45.8%
herbie shell --seed 2025089
(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)))