
(FPCore (x y z)
:precision binary64
(fmax
(-
(sqrt
(+ (+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0)) (pow (* z 30.0) 2.0)))
25.0)
(-
(fabs
(+
(+
(* (sin (* x 30.0)) (cos (* y 30.0)))
(* (sin (* y 30.0)) (cos (* z 30.0))))
(* (sin (* z 30.0)) (cos (* x 30.0)))))
0.2)))
double code(double x, double y, double z) {
return fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = fmax((sqrt(((((x * 30.0d0) ** 2.0d0) + ((y * 30.0d0) ** 2.0d0)) + ((z * 30.0d0) ** 2.0d0))) - 25.0d0), (abs((((sin((x * 30.0d0)) * cos((y * 30.0d0))) + (sin((y * 30.0d0)) * cos((z * 30.0d0)))) + (sin((z * 30.0d0)) * cos((x * 30.0d0))))) - 0.2d0))
end function
public static double code(double x, double y, double z) {
return fmax((Math.sqrt(((Math.pow((x * 30.0), 2.0) + Math.pow((y * 30.0), 2.0)) + Math.pow((z * 30.0), 2.0))) - 25.0), (Math.abs((((Math.sin((x * 30.0)) * Math.cos((y * 30.0))) + (Math.sin((y * 30.0)) * Math.cos((z * 30.0)))) + (Math.sin((z * 30.0)) * Math.cos((x * 30.0))))) - 0.2));
}
def code(x, y, z): return fmax((math.sqrt(((math.pow((x * 30.0), 2.0) + math.pow((y * 30.0), 2.0)) + math.pow((z * 30.0), 2.0))) - 25.0), (math.fabs((((math.sin((x * 30.0)) * math.cos((y * 30.0))) + (math.sin((y * 30.0)) * math.cos((z * 30.0)))) + (math.sin((z * 30.0)) * math.cos((x * 30.0))))) - 0.2))
function code(x, y, z) return fmax(Float64(sqrt(Float64(Float64((Float64(x * 30.0) ^ 2.0) + (Float64(y * 30.0) ^ 2.0)) + (Float64(z * 30.0) ^ 2.0))) - 25.0), Float64(abs(Float64(Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(sin(Float64(y * 30.0)) * cos(Float64(z * 30.0)))) + Float64(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))))) - 0.2)) end
function tmp = code(x, y, z) tmp = max((sqrt(((((x * 30.0) ^ 2.0) + ((y * 30.0) ^ 2.0)) + ((z * 30.0) ^ 2.0))) - 25.0), (abs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2)); end
code[x_, y_, z_] := N[Max[N[(N[Sqrt[N[(N[(N[Power[N[(x * 30.0), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(y * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[(z * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right)
\end{array}
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z)
:precision binary64
(fmax
(-
(sqrt
(+ (+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0)) (pow (* z 30.0) 2.0)))
25.0)
(-
(fabs
(+
(+
(* (sin (* x 30.0)) (cos (* y 30.0)))
(* (sin (* y 30.0)) (cos (* z 30.0))))
(* (sin (* z 30.0)) (cos (* x 30.0)))))
0.2)))
double code(double x, double y, double z) {
return fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = fmax((sqrt(((((x * 30.0d0) ** 2.0d0) + ((y * 30.0d0) ** 2.0d0)) + ((z * 30.0d0) ** 2.0d0))) - 25.0d0), (abs((((sin((x * 30.0d0)) * cos((y * 30.0d0))) + (sin((y * 30.0d0)) * cos((z * 30.0d0)))) + (sin((z * 30.0d0)) * cos((x * 30.0d0))))) - 0.2d0))
end function
public static double code(double x, double y, double z) {
return fmax((Math.sqrt(((Math.pow((x * 30.0), 2.0) + Math.pow((y * 30.0), 2.0)) + Math.pow((z * 30.0), 2.0))) - 25.0), (Math.abs((((Math.sin((x * 30.0)) * Math.cos((y * 30.0))) + (Math.sin((y * 30.0)) * Math.cos((z * 30.0)))) + (Math.sin((z * 30.0)) * Math.cos((x * 30.0))))) - 0.2));
}
def code(x, y, z): return fmax((math.sqrt(((math.pow((x * 30.0), 2.0) + math.pow((y * 30.0), 2.0)) + math.pow((z * 30.0), 2.0))) - 25.0), (math.fabs((((math.sin((x * 30.0)) * math.cos((y * 30.0))) + (math.sin((y * 30.0)) * math.cos((z * 30.0)))) + (math.sin((z * 30.0)) * math.cos((x * 30.0))))) - 0.2))
function code(x, y, z) return fmax(Float64(sqrt(Float64(Float64((Float64(x * 30.0) ^ 2.0) + (Float64(y * 30.0) ^ 2.0)) + (Float64(z * 30.0) ^ 2.0))) - 25.0), Float64(abs(Float64(Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(sin(Float64(y * 30.0)) * cos(Float64(z * 30.0)))) + Float64(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))))) - 0.2)) end
function tmp = code(x, y, z) tmp = max((sqrt(((((x * 30.0) ^ 2.0) + ((y * 30.0) ^ 2.0)) + ((z * 30.0) ^ 2.0))) - 25.0), (abs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2)); end
code[x_, y_, z_] := N[Max[N[(N[Sqrt[N[(N[(N[Power[N[(x * 30.0), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(y * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[(z * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right)
\end{array}
(FPCore (x y z) :precision binary64 (fmax (- (hypot (* z 30.0) (* y 30.0)) 25.0) (- (fabs (fma 30.0 x (sin (* z 30.0)))) 0.2)))
double code(double x, double y, double z) {
return fmax((hypot((z * 30.0), (y * 30.0)) - 25.0), (fabs(fma(30.0, x, sin((z * 30.0)))) - 0.2));
}
function code(x, y, z) return fmax(Float64(hypot(Float64(z * 30.0), Float64(y * 30.0)) - 25.0), Float64(abs(fma(30.0, x, sin(Float64(z * 30.0)))) - 0.2)) end
code[x_, y_, z_] := 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[(30.0 * x + N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(30, x, \sin \left(z \cdot 30\right)\right)\right| - 0.2\right)
\end{array}
Initial program 46.7%
Taylor expanded in x 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
lift-*.f6471.7
Applied rewrites71.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-*.f6471.5
Applied rewrites71.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6498.4
Applied rewrites98.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fmax (* -30.0 y) (- (fabs (fma 30.0 x (sin (* z 30.0)))) 0.2)))
(t_1 (- (fabs (sin (* 30.0 x))) 0.2)))
(if (<= z -9e+93)
(fmax (- (* -30.0 z) 25.0) t_1)
(if (<= z -2e-126)
t_0
(if (<= z 6.8e-6)
(fmax (- (sqrt (* (* x x) 900.0)) 25.0) (- (fabs (* y 30.0)) 0.2))
(if (<= z 3.1e+111) t_0 (fmax (- (* z 30.0) 25.0) t_1)))))))
double code(double x, double y, double z) {
double t_0 = fmax((-30.0 * y), (fabs(fma(30.0, x, sin((z * 30.0)))) - 0.2));
double t_1 = fabs(sin((30.0 * x))) - 0.2;
double tmp;
if (z <= -9e+93) {
tmp = fmax(((-30.0 * z) - 25.0), t_1);
} else if (z <= -2e-126) {
tmp = t_0;
} else if (z <= 6.8e-6) {
tmp = fmax((sqrt(((x * x) * 900.0)) - 25.0), (fabs((y * 30.0)) - 0.2));
} else if (z <= 3.1e+111) {
tmp = t_0;
} else {
tmp = fmax(((z * 30.0) - 25.0), t_1);
}
return tmp;
}
function code(x, y, z) t_0 = fmax(Float64(-30.0 * y), Float64(abs(fma(30.0, x, sin(Float64(z * 30.0)))) - 0.2)) t_1 = Float64(abs(sin(Float64(30.0 * x))) - 0.2) tmp = 0.0 if (z <= -9e+93) tmp = fmax(Float64(Float64(-30.0 * z) - 25.0), t_1); elseif (z <= -2e-126) tmp = t_0; elseif (z <= 6.8e-6) tmp = fmax(Float64(sqrt(Float64(Float64(x * x) * 900.0)) - 25.0), Float64(abs(Float64(y * 30.0)) - 0.2)); elseif (z <= 3.1e+111) tmp = t_0; else tmp = fmax(Float64(Float64(z * 30.0) - 25.0), t_1); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[(-30.0 * y), $MachinePrecision], N[(N[Abs[N[(30.0 * x + N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, If[LessEqual[z, -9e+93], N[Max[N[(N[(-30.0 * z), $MachinePrecision] - 25.0), $MachinePrecision], t$95$1], $MachinePrecision], If[LessEqual[z, -2e-126], t$95$0, If[LessEqual[z, 6.8e-6], N[Max[N[(N[Sqrt[N[(N[(x * x), $MachinePrecision] * 900.0), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 3.1e+111], t$95$0, N[Max[N[(N[(z * 30.0), $MachinePrecision] - 25.0), $MachinePrecision], t$95$1], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{max}\left(-30 \cdot y, \left|\mathsf{fma}\left(30, x, \sin \left(z \cdot 30\right)\right)\right| - 0.2\right)\\
t_1 := \left|\sin \left(30 \cdot x\right)\right| - 0.2\\
\mathbf{if}\;z \leq -9 \cdot 10^{+93}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot z - 25, t\_1\right)\\
\mathbf{elif}\;z \leq -2 \cdot 10^{-126}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{max}\left(\sqrt{\left(x \cdot x\right) \cdot 900} - 25, \left|y \cdot 30\right| - 0.2\right)\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+111}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(z \cdot 30 - 25, t\_1\right)\\
\end{array}
\end{array}
if z < -8.99999999999999981e93Initial program 21.7%
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.5
Applied rewrites84.5%
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.5
Applied rewrites84.5%
Taylor expanded in z around 0
lift-sin.f64N/A
lift-*.f6484.5
Applied rewrites84.5%
Taylor expanded in z around -inf
lower-*.f6470.1
Applied rewrites70.1%
if -8.99999999999999981e93 < z < -1.9999999999999999e-126 or 6.80000000000000012e-6 < z < 3.1e111Initial program 58.4%
Taylor expanded in x 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
lift-*.f6465.6
Applied rewrites65.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-*.f6465.4
Applied rewrites65.4%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6498.4
Applied rewrites98.4%
Taylor expanded in y around -inf
Applied rewrites53.8%
if -1.9999999999999999e-126 < z < 6.80000000000000012e-6Initial program 60.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-*.f6460.0
Applied rewrites60.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6443.1
Applied rewrites43.1%
Taylor expanded in z around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6442.9
Applied rewrites42.9%
Taylor expanded in y around 0
*-commutativeN/A
lift-*.f6474.4
Applied rewrites74.4%
if 3.1e111 < z Initial program 18.5%
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-*.f6485.9
Applied rewrites85.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-*.f6485.9
Applied rewrites85.9%
Taylor expanded in z around 0
lift-sin.f64N/A
lift-*.f6485.9
Applied rewrites85.9%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6472.6
Applied rewrites72.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (fabs (fma 30.0 x (sin (* z 30.0)))) 0.2)))
(if (<= y -8.4e+99)
(fmax (* -30.0 y) t_0)
(if (<= y 6.8e+127)
(fmax (- (hypot (* z 30.0) (* 30.0 x)) 25.0) (- (fabs (* 30.0 x)) 0.2))
(fmax (* y 30.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = fabs(fma(30.0, x, sin((z * 30.0)))) - 0.2;
double tmp;
if (y <= -8.4e+99) {
tmp = fmax((-30.0 * y), t_0);
} else if (y <= 6.8e+127) {
tmp = fmax((hypot((z * 30.0), (30.0 * x)) - 25.0), (fabs((30.0 * x)) - 0.2));
} else {
tmp = fmax((y * 30.0), t_0);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(abs(fma(30.0, x, sin(Float64(z * 30.0)))) - 0.2) tmp = 0.0 if (y <= -8.4e+99) tmp = fmax(Float64(-30.0 * y), t_0); elseif (y <= 6.8e+127) tmp = fmax(Float64(hypot(Float64(z * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(30.0 * x)) - 0.2)); else tmp = fmax(Float64(y * 30.0), t_0); 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]}, If[LessEqual[y, -8.4e+99], N[Max[N[(-30.0 * y), $MachinePrecision], t$95$0], $MachinePrecision], If[LessEqual[y, 6.8e+127], 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], N[Max[N[(y * 30.0), $MachinePrecision], t$95$0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\mathsf{fma}\left(30, x, \sin \left(z \cdot 30\right)\right)\right| - 0.2\\
\mathbf{if}\;y \leq -8.4 \cdot 10^{+99}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y, t\_0\right)\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+127}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, 30 \cdot x\right) - 25, \left|30 \cdot x\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(y \cdot 30, t\_0\right)\\
\end{array}
\end{array}
if y < -8.40000000000000041e99Initial program 21.2%
Taylor expanded in x 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
lift-*.f6484.3
Applied rewrites84.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-*.f6484.3
Applied rewrites84.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6498.6
Applied rewrites98.6%
Taylor expanded in y around -inf
Applied rewrites85.9%
if -8.40000000000000041e99 < y < 6.79999999999999955e127Initial program 59.4%
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-*.f6490.0
Applied rewrites90.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-*.f6489.2
Applied rewrites89.2%
Taylor expanded in z around 0
lift-sin.f64N/A
lift-*.f6488.6
Applied rewrites88.6%
Taylor expanded in x around 0
lift-*.f6488.0
Applied rewrites88.0%
if 6.79999999999999955e127 < y Initial program 15.7%
Taylor expanded in x 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
lift-*.f6485.7
Applied rewrites85.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-*.f6485.7
Applied rewrites85.7%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6498.6
Applied rewrites98.6%
Taylor expanded in y around inf
Applied rewrites84.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (fabs (sin (* 30.0 x))) 0.2)))
(if (<= z -5.1e+89)
(fmax (- (* -30.0 z) 25.0) t_0)
(if (<= z 2.75e+110)
(fmax (- (* y 30.0) 25.0) (- (fabs (fma 30.0 x (sin (* z 30.0)))) 0.2))
(fmax (- (* z 30.0) 25.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = fabs(sin((30.0 * x))) - 0.2;
double tmp;
if (z <= -5.1e+89) {
tmp = fmax(((-30.0 * z) - 25.0), t_0);
} else if (z <= 2.75e+110) {
tmp = fmax(((y * 30.0) - 25.0), (fabs(fma(30.0, x, sin((z * 30.0)))) - 0.2));
} else {
tmp = fmax(((z * 30.0) - 25.0), t_0);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(abs(sin(Float64(30.0 * x))) - 0.2) tmp = 0.0 if (z <= -5.1e+89) tmp = fmax(Float64(Float64(-30.0 * z) - 25.0), t_0); elseif (z <= 2.75e+110) tmp = fmax(Float64(Float64(y * 30.0) - 25.0), Float64(abs(fma(30.0, x, sin(Float64(z * 30.0)))) - 0.2)); else tmp = fmax(Float64(Float64(z * 30.0) - 25.0), t_0); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, If[LessEqual[z, -5.1e+89], N[Max[N[(N[(-30.0 * z), $MachinePrecision] - 25.0), $MachinePrecision], t$95$0], $MachinePrecision], If[LessEqual[z, 2.75e+110], N[Max[N[(N[(y * 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], N[Max[N[(N[(z * 30.0), $MachinePrecision] - 25.0), $MachinePrecision], t$95$0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\sin \left(30 \cdot x\right)\right| - 0.2\\
\mathbf{if}\;z \leq -5.1 \cdot 10^{+89}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot z - 25, t\_0\right)\\
\mathbf{elif}\;z \leq 2.75 \cdot 10^{+110}:\\
\;\;\;\;\mathsf{max}\left(y \cdot 30 - 25, \left|\mathsf{fma}\left(30, x, \sin \left(z \cdot 30\right)\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(z \cdot 30 - 25, t\_0\right)\\
\end{array}
\end{array}
if z < -5.10000000000000027e89Initial program 22.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-*.f6484.1
Applied rewrites84.1%
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.1
Applied rewrites84.1%
Taylor expanded in z around 0
lift-sin.f64N/A
lift-*.f6484.1
Applied rewrites84.1%
Taylor expanded in z around -inf
lower-*.f6469.6
Applied rewrites69.6%
if -5.10000000000000027e89 < z < 2.74999999999999998e110Initial program 59.9%
Taylor expanded in x 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
lift-*.f6464.6
Applied rewrites64.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-*.f6464.2
Applied rewrites64.2%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6498.2
Applied rewrites98.2%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6473.8
Applied rewrites73.8%
if 2.74999999999999998e110 < z Initial program 18.7%
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-*.f6485.9
Applied rewrites85.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-*.f6485.9
Applied rewrites85.9%
Taylor expanded in z around 0
lift-sin.f64N/A
lift-*.f6485.9
Applied rewrites85.9%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6472.4
Applied rewrites72.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (fabs (sin (* 30.0 x))) 0.2)))
(if (<= z -6.2e+93)
(fmax (- (* -30.0 z) 25.0) t_0)
(if (<= z 4.5e+55)
(fmax (- (sqrt (* (* x x) 900.0)) 25.0) (- (fabs (* y 30.0)) 0.2))
(fmax (- (* z 30.0) 25.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = fabs(sin((30.0 * x))) - 0.2;
double tmp;
if (z <= -6.2e+93) {
tmp = fmax(((-30.0 * z) - 25.0), t_0);
} else if (z <= 4.5e+55) {
tmp = fmax((sqrt(((x * x) * 900.0)) - 25.0), (fabs((y * 30.0)) - 0.2));
} else {
tmp = fmax(((z * 30.0) - 25.0), t_0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs(sin((30.0d0 * x))) - 0.2d0
if (z <= (-6.2d+93)) then
tmp = fmax((((-30.0d0) * z) - 25.0d0), t_0)
else if (z <= 4.5d+55) then
tmp = fmax((sqrt(((x * x) * 900.0d0)) - 25.0d0), (abs((y * 30.0d0)) - 0.2d0))
else
tmp = fmax(((z * 30.0d0) - 25.0d0), t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs(Math.sin((30.0 * x))) - 0.2;
double tmp;
if (z <= -6.2e+93) {
tmp = fmax(((-30.0 * z) - 25.0), t_0);
} else if (z <= 4.5e+55) {
tmp = fmax((Math.sqrt(((x * x) * 900.0)) - 25.0), (Math.abs((y * 30.0)) - 0.2));
} else {
tmp = fmax(((z * 30.0) - 25.0), t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs(math.sin((30.0 * x))) - 0.2 tmp = 0 if z <= -6.2e+93: tmp = fmax(((-30.0 * z) - 25.0), t_0) elif z <= 4.5e+55: tmp = fmax((math.sqrt(((x * x) * 900.0)) - 25.0), (math.fabs((y * 30.0)) - 0.2)) else: tmp = fmax(((z * 30.0) - 25.0), t_0) return tmp
function code(x, y, z) t_0 = Float64(abs(sin(Float64(30.0 * x))) - 0.2) tmp = 0.0 if (z <= -6.2e+93) tmp = fmax(Float64(Float64(-30.0 * z) - 25.0), t_0); elseif (z <= 4.5e+55) tmp = fmax(Float64(sqrt(Float64(Float64(x * x) * 900.0)) - 25.0), Float64(abs(Float64(y * 30.0)) - 0.2)); else tmp = fmax(Float64(Float64(z * 30.0) - 25.0), t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs(sin((30.0 * x))) - 0.2; tmp = 0.0; if (z <= -6.2e+93) tmp = max(((-30.0 * z) - 25.0), t_0); elseif (z <= 4.5e+55) tmp = max((sqrt(((x * x) * 900.0)) - 25.0), (abs((y * 30.0)) - 0.2)); else tmp = max(((z * 30.0) - 25.0), t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, If[LessEqual[z, -6.2e+93], N[Max[N[(N[(-30.0 * z), $MachinePrecision] - 25.0), $MachinePrecision], t$95$0], $MachinePrecision], If[LessEqual[z, 4.5e+55], N[Max[N[(N[Sqrt[N[(N[(x * x), $MachinePrecision] * 900.0), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[(z * 30.0), $MachinePrecision] - 25.0), $MachinePrecision], t$95$0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\sin \left(30 \cdot x\right)\right| - 0.2\\
\mathbf{if}\;z \leq -6.2 \cdot 10^{+93}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot z - 25, t\_0\right)\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+55}:\\
\;\;\;\;\mathsf{max}\left(\sqrt{\left(x \cdot x\right) \cdot 900} - 25, \left|y \cdot 30\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(z \cdot 30 - 25, t\_0\right)\\
\end{array}
\end{array}
if z < -6.20000000000000038e93Initial program 21.7%
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.4
Applied rewrites84.4%
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.4
Applied rewrites84.4%
Taylor expanded in z around 0
lift-sin.f64N/A
lift-*.f6484.4
Applied rewrites84.4%
Taylor expanded in z around -inf
lower-*.f6470.0
Applied rewrites70.0%
if -6.20000000000000038e93 < z < 4.49999999999999998e55Initial program 59.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-*.f6459.2
Applied rewrites59.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6438.6
Applied rewrites38.6%
Taylor expanded in z around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6437.7
Applied rewrites37.7%
Taylor expanded in y around 0
*-commutativeN/A
lift-*.f6468.3
Applied rewrites68.3%
if 4.49999999999999998e55 < z Initial program 28.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-*.f6483.4
Applied rewrites83.4%
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-*.f6483.4
Applied rewrites83.4%
Taylor expanded in z around 0
lift-sin.f64N/A
lift-*.f6483.4
Applied rewrites83.4%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6466.2
Applied rewrites66.2%
(FPCore (x y z) :precision binary64 (fmax (- (hypot (* z 30.0) (* y 30.0)) 25.0) (- (fabs (* 30.0 x)) 0.2)))
double code(double x, double y, double z) {
return fmax((hypot((z * 30.0), (y * 30.0)) - 25.0), (fabs((30.0 * x)) - 0.2));
}
public static double code(double x, double y, double z) {
return fmax((Math.hypot((z * 30.0), (y * 30.0)) - 25.0), (Math.abs((30.0 * x)) - 0.2));
}
def code(x, y, z): return fmax((math.hypot((z * 30.0), (y * 30.0)) - 25.0), (math.fabs((30.0 * x)) - 0.2))
function code(x, y, z) return fmax(Float64(hypot(Float64(z * 30.0), Float64(y * 30.0)) - 25.0), Float64(abs(Float64(30.0 * x)) - 0.2)) end
function tmp = code(x, y, z) tmp = max((hypot((z * 30.0), (y * 30.0)) - 25.0), (abs((30.0 * x)) - 0.2)); end
code[x_, y_, z_] := 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[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|30 \cdot x\right| - 0.2\right)
\end{array}
Initial program 46.7%
Taylor expanded in x 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
lift-*.f6471.7
Applied rewrites71.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-*.f6471.5
Applied rewrites71.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6498.4
Applied rewrites98.4%
Taylor expanded in x around inf
lift-*.f6498.0
Applied rewrites98.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fmax (* -30.0 x) (- (fabs (* 30.0 x)) 0.2))))
(if (<= x -4.5e+152)
t_0
(if (<= x 2.3e+150)
(fmax (- (sqrt (* (* x x) 900.0)) 25.0) (- (fabs (* y 30.0)) 0.2))
t_0))))
double code(double x, double y, double z) {
double t_0 = fmax((-30.0 * x), (fabs((30.0 * x)) - 0.2));
double tmp;
if (x <= -4.5e+152) {
tmp = t_0;
} else if (x <= 2.3e+150) {
tmp = fmax((sqrt(((x * x) * 900.0)) - 25.0), (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((30.0d0 * x)) - 0.2d0))
if (x <= (-4.5d+152)) then
tmp = t_0
else if (x <= 2.3d+150) then
tmp = fmax((sqrt(((x * x) * 900.0d0)) - 25.0d0), (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((30.0 * x)) - 0.2));
double tmp;
if (x <= -4.5e+152) {
tmp = t_0;
} else if (x <= 2.3e+150) {
tmp = fmax((Math.sqrt(((x * x) * 900.0)) - 25.0), (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((30.0 * x)) - 0.2)) tmp = 0 if x <= -4.5e+152: tmp = t_0 elif x <= 2.3e+150: tmp = fmax((math.sqrt(((x * x) * 900.0)) - 25.0), (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(30.0 * x)) - 0.2)) tmp = 0.0 if (x <= -4.5e+152) tmp = t_0; elseif (x <= 2.3e+150) tmp = fmax(Float64(sqrt(Float64(Float64(x * x) * 900.0)) - 25.0), 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((30.0 * x)) - 0.2)); tmp = 0.0; if (x <= -4.5e+152) tmp = t_0; elseif (x <= 2.3e+150) tmp = max((sqrt(((x * x) * 900.0)) - 25.0), (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[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -4.5e+152], t$95$0, If[LessEqual[x, 2.3e+150], N[Max[N[(N[Sqrt[N[(N[(x * x), $MachinePrecision] * 900.0), $MachinePrecision]], $MachinePrecision] - 25.0), $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|30 \cdot x\right| - 0.2\right)\\
\mathbf{if}\;x \leq -4.5 \cdot 10^{+152}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+150}:\\
\;\;\;\;\mathsf{max}\left(\sqrt{\left(x \cdot x\right) \cdot 900} - 25, \left|y \cdot 30\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4.5000000000000001e152 or 2.30000000000000001e150 < x Initial program 9.1%
Taylor expanded in x around -inf
lower-*.f6440.5
Applied rewrites40.5%
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-*.f6440.5
Applied rewrites40.5%
Taylor expanded in z around 0
lift-sin.f64N/A
lift-*.f6440.5
Applied rewrites40.5%
Taylor expanded in x around 0
lift-*.f6477.0
Applied rewrites77.0%
if -4.5000000000000001e152 < x < 2.30000000000000001e150Initial program 59.9%
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-*.f6459.5
Applied rewrites59.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.9
Applied rewrites32.9%
Taylor expanded in z around 0
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6431.7
Applied rewrites31.7%
Taylor expanded in y around 0
*-commutativeN/A
lift-*.f6464.6
Applied rewrites64.6%
(FPCore (x y z) :precision binary64 (fmax (* -30.0 x) (- (fabs (* 30.0 x)) 0.2)))
double code(double x, double y, double z) {
return fmax((-30.0 * x), (fabs((30.0 * x)) - 0.2));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = fmax(((-30.0d0) * x), (abs((30.0d0 * x)) - 0.2d0))
end function
public static double code(double x, double y, double z) {
return fmax((-30.0 * x), (Math.abs((30.0 * x)) - 0.2));
}
def code(x, y, z): return fmax((-30.0 * x), (math.fabs((30.0 * x)) - 0.2))
function code(x, y, z) return fmax(Float64(-30.0 * x), Float64(abs(Float64(30.0 * x)) - 0.2)) end
function tmp = code(x, y, z) tmp = max((-30.0 * x), (abs((30.0 * x)) - 0.2)); end
code[x_, y_, z_] := N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)
\end{array}
Initial program 46.7%
Taylor expanded in x around -inf
lower-*.f6418.8
Applied rewrites18.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-*.f6418.4
Applied rewrites18.4%
Taylor expanded in z around 0
lift-sin.f64N/A
lift-*.f6417.8
Applied rewrites17.8%
Taylor expanded in x around 0
lift-*.f6431.6
Applied rewrites31.6%
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)))