
(FPCore (x y z)
:precision binary64
(fmax
(-
(sqrt
(+ (+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0)) (pow (* z 30.0) 2.0)))
25.0)
(-
(fabs
(+
(+
(* (sin (* x 30.0)) (cos (* y 30.0)))
(* (sin (* y 30.0)) (cos (* z 30.0))))
(* (sin (* z 30.0)) (cos (* x 30.0)))))
0.2)))
double code(double x, double y, double z) {
return fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = fmax((sqrt(((((x * 30.0d0) ** 2.0d0) + ((y * 30.0d0) ** 2.0d0)) + ((z * 30.0d0) ** 2.0d0))) - 25.0d0), (abs((((sin((x * 30.0d0)) * cos((y * 30.0d0))) + (sin((y * 30.0d0)) * cos((z * 30.0d0)))) + (sin((z * 30.0d0)) * cos((x * 30.0d0))))) - 0.2d0))
end function
public static double code(double x, double y, double z) {
return fmax((Math.sqrt(((Math.pow((x * 30.0), 2.0) + Math.pow((y * 30.0), 2.0)) + Math.pow((z * 30.0), 2.0))) - 25.0), (Math.abs((((Math.sin((x * 30.0)) * Math.cos((y * 30.0))) + (Math.sin((y * 30.0)) * Math.cos((z * 30.0)))) + (Math.sin((z * 30.0)) * Math.cos((x * 30.0))))) - 0.2));
}
def code(x, y, z): return fmax((math.sqrt(((math.pow((x * 30.0), 2.0) + math.pow((y * 30.0), 2.0)) + math.pow((z * 30.0), 2.0))) - 25.0), (math.fabs((((math.sin((x * 30.0)) * math.cos((y * 30.0))) + (math.sin((y * 30.0)) * math.cos((z * 30.0)))) + (math.sin((z * 30.0)) * math.cos((x * 30.0))))) - 0.2))
function code(x, y, z) return fmax(Float64(sqrt(Float64(Float64((Float64(x * 30.0) ^ 2.0) + (Float64(y * 30.0) ^ 2.0)) + (Float64(z * 30.0) ^ 2.0))) - 25.0), Float64(abs(Float64(Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(sin(Float64(y * 30.0)) * cos(Float64(z * 30.0)))) + Float64(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))))) - 0.2)) end
function tmp = code(x, y, z) tmp = max((sqrt(((((x * 30.0) ^ 2.0) + ((y * 30.0) ^ 2.0)) + ((z * 30.0) ^ 2.0))) - 25.0), (abs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2)); end
code[x_, y_, z_] := N[Max[N[(N[Sqrt[N[(N[(N[Power[N[(x * 30.0), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(y * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[(z * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 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
(fmax
(-
(sqrt
(+
(+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0))
(pow (* z 30.0) 2.0)))
25.0)
(-
(fabs
(+
(* (sin (* z 30.0)) (cos (* x 30.0)))
(+
(* (sin (* x 30.0)) (cos (* y 30.0)))
(* (sin (* y 30.0)) (cos (* z 30.0))))))
0.2))))
(if (<= t_0 2e+96)
t_0
(fmax (- (hypot (* y 30.0) (* 30.0 x)) 25.0) (- (fabs (* 30.0 z)) 0.2)))))
double code(double x, double y, double z) {
double t_0 = fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs(((sin((z * 30.0)) * cos((x * 30.0))) + ((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))))) - 0.2));
double tmp;
if (t_0 <= 2e+96) {
tmp = t_0;
} else {
tmp = fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), (fabs((30.0 * z)) - 0.2));
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = 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((z * 30.0)) * Math.cos((x * 30.0))) + ((Math.sin((x * 30.0)) * Math.cos((y * 30.0))) + (Math.sin((y * 30.0)) * Math.cos((z * 30.0)))))) - 0.2));
double tmp;
if (t_0 <= 2e+96) {
tmp = t_0;
} else {
tmp = fmax((Math.hypot((y * 30.0), (30.0 * x)) - 25.0), (Math.abs((30.0 * z)) - 0.2));
}
return tmp;
}
def code(x, y, z): t_0 = 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((z * 30.0)) * math.cos((x * 30.0))) + ((math.sin((x * 30.0)) * math.cos((y * 30.0))) + (math.sin((y * 30.0)) * math.cos((z * 30.0)))))) - 0.2)) tmp = 0 if t_0 <= 2e+96: tmp = t_0 else: tmp = fmax((math.hypot((y * 30.0), (30.0 * x)) - 25.0), (math.fabs((30.0 * z)) - 0.2)) return tmp
function code(x, y, z) t_0 = fmax(Float64(sqrt(Float64(Float64((Float64(x * 30.0) ^ 2.0) + (Float64(y * 30.0) ^ 2.0)) + (Float64(z * 30.0) ^ 2.0))) - 25.0), Float64(abs(Float64(Float64(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))) + Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(sin(Float64(y * 30.0)) * cos(Float64(z * 30.0)))))) - 0.2)) tmp = 0.0 if (t_0 <= 2e+96) tmp = t_0; else tmp = fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(30.0 * z)) - 0.2)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = max((sqrt(((((x * 30.0) ^ 2.0) + ((y * 30.0) ^ 2.0)) + ((z * 30.0) ^ 2.0))) - 25.0), (abs(((sin((z * 30.0)) * cos((x * 30.0))) + ((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))))) - 0.2)); tmp = 0.0; if (t_0 <= 2e+96) tmp = t_0; else tmp = max((hypot((y * 30.0), (30.0 * x)) - 25.0), (abs((30.0 * z)) - 0.2)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Max[N[(N[Sqrt[N[(N[(N[Power[N[(x * 30.0), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(y * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[(z * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[(N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 2e+96], t$95$0, N[Max[N[(N[Sqrt[N[(y * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right) + \left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right)\right| - 0.2\right)\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+96}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(y \cdot 30, 30 \cdot x\right) - 25, \left|30 \cdot z\right| - 0.2\right)\\
\end{array}
\end{array}
if (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) < 2.0000000000000001e96Initial program 99.9%
if 2.0000000000000001e96 < (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) Initial program 27.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-*.f6474.0
Applied rewrites74.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-*.f6474.0
Applied rewrites74.0%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6474.0
Applied rewrites74.0%
Taylor expanded in z around 0
lift-*.f6499.1
Applied rewrites99.1%
Final simplification99.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (sin (* y 30.0)))
(t_1
(-
(sqrt
(+
(+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0))
(pow (* z 30.0) 2.0)))
25.0))
(t_2 (cos (* y 30.0))))
(if (<=
(fmax
t_1
(-
(fabs
(+
(* (sin (* z 30.0)) (cos (* x 30.0)))
(+ (* (sin (* x 30.0)) t_2) (* t_0 (cos (* z 30.0))))))
0.2))
2e+96)
(fmax t_1 (- (fabs (fma (sin (* 30.0 x)) t_2 t_0)) 0.2))
(fmax (- (hypot (* y 30.0) (* 30.0 x)) 25.0) (- (fabs (* 30.0 z)) 0.2)))))
double code(double x, double y, double z) {
double t_0 = sin((y * 30.0));
double t_1 = sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0;
double t_2 = cos((y * 30.0));
double tmp;
if (fmax(t_1, (fabs(((sin((z * 30.0)) * cos((x * 30.0))) + ((sin((x * 30.0)) * t_2) + (t_0 * cos((z * 30.0)))))) - 0.2)) <= 2e+96) {
tmp = fmax(t_1, (fabs(fma(sin((30.0 * x)), t_2, t_0)) - 0.2));
} else {
tmp = fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), (fabs((30.0 * z)) - 0.2));
}
return tmp;
}
function code(x, y, z) t_0 = sin(Float64(y * 30.0)) t_1 = Float64(sqrt(Float64(Float64((Float64(x * 30.0) ^ 2.0) + (Float64(y * 30.0) ^ 2.0)) + (Float64(z * 30.0) ^ 2.0))) - 25.0) t_2 = cos(Float64(y * 30.0)) tmp = 0.0 if (fmax(t_1, Float64(abs(Float64(Float64(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))) + Float64(Float64(sin(Float64(x * 30.0)) * t_2) + Float64(t_0 * cos(Float64(z * 30.0)))))) - 0.2)) <= 2e+96) tmp = fmax(t_1, Float64(abs(fma(sin(Float64(30.0 * x)), t_2, t_0)) - 0.2)); else tmp = fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(30.0 * z)) - 0.2)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, Block[{t$95$2 = N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Max[t$95$1, N[(N[Abs[N[(N[(N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision] + N[(t$95$0 * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], 2e+96], N[Max[t$95$1, N[(N[Abs[N[(N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] * t$95$2 + t$95$0), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[Sqrt[N[(y * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(y \cdot 30\right)\\
t_1 := \sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25\\
t_2 := \cos \left(y \cdot 30\right)\\
\mathbf{if}\;\mathsf{max}\left(t\_1, \left|\sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right) + \left(\sin \left(x \cdot 30\right) \cdot t\_2 + t\_0 \cdot \cos \left(z \cdot 30\right)\right)\right| - 0.2\right) \leq 2 \cdot 10^{+96}:\\
\;\;\;\;\mathsf{max}\left(t\_1, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), t\_2, t\_0\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(y \cdot 30, 30 \cdot x\right) - 25, \left|30 \cdot z\right| - 0.2\right)\\
\end{array}
\end{array}
if (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) < 2.0000000000000001e96Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6499.1
Applied rewrites99.1%
if 2.0000000000000001e96 < (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) Initial program 27.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-*.f6474.0
Applied rewrites74.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-*.f6474.0
Applied rewrites74.0%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6474.0
Applied rewrites74.0%
Taylor expanded in z around 0
lift-*.f6499.1
Applied rewrites99.1%
Final simplification99.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fmax (* -30.0 x) (- (fabs (* 30.0 x)) 0.2)))
(t_1 (- (fabs (sin (* 30.0 z))) 0.2)))
(if (<= y -1.2e-44)
(fmax (- (* -30.0 y) 25.0) t_1)
(if (<= y -3.2e-123)
t_0
(if (<= y -8.5e-294)
(fmax (- (* 30.0 z) 25.0) t_1)
(if (<= y 1.24e-26) t_0 (fmax (- (* 30.0 y) 25.0) t_1)))))))
double code(double x, double y, double z) {
double t_0 = fmax((-30.0 * x), (fabs((30.0 * x)) - 0.2));
double t_1 = fabs(sin((30.0 * z))) - 0.2;
double tmp;
if (y <= -1.2e-44) {
tmp = fmax(((-30.0 * y) - 25.0), t_1);
} else if (y <= -3.2e-123) {
tmp = t_0;
} else if (y <= -8.5e-294) {
tmp = fmax(((30.0 * z) - 25.0), t_1);
} else if (y <= 1.24e-26) {
tmp = t_0;
} else {
tmp = fmax(((30.0 * y) - 25.0), t_1);
}
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) :: t_1
real(8) :: tmp
t_0 = fmax(((-30.0d0) * x), (abs((30.0d0 * x)) - 0.2d0))
t_1 = abs(sin((30.0d0 * z))) - 0.2d0
if (y <= (-1.2d-44)) then
tmp = fmax((((-30.0d0) * y) - 25.0d0), t_1)
else if (y <= (-3.2d-123)) then
tmp = t_0
else if (y <= (-8.5d-294)) then
tmp = fmax(((30.0d0 * z) - 25.0d0), t_1)
else if (y <= 1.24d-26) then
tmp = t_0
else
tmp = fmax(((30.0d0 * y) - 25.0d0), t_1)
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 t_1 = Math.abs(Math.sin((30.0 * z))) - 0.2;
double tmp;
if (y <= -1.2e-44) {
tmp = fmax(((-30.0 * y) - 25.0), t_1);
} else if (y <= -3.2e-123) {
tmp = t_0;
} else if (y <= -8.5e-294) {
tmp = fmax(((30.0 * z) - 25.0), t_1);
} else if (y <= 1.24e-26) {
tmp = t_0;
} else {
tmp = fmax(((30.0 * y) - 25.0), t_1);
}
return tmp;
}
def code(x, y, z): t_0 = fmax((-30.0 * x), (math.fabs((30.0 * x)) - 0.2)) t_1 = math.fabs(math.sin((30.0 * z))) - 0.2 tmp = 0 if y <= -1.2e-44: tmp = fmax(((-30.0 * y) - 25.0), t_1) elif y <= -3.2e-123: tmp = t_0 elif y <= -8.5e-294: tmp = fmax(((30.0 * z) - 25.0), t_1) elif y <= 1.24e-26: tmp = t_0 else: tmp = fmax(((30.0 * y) - 25.0), t_1) return tmp
function code(x, y, z) t_0 = fmax(Float64(-30.0 * x), Float64(abs(Float64(30.0 * x)) - 0.2)) t_1 = Float64(abs(sin(Float64(30.0 * z))) - 0.2) tmp = 0.0 if (y <= -1.2e-44) tmp = fmax(Float64(Float64(-30.0 * y) - 25.0), t_1); elseif (y <= -3.2e-123) tmp = t_0; elseif (y <= -8.5e-294) tmp = fmax(Float64(Float64(30.0 * z) - 25.0), t_1); elseif (y <= 1.24e-26) tmp = t_0; else tmp = fmax(Float64(Float64(30.0 * y) - 25.0), t_1); end return tmp end
function tmp_2 = code(x, y, z) t_0 = max((-30.0 * x), (abs((30.0 * x)) - 0.2)); t_1 = abs(sin((30.0 * z))) - 0.2; tmp = 0.0; if (y <= -1.2e-44) tmp = max(((-30.0 * y) - 25.0), t_1); elseif (y <= -3.2e-123) tmp = t_0; elseif (y <= -8.5e-294) tmp = max(((30.0 * z) - 25.0), t_1); elseif (y <= 1.24e-26) tmp = t_0; else tmp = max(((30.0 * y) - 25.0), t_1); 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]}, Block[{t$95$1 = N[(N[Abs[N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, If[LessEqual[y, -1.2e-44], N[Max[N[(N[(-30.0 * y), $MachinePrecision] - 25.0), $MachinePrecision], t$95$1], $MachinePrecision], If[LessEqual[y, -3.2e-123], t$95$0, If[LessEqual[y, -8.5e-294], N[Max[N[(N[(30.0 * z), $MachinePrecision] - 25.0), $MachinePrecision], t$95$1], $MachinePrecision], If[LessEqual[y, 1.24e-26], t$95$0, N[Max[N[(N[(30.0 * y), $MachinePrecision] - 25.0), $MachinePrecision], t$95$1], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)\\
t_1 := \left|\sin \left(30 \cdot z\right)\right| - 0.2\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{-44}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y - 25, t\_1\right)\\
\mathbf{elif}\;y \leq -3.2 \cdot 10^{-123}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{-294}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot z - 25, t\_1\right)\\
\mathbf{elif}\;y \leq 1.24 \cdot 10^{-26}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot y - 25, t\_1\right)\\
\end{array}
\end{array}
if y < -1.20000000000000004e-44Initial program 40.5%
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-*.f6487.7
Applied rewrites87.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.2
Applied rewrites85.2%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6485.2
Applied rewrites85.2%
Taylor expanded in y around -inf
lower-*.f6461.4
Applied rewrites61.4%
if -1.20000000000000004e-44 < y < -3.19999999999999979e-123 or -8.4999999999999999e-294 < y < 1.2399999999999999e-26Initial program 51.7%
Taylor expanded in x around -inf
lower-*.f6435.4
Applied rewrites35.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6435.1
Applied rewrites35.1%
Taylor expanded in y around 0
lift-sin.f64N/A
lift-*.f6435.1
Applied rewrites35.1%
Taylor expanded in x around 0
lift-*.f6458.0
Applied rewrites58.0%
if -3.19999999999999979e-123 < y < -8.4999999999999999e-294Initial program 60.1%
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-*.f6451.7
Applied rewrites51.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-*.f6451.7
Applied rewrites51.7%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6451.7
Applied rewrites51.7%
Taylor expanded in z around inf
lift-*.f6455.9
Applied rewrites55.9%
if 1.2399999999999999e-26 < y Initial program 47.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-*.f6483.2
Applied rewrites83.2%
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.1
Applied rewrites83.1%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6483.1
Applied rewrites83.1%
Taylor expanded in y around inf
lower-*.f6469.5
Applied rewrites69.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (fabs (sin (* 30.0 z))) 0.2)))
(if (<= y -1.2e-44)
(fmax (- (* -30.0 y) 25.0) t_0)
(if (<= y 1.24e-26)
(fmax (* -30.0 x) (- (fabs (* 30.0 x)) 0.2))
(fmax (- (* 30.0 y) 25.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = fabs(sin((30.0 * z))) - 0.2;
double tmp;
if (y <= -1.2e-44) {
tmp = fmax(((-30.0 * y) - 25.0), t_0);
} else if (y <= 1.24e-26) {
tmp = fmax((-30.0 * x), (fabs((30.0 * x)) - 0.2));
} else {
tmp = fmax(((30.0 * y) - 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 * z))) - 0.2d0
if (y <= (-1.2d-44)) then
tmp = fmax((((-30.0d0) * y) - 25.0d0), t_0)
else if (y <= 1.24d-26) then
tmp = fmax(((-30.0d0) * x), (abs((30.0d0 * x)) - 0.2d0))
else
tmp = fmax(((30.0d0 * y) - 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 * z))) - 0.2;
double tmp;
if (y <= -1.2e-44) {
tmp = fmax(((-30.0 * y) - 25.0), t_0);
} else if (y <= 1.24e-26) {
tmp = fmax((-30.0 * x), (Math.abs((30.0 * x)) - 0.2));
} else {
tmp = fmax(((30.0 * y) - 25.0), t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs(math.sin((30.0 * z))) - 0.2 tmp = 0 if y <= -1.2e-44: tmp = fmax(((-30.0 * y) - 25.0), t_0) elif y <= 1.24e-26: tmp = fmax((-30.0 * x), (math.fabs((30.0 * x)) - 0.2)) else: tmp = fmax(((30.0 * y) - 25.0), t_0) return tmp
function code(x, y, z) t_0 = Float64(abs(sin(Float64(30.0 * z))) - 0.2) tmp = 0.0 if (y <= -1.2e-44) tmp = fmax(Float64(Float64(-30.0 * y) - 25.0), t_0); elseif (y <= 1.24e-26) tmp = fmax(Float64(-30.0 * x), Float64(abs(Float64(30.0 * x)) - 0.2)); else tmp = fmax(Float64(Float64(30.0 * y) - 25.0), t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs(sin((30.0 * z))) - 0.2; tmp = 0.0; if (y <= -1.2e-44) tmp = max(((-30.0 * y) - 25.0), t_0); elseif (y <= 1.24e-26) tmp = max((-30.0 * x), (abs((30.0 * x)) - 0.2)); else tmp = max(((30.0 * y) - 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 * z), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, If[LessEqual[y, -1.2e-44], N[Max[N[(N[(-30.0 * y), $MachinePrecision] - 25.0), $MachinePrecision], t$95$0], $MachinePrecision], If[LessEqual[y, 1.24e-26], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[(30.0 * y), $MachinePrecision] - 25.0), $MachinePrecision], t$95$0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\sin \left(30 \cdot z\right)\right| - 0.2\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{-44}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y - 25, t\_0\right)\\
\mathbf{elif}\;y \leq 1.24 \cdot 10^{-26}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot y - 25, t\_0\right)\\
\end{array}
\end{array}
if y < -1.20000000000000004e-44Initial program 40.5%
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-*.f6487.7
Applied rewrites87.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.2
Applied rewrites85.2%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6485.2
Applied rewrites85.2%
Taylor expanded in y around -inf
lower-*.f6461.4
Applied rewrites61.4%
if -1.20000000000000004e-44 < y < 1.2399999999999999e-26Initial program 54.4%
Taylor expanded in x around -inf
lower-*.f6431.2
Applied rewrites31.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6430.7
Applied rewrites30.7%
Taylor expanded in y around 0
lift-sin.f64N/A
lift-*.f6430.7
Applied rewrites30.7%
Taylor expanded in x around 0
lift-*.f6449.4
Applied rewrites49.4%
if 1.2399999999999999e-26 < y Initial program 47.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-*.f6483.2
Applied rewrites83.2%
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.1
Applied rewrites83.1%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6483.1
Applied rewrites83.1%
Taylor expanded in y around inf
lower-*.f6469.5
Applied rewrites69.5%
(FPCore (x y z) :precision binary64 (if (<= x 6.8e+67) (fmax (* -30.0 x) (- (fabs (- (sin (* 30.0 x)) (* -30.0 y))) 0.2)) (fmax (* -30.0 x) (- (fabs (* 30.0 x)) 0.2))))
double code(double x, double y, double z) {
double tmp;
if (x <= 6.8e+67) {
tmp = fmax((-30.0 * x), (fabs((sin((30.0 * x)) - (-30.0 * y))) - 0.2));
} else {
tmp = fmax((-30.0 * x), (fabs((30.0 * x)) - 0.2));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 6.8d+67) then
tmp = fmax(((-30.0d0) * x), (abs((sin((30.0d0 * x)) - ((-30.0d0) * y))) - 0.2d0))
else
tmp = fmax(((-30.0d0) * x), (abs((30.0d0 * x)) - 0.2d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 6.8e+67) {
tmp = fmax((-30.0 * x), (Math.abs((Math.sin((30.0 * x)) - (-30.0 * y))) - 0.2));
} else {
tmp = fmax((-30.0 * x), (Math.abs((30.0 * x)) - 0.2));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 6.8e+67: tmp = fmax((-30.0 * x), (math.fabs((math.sin((30.0 * x)) - (-30.0 * y))) - 0.2)) else: tmp = fmax((-30.0 * x), (math.fabs((30.0 * x)) - 0.2)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 6.8e+67) tmp = fmax(Float64(-30.0 * x), Float64(abs(Float64(sin(Float64(30.0 * x)) - Float64(-30.0 * y))) - 0.2)); else tmp = fmax(Float64(-30.0 * x), Float64(abs(Float64(30.0 * x)) - 0.2)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 6.8e+67) tmp = max((-30.0 * x), (abs((sin((30.0 * x)) - (-30.0 * y))) - 0.2)); else tmp = max((-30.0 * x), (abs((30.0 * x)) - 0.2)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 6.8e+67], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] - N[(-30.0 * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.8 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|\sin \left(30 \cdot x\right) - -30 \cdot y\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)\\
\end{array}
\end{array}
if x < 6.8000000000000003e67Initial program 53.6%
Taylor expanded in x around -inf
lower-*.f6424.2
Applied rewrites24.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6423.9
Applied rewrites23.9%
Taylor expanded in y around 0
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lower-*.f6461.1
Applied rewrites61.1%
if 6.8000000000000003e67 < x Initial program 26.7%
Taylor expanded in x around -inf
lower-*.f643.8
Applied rewrites3.8%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f643.6
Applied rewrites3.6%
Taylor expanded in y around 0
lift-sin.f64N/A
lift-*.f643.6
Applied rewrites3.6%
Taylor expanded in x around 0
lift-*.f6468.2
Applied rewrites68.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (fabs (sin (* 30.0 z))) 0.2)))
(if (<= y -1.2e-44)
(fmax (- (* -30.0 y) 25.0) t_0)
(if (<= y 115000.0)
(fmax (* -30.0 x) (- (fabs (* 30.0 x)) 0.2))
(fmax (* 30.0 y) t_0)))))
double code(double x, double y, double z) {
double t_0 = fabs(sin((30.0 * z))) - 0.2;
double tmp;
if (y <= -1.2e-44) {
tmp = fmax(((-30.0 * y) - 25.0), t_0);
} else if (y <= 115000.0) {
tmp = fmax((-30.0 * x), (fabs((30.0 * x)) - 0.2));
} else {
tmp = fmax((30.0 * y), t_0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs(sin((30.0d0 * z))) - 0.2d0
if (y <= (-1.2d-44)) then
tmp = fmax((((-30.0d0) * y) - 25.0d0), t_0)
else if (y <= 115000.0d0) then
tmp = fmax(((-30.0d0) * x), (abs((30.0d0 * x)) - 0.2d0))
else
tmp = fmax((30.0d0 * y), t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs(Math.sin((30.0 * z))) - 0.2;
double tmp;
if (y <= -1.2e-44) {
tmp = fmax(((-30.0 * y) - 25.0), t_0);
} else if (y <= 115000.0) {
tmp = fmax((-30.0 * x), (Math.abs((30.0 * x)) - 0.2));
} else {
tmp = fmax((30.0 * y), t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs(math.sin((30.0 * z))) - 0.2 tmp = 0 if y <= -1.2e-44: tmp = fmax(((-30.0 * y) - 25.0), t_0) elif y <= 115000.0: tmp = fmax((-30.0 * x), (math.fabs((30.0 * x)) - 0.2)) else: tmp = fmax((30.0 * y), t_0) return tmp
function code(x, y, z) t_0 = Float64(abs(sin(Float64(30.0 * z))) - 0.2) tmp = 0.0 if (y <= -1.2e-44) tmp = fmax(Float64(Float64(-30.0 * y) - 25.0), t_0); elseif (y <= 115000.0) tmp = fmax(Float64(-30.0 * x), Float64(abs(Float64(30.0 * x)) - 0.2)); else tmp = fmax(Float64(30.0 * y), t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs(sin((30.0 * z))) - 0.2; tmp = 0.0; if (y <= -1.2e-44) tmp = max(((-30.0 * y) - 25.0), t_0); elseif (y <= 115000.0) tmp = max((-30.0 * x), (abs((30.0 * x)) - 0.2)); else tmp = max((30.0 * y), t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, If[LessEqual[y, -1.2e-44], N[Max[N[(N[(-30.0 * y), $MachinePrecision] - 25.0), $MachinePrecision], t$95$0], $MachinePrecision], If[LessEqual[y, 115000.0], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(30.0 * y), $MachinePrecision], t$95$0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\sin \left(30 \cdot z\right)\right| - 0.2\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{-44}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y - 25, t\_0\right)\\
\mathbf{elif}\;y \leq 115000:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot y, t\_0\right)\\
\end{array}
\end{array}
if y < -1.20000000000000004e-44Initial program 40.5%
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-*.f6487.7
Applied rewrites87.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.2
Applied rewrites85.2%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6485.2
Applied rewrites85.2%
Taylor expanded in y around -inf
lower-*.f6461.4
Applied rewrites61.4%
if -1.20000000000000004e-44 < y < 115000Initial program 55.5%
Taylor expanded in x around -inf
lower-*.f6428.7
Applied rewrites28.7%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6428.2
Applied rewrites28.2%
Taylor expanded in y around 0
lift-sin.f64N/A
lift-*.f6428.2
Applied rewrites28.2%
Taylor expanded in x around 0
lift-*.f6447.6
Applied rewrites47.6%
if 115000 < y Initial program 43.8%
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-*.f6486.0
Applied rewrites86.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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6486.0
Applied rewrites86.0%
Taylor expanded in y around inf
lower-*.f6473.5
Applied rewrites73.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (fabs (sin (* 30.0 z))) 0.2)))
(if (<= y -4500000000.0)
(fmax (* -30.0 y) t_0)
(if (<= y 115000.0)
(fmax (* -30.0 x) (- (fabs (* 30.0 x)) 0.2))
(fmax (* 30.0 y) t_0)))))
double code(double x, double y, double z) {
double t_0 = fabs(sin((30.0 * z))) - 0.2;
double tmp;
if (y <= -4500000000.0) {
tmp = fmax((-30.0 * y), t_0);
} else if (y <= 115000.0) {
tmp = fmax((-30.0 * x), (fabs((30.0 * x)) - 0.2));
} else {
tmp = fmax((30.0 * y), t_0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs(sin((30.0d0 * z))) - 0.2d0
if (y <= (-4500000000.0d0)) then
tmp = fmax(((-30.0d0) * y), t_0)
else if (y <= 115000.0d0) then
tmp = fmax(((-30.0d0) * x), (abs((30.0d0 * x)) - 0.2d0))
else
tmp = fmax((30.0d0 * y), t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs(Math.sin((30.0 * z))) - 0.2;
double tmp;
if (y <= -4500000000.0) {
tmp = fmax((-30.0 * y), t_0);
} else if (y <= 115000.0) {
tmp = fmax((-30.0 * x), (Math.abs((30.0 * x)) - 0.2));
} else {
tmp = fmax((30.0 * y), t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs(math.sin((30.0 * z))) - 0.2 tmp = 0 if y <= -4500000000.0: tmp = fmax((-30.0 * y), t_0) elif y <= 115000.0: tmp = fmax((-30.0 * x), (math.fabs((30.0 * x)) - 0.2)) else: tmp = fmax((30.0 * y), t_0) return tmp
function code(x, y, z) t_0 = Float64(abs(sin(Float64(30.0 * z))) - 0.2) tmp = 0.0 if (y <= -4500000000.0) tmp = fmax(Float64(-30.0 * y), t_0); elseif (y <= 115000.0) tmp = fmax(Float64(-30.0 * x), Float64(abs(Float64(30.0 * x)) - 0.2)); else tmp = fmax(Float64(30.0 * y), t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs(sin((30.0 * z))) - 0.2; tmp = 0.0; if (y <= -4500000000.0) tmp = max((-30.0 * y), t_0); elseif (y <= 115000.0) tmp = max((-30.0 * x), (abs((30.0 * x)) - 0.2)); else tmp = max((30.0 * y), t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]}, If[LessEqual[y, -4500000000.0], N[Max[N[(-30.0 * y), $MachinePrecision], t$95$0], $MachinePrecision], If[LessEqual[y, 115000.0], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(30.0 * y), $MachinePrecision], t$95$0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\sin \left(30 \cdot z\right)\right| - 0.2\\
\mathbf{if}\;y \leq -4500000000:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y, t\_0\right)\\
\mathbf{elif}\;y \leq 115000:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(30 \cdot y, t\_0\right)\\
\end{array}
\end{array}
if y < -4.5e9Initial program 32.2%
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-*.f6489.8
Applied rewrites89.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-*.f6489.8
Applied rewrites89.8%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6489.8
Applied rewrites89.8%
Taylor expanded in y around -inf
lower-*.f6465.3
Applied rewrites65.3%
if -4.5e9 < y < 115000Initial program 58.2%
Taylor expanded in x around -inf
lower-*.f6427.3
Applied rewrites27.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6426.7
Applied rewrites26.7%
Taylor expanded in y around 0
lift-sin.f64N/A
lift-*.f6426.7
Applied rewrites26.7%
Taylor expanded in x around 0
lift-*.f6445.8
Applied rewrites45.8%
if 115000 < y Initial program 43.8%
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-*.f6486.0
Applied rewrites86.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-*.f6486.0
Applied rewrites86.0%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6486.0
Applied rewrites86.0%
Taylor expanded in y around inf
lower-*.f6473.5
Applied rewrites73.5%
(FPCore (x y z) :precision binary64 (fmax (- (hypot (* y 30.0) (* 30.0 x)) 25.0) (- (fabs (* 30.0 z)) 0.2)))
double code(double x, double y, double z) {
return fmax((hypot((y * 30.0), (30.0 * x)) - 25.0), (fabs((30.0 * z)) - 0.2));
}
public static double code(double x, double y, double z) {
return fmax((Math.hypot((y * 30.0), (30.0 * x)) - 25.0), (Math.abs((30.0 * z)) - 0.2));
}
def code(x, y, z): return fmax((math.hypot((y * 30.0), (30.0 * x)) - 25.0), (math.fabs((30.0 * z)) - 0.2))
function code(x, y, z) return fmax(Float64(hypot(Float64(y * 30.0), Float64(30.0 * x)) - 25.0), Float64(abs(Float64(30.0 * z)) - 0.2)) end
function tmp = code(x, y, z) tmp = max((hypot((y * 30.0), (30.0 * x)) - 25.0), (abs((30.0 * z)) - 0.2)); end
code[x_, y_, z_] := N[Max[N[(N[Sqrt[N[(y * 30.0), $MachinePrecision] ^ 2 + N[(30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{max}\left(\mathsf{hypot}\left(y \cdot 30, 30 \cdot x\right) - 25, \left|30 \cdot z\right| - 0.2\right)
\end{array}
Initial program 48.1%
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-*.f6476.9
Applied rewrites76.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-*.f6476.1
Applied rewrites76.1%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6475.8
Applied rewrites75.8%
Taylor expanded in z around 0
lift-*.f6497.5
Applied rewrites97.5%
(FPCore (x y z) :precision binary64 (if (<= y -4500000000.0) (fmax (* -30.0 y) (- (fabs (sin (* 30.0 z))) 0.2)) (fmax (* -30.0 x) (- (fabs (* 30.0 x)) 0.2))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4500000000.0) {
tmp = fmax((-30.0 * y), (fabs(sin((30.0 * z))) - 0.2));
} else {
tmp = fmax((-30.0 * x), (fabs((30.0 * x)) - 0.2));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-4500000000.0d0)) then
tmp = fmax(((-30.0d0) * y), (abs(sin((30.0d0 * z))) - 0.2d0))
else
tmp = fmax(((-30.0d0) * x), (abs((30.0d0 * x)) - 0.2d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4500000000.0) {
tmp = fmax((-30.0 * y), (Math.abs(Math.sin((30.0 * z))) - 0.2));
} else {
tmp = fmax((-30.0 * x), (Math.abs((30.0 * x)) - 0.2));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4500000000.0: tmp = fmax((-30.0 * y), (math.fabs(math.sin((30.0 * z))) - 0.2)) else: tmp = fmax((-30.0 * x), (math.fabs((30.0 * x)) - 0.2)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4500000000.0) tmp = fmax(Float64(-30.0 * y), Float64(abs(sin(Float64(30.0 * z))) - 0.2)); else tmp = fmax(Float64(-30.0 * x), Float64(abs(Float64(30.0 * x)) - 0.2)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4500000000.0) tmp = max((-30.0 * y), (abs(sin((30.0 * z))) - 0.2)); else tmp = max((-30.0 * x), (abs((30.0 * x)) - 0.2)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4500000000.0], N[Max[N[(-30.0 * y), $MachinePrecision], N[(N[Abs[N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4500000000:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y, \left|\sin \left(30 \cdot z\right)\right| - 0.2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)\\
\end{array}
\end{array}
if y < -4.5e9Initial program 32.2%
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-*.f6489.8
Applied rewrites89.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-*.f6489.8
Applied rewrites89.8%
Taylor expanded in x around 0
lower-sin.f64N/A
lower-*.f6489.8
Applied rewrites89.8%
Taylor expanded in y around -inf
lower-*.f6465.3
Applied rewrites65.3%
if -4.5e9 < y Initial program 53.3%
Taylor expanded in x around -inf
lower-*.f6421.6
Applied rewrites21.6%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6421.3
Applied rewrites21.3%
Taylor expanded in y around 0
lift-sin.f64N/A
lift-*.f6420.8
Applied rewrites20.8%
Taylor expanded in x around 0
lift-*.f6435.0
Applied rewrites35.0%
(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 48.1%
Taylor expanded in x around -inf
lower-*.f6420.0
Applied rewrites20.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift-*.f6419.8
Applied rewrites19.8%
Taylor expanded in y around 0
lift-sin.f64N/A
lift-*.f6419.1
Applied rewrites19.1%
Taylor expanded in x around 0
lift-*.f6433.0
Applied rewrites33.0%
herbie shell --seed 2025037
(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)))