
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(y));
}
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 = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(y));
}
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 = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (fma (cos y) z (+ (sin y) x)))
double code(double x, double y, double z) {
return fma(cos(y), z, (sin(y) + x));
}
function code(x, y, z) return fma(cos(y), z, Float64(sin(y) + x)) end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos y, z, \sin y + x\right)
\end{array}
Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma x (/ (* z (cos y)) x) x))) (if (<= x -9.6e-14) t_0 (if (<= x 8.2e-20) (fma (cos y) z (sin y)) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(x, ((z * cos(y)) / x), x);
double tmp;
if (x <= -9.6e-14) {
tmp = t_0;
} else if (x <= 8.2e-20) {
tmp = fma(cos(y), z, sin(y));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(x, Float64(Float64(z * cos(y)) / x), x) tmp = 0.0 if (x <= -9.6e-14) tmp = t_0; elseif (x <= 8.2e-20) tmp = fma(cos(y), z, sin(y)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[x, -9.6e-14], t$95$0, If[LessEqual[x, 8.2e-20], N[(N[Cos[y], $MachinePrecision] * z + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x, \frac{z \cdot \cos y}{x}, x\right)\\
\mathbf{if}\;x \leq -9.6 \cdot 10^{-14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-20}:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -9.599999999999999e-14 or 8.2000000000000002e-20 < x Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-sin.f64N/A
lift-fma.f64N/A
lift-cos.f6488.1
Applied rewrites88.1%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lift-cos.f6471.5
Applied rewrites71.5%
if -9.599999999999999e-14 < x < 8.2000000000000002e-20Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-sin.f6458.7
Applied rewrites58.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fma x (/ (* z (cos y)) x) x)))
(if (<= z -460000000.0)
t_0
(if (<= z 7e-5)
(+ (+ (sin y) z) x)
(if (<= z 8.6e+189) t_0 (fma (cos y) z (+ x y)))))))
double code(double x, double y, double z) {
double t_0 = fma(x, ((z * cos(y)) / x), x);
double tmp;
if (z <= -460000000.0) {
tmp = t_0;
} else if (z <= 7e-5) {
tmp = (sin(y) + z) + x;
} else if (z <= 8.6e+189) {
tmp = t_0;
} else {
tmp = fma(cos(y), z, (x + y));
}
return tmp;
}
function code(x, y, z) t_0 = fma(x, Float64(Float64(z * cos(y)) / x), x) tmp = 0.0 if (z <= -460000000.0) tmp = t_0; elseif (z <= 7e-5) tmp = Float64(Float64(sin(y) + z) + x); elseif (z <= 8.6e+189) tmp = t_0; else tmp = fma(cos(y), z, Float64(x + y)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -460000000.0], t$95$0, If[LessEqual[z, 7e-5], N[(N[(N[Sin[y], $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 8.6e+189], t$95$0, N[(N[Cos[y], $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x, \frac{z \cdot \cos y}{x}, x\right)\\
\mathbf{if}\;z \leq -460000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-5}:\\
\;\;\;\;\left(\sin y + z\right) + x\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+189}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\
\end{array}
\end{array}
if z < -4.6e8 or 6.9999999999999994e-5 < z < 8.59999999999999995e189Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-sin.f64N/A
lift-fma.f64N/A
lift-cos.f6488.1
Applied rewrites88.1%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lift-cos.f6471.5
Applied rewrites71.5%
if -4.6e8 < z < 6.9999999999999994e-5Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites82.2%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f64N/A
lift-sin.f6482.2
Applied rewrites82.2%
if 8.59999999999999995e189 < z Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
lower-+.f6470.8
Applied rewrites70.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -4.9e+144)
(+ (+ x y) t_0)
(if (<= z 1.7e+134) (+ (+ (sin y) z) x) t_0))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -4.9e+144) {
tmp = (x + y) + t_0;
} else if (z <= 1.7e+134) {
tmp = (sin(y) + z) + x;
} 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 = z * cos(y)
if (z <= (-4.9d+144)) then
tmp = (x + y) + t_0
else if (z <= 1.7d+134) then
tmp = (sin(y) + z) + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -4.9e+144) {
tmp = (x + y) + t_0;
} else if (z <= 1.7e+134) {
tmp = (Math.sin(y) + z) + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -4.9e+144: tmp = (x + y) + t_0 elif z <= 1.7e+134: tmp = (math.sin(y) + z) + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -4.9e+144) tmp = Float64(Float64(x + y) + t_0); elseif (z <= 1.7e+134) tmp = Float64(Float64(sin(y) + z) + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -4.9e+144) tmp = (x + y) + t_0; elseif (z <= 1.7e+134) tmp = (sin(y) + z) + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.9e+144], N[(N[(x + y), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[z, 1.7e+134], N[(N[(N[Sin[y], $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -4.9 \cdot 10^{+144}:\\
\;\;\;\;\left(x + y\right) + t\_0\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+134}:\\
\;\;\;\;\left(\sin y + z\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.9e144Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites70.8%
if -4.9e144 < z < 1.70000000000000009e134Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites82.2%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f64N/A
lift-sin.f6482.2
Applied rewrites82.2%
if 1.70000000000000009e134 < z Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-sin.f64N/A
lift-fma.f64N/A
lift-cos.f6488.1
Applied rewrites88.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-cos.f6476.2
Applied rewrites76.2%
Taylor expanded in z around inf
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-*.f64N/A
lift-cos.f6442.8
Applied rewrites42.8%
(FPCore (x y z) :precision binary64 (if (<= z -4.9e+144) (fma (cos y) z (+ x y)) (if (<= z 1.7e+134) (+ (+ (sin y) z) x) (* z (cos y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.9e+144) {
tmp = fma(cos(y), z, (x + y));
} else if (z <= 1.7e+134) {
tmp = (sin(y) + z) + x;
} else {
tmp = z * cos(y);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -4.9e+144) tmp = fma(cos(y), z, Float64(x + y)); elseif (z <= 1.7e+134) tmp = Float64(Float64(sin(y) + z) + x); else tmp = Float64(z * cos(y)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -4.9e+144], N[(N[Cos[y], $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.7e+134], N[(N[(N[Sin[y], $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+134}:\\
\;\;\;\;\left(\sin y + z\right) + x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \cos y\\
\end{array}
\end{array}
if z < -4.9e144Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
lower-+.f6470.8
Applied rewrites70.8%
if -4.9e144 < z < 1.70000000000000009e134Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites82.2%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f64N/A
lift-sin.f6482.2
Applied rewrites82.2%
if 1.70000000000000009e134 < z Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-sin.f64N/A
lift-fma.f64N/A
lift-cos.f6488.1
Applied rewrites88.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-cos.f6476.2
Applied rewrites76.2%
Taylor expanded in z around inf
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-*.f64N/A
lift-cos.f6442.8
Applied rewrites42.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (cos y)))) (if (<= z -7.5e+151) t_0 (if (<= z 1.7e+134) (+ (+ (sin y) z) x) t_0))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -7.5e+151) {
tmp = t_0;
} else if (z <= 1.7e+134) {
tmp = (sin(y) + z) + x;
} 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 = z * cos(y)
if (z <= (-7.5d+151)) then
tmp = t_0
else if (z <= 1.7d+134) then
tmp = (sin(y) + z) + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -7.5e+151) {
tmp = t_0;
} else if (z <= 1.7e+134) {
tmp = (Math.sin(y) + z) + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -7.5e+151: tmp = t_0 elif z <= 1.7e+134: tmp = (math.sin(y) + z) + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -7.5e+151) tmp = t_0; elseif (z <= 1.7e+134) tmp = Float64(Float64(sin(y) + z) + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -7.5e+151) tmp = t_0; elseif (z <= 1.7e+134) tmp = (sin(y) + z) + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.5e+151], t$95$0, If[LessEqual[z, 1.7e+134], N[(N[(N[Sin[y], $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -7.5 \cdot 10^{+151}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+134}:\\
\;\;\;\;\left(\sin y + z\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.49999999999999977e151 or 1.70000000000000009e134 < z Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-sin.f64N/A
lift-fma.f64N/A
lift-cos.f6488.1
Applied rewrites88.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-cos.f6476.2
Applied rewrites76.2%
Taylor expanded in z around inf
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-*.f64N/A
lift-cos.f6442.8
Applied rewrites42.8%
if -7.49999999999999977e151 < z < 1.70000000000000009e134Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites82.2%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f64N/A
lift-sin.f6482.2
Applied rewrites82.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -7.5e+151)
t_0
(if (<= z -1150000000.0)
(+ z x)
(if (<= z 1.85e-56) (+ (sin y) x) (if (<= z 1.7e+134) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -7.5e+151) {
tmp = t_0;
} else if (z <= -1150000000.0) {
tmp = z + x;
} else if (z <= 1.85e-56) {
tmp = sin(y) + x;
} else if (z <= 1.7e+134) {
tmp = z + x;
} 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 = z * cos(y)
if (z <= (-7.5d+151)) then
tmp = t_0
else if (z <= (-1150000000.0d0)) then
tmp = z + x
else if (z <= 1.85d-56) then
tmp = sin(y) + x
else if (z <= 1.7d+134) then
tmp = z + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -7.5e+151) {
tmp = t_0;
} else if (z <= -1150000000.0) {
tmp = z + x;
} else if (z <= 1.85e-56) {
tmp = Math.sin(y) + x;
} else if (z <= 1.7e+134) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -7.5e+151: tmp = t_0 elif z <= -1150000000.0: tmp = z + x elif z <= 1.85e-56: tmp = math.sin(y) + x elif z <= 1.7e+134: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -7.5e+151) tmp = t_0; elseif (z <= -1150000000.0) tmp = Float64(z + x); elseif (z <= 1.85e-56) tmp = Float64(sin(y) + x); elseif (z <= 1.7e+134) tmp = Float64(z + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -7.5e+151) tmp = t_0; elseif (z <= -1150000000.0) tmp = z + x; elseif (z <= 1.85e-56) tmp = sin(y) + x; elseif (z <= 1.7e+134) tmp = z + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.5e+151], t$95$0, If[LessEqual[z, -1150000000.0], N[(z + x), $MachinePrecision], If[LessEqual[z, 1.85e-56], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.7e+134], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -7.5 \cdot 10^{+151}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1150000000:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-56}:\\
\;\;\;\;\sin y + x\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+134}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.49999999999999977e151 or 1.70000000000000009e134 < z Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-sin.f64N/A
lift-fma.f64N/A
lift-cos.f6488.1
Applied rewrites88.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-cos.f6476.2
Applied rewrites76.2%
Taylor expanded in z around inf
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-*.f64N/A
lift-cos.f6442.8
Applied rewrites42.8%
if -7.49999999999999977e151 < z < -1.15e9 or 1.8500000000000001e-56 < z < 1.70000000000000009e134Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6466.2
Applied rewrites66.2%
if -1.15e9 < z < 1.8500000000000001e-56Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-sin.f64N/A
lift-fma.f64N/A
lift-cos.f6488.1
Applied rewrites88.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6458.5
Applied rewrites58.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (+ x (sin y)) (* z (cos y)))))
(if (<= t_0 -1000000000.0)
(+ z x)
(if (<= t_0 -0.2)
(sin y)
(if (<= t_0 1e-12)
(+ (+ x (* (fma (* y y) -0.16666666666666666 1.0) y)) z)
(if (<= t_0 1.0) (sin y) (+ z x)))))))
double code(double x, double y, double z) {
double t_0 = (x + sin(y)) + (z * cos(y));
double tmp;
if (t_0 <= -1000000000.0) {
tmp = z + x;
} else if (t_0 <= -0.2) {
tmp = sin(y);
} else if (t_0 <= 1e-12) {
tmp = (x + (fma((y * y), -0.16666666666666666, 1.0) * y)) + z;
} else if (t_0 <= 1.0) {
tmp = sin(y);
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(x + sin(y)) + Float64(z * cos(y))) tmp = 0.0 if (t_0 <= -1000000000.0) tmp = Float64(z + x); elseif (t_0 <= -0.2) tmp = sin(y); elseif (t_0 <= 1e-12) tmp = Float64(Float64(x + Float64(fma(Float64(y * y), -0.16666666666666666, 1.0) * y)) + z); elseif (t_0 <= 1.0) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1000000000.0], N[(z + x), $MachinePrecision], If[LessEqual[t$95$0, -0.2], N[Sin[y], $MachinePrecision], If[LessEqual[t$95$0, 1e-12], N[(N[(x + N[(N[(N[(y * y), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \sin y\right) + z \cdot \cos y\\
\mathbf{if}\;t\_0 \leq -1000000000:\\
\;\;\;\;z + x\\
\mathbf{elif}\;t\_0 \leq -0.2:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;t\_0 \leq 10^{-12}:\\
\;\;\;\;\left(x + \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \cdot y\right) + z\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -1e9 or 1 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6466.2
Applied rewrites66.2%
if -1e9 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.20000000000000001 or 9.9999999999999998e-13 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-sin.f64N/A
lift-fma.f64N/A
lift-cos.f6488.1
Applied rewrites88.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6458.5
Applied rewrites58.5%
Taylor expanded in x around 0
lift-sin.f6418.2
Applied rewrites18.2%
if -0.20000000000000001 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 9.9999999999999998e-13Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites82.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6454.7
Applied rewrites54.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (sin y) x)))
(if (<= y -4.8e-5)
t_0
(if (<= y 3.7e-38) (fma (fma (* z y) -0.5 1.0) y (+ z x)) t_0))))
double code(double x, double y, double z) {
double t_0 = sin(y) + x;
double tmp;
if (y <= -4.8e-5) {
tmp = t_0;
} else if (y <= 3.7e-38) {
tmp = fma(fma((z * y), -0.5, 1.0), y, (z + x));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(sin(y) + x) tmp = 0.0 if (y <= -4.8e-5) tmp = t_0; elseif (y <= 3.7e-38) tmp = fma(fma(Float64(z * y), -0.5, 1.0), y, Float64(z + x)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -4.8e-5], t$95$0, If[LessEqual[y, 3.7e-38], N[(N[(N[(z * y), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y + x\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{-38}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z \cdot y, -0.5, 1\right), y, z + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.8000000000000001e-5 or 3.7e-38 < y Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-sin.f64N/A
lift-fma.f64N/A
lift-cos.f6488.1
Applied rewrites88.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6458.5
Applied rewrites58.5%
if -4.8000000000000001e-5 < y < 3.7e-38Initial program 99.9%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6457.0
Applied rewrites57.0%
(FPCore (x y z)
:precision binary64
(if (<= y -6400.0)
(+ z x)
(if (<= y 23000.0)
(+ (fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y z) x)
(+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6400.0) {
tmp = z + x;
} else if (y <= 23000.0) {
tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, z) + x;
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -6400.0) tmp = Float64(z + x); elseif (y <= 23000.0) tmp = Float64(fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, z) + x); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -6400.0], N[(z + x), $MachinePrecision], If[LessEqual[y, 23000.0], N[(N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + z), $MachinePrecision] + x), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6400:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 23000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z\right) + x\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -6400 or 23000 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6466.2
Applied rewrites66.2%
if -6400 < y < 23000Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6454.1
Applied rewrites54.1%
(FPCore (x y z)
:precision binary64
(if (<= y -5500.0)
(+ z x)
(if (<= y 10600.0)
(+ (+ x (* (fma (* y y) -0.16666666666666666 1.0) y)) z)
(+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5500.0) {
tmp = z + x;
} else if (y <= 10600.0) {
tmp = (x + (fma((y * y), -0.16666666666666666, 1.0) * y)) + z;
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -5500.0) tmp = Float64(z + x); elseif (y <= 10600.0) tmp = Float64(Float64(x + Float64(fma(Float64(y * y), -0.16666666666666666, 1.0) * y)) + z); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -5500.0], N[(z + x), $MachinePrecision], If[LessEqual[y, 10600.0], N[(N[(x + N[(N[(N[(y * y), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5500:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 10600:\\
\;\;\;\;\left(x + \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \cdot y\right) + z\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -5500 or 10600 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6466.2
Applied rewrites66.2%
if -5500 < y < 10600Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites82.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6454.7
Applied rewrites54.7%
(FPCore (x y z) :precision binary64 (if (<= y -3600000.0) (+ z x) (if (<= y 4.6) (fma (fma (* z y) -0.5 1.0) y (+ z x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3600000.0) {
tmp = z + x;
} else if (y <= 4.6) {
tmp = fma(fma((z * y), -0.5, 1.0), y, (z + x));
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -3600000.0) tmp = Float64(z + x); elseif (y <= 4.6) tmp = fma(fma(Float64(z * y), -0.5, 1.0), y, Float64(z + x)); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -3600000.0], N[(z + x), $MachinePrecision], If[LessEqual[y, 4.6], N[(N[(N[(z * y), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3600000:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 4.6:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z \cdot y, -0.5, 1\right), y, z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -3.6e6 or 4.5999999999999996 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6466.2
Applied rewrites66.2%
if -3.6e6 < y < 4.5999999999999996Initial program 99.9%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6457.0
Applied rewrites57.0%
(FPCore (x y z) :precision binary64 (if (<= y -3600000.0) (+ z x) (if (<= y 4.6) (fma (fma (* y y) -0.5 1.0) z (+ x y)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3600000.0) {
tmp = z + x;
} else if (y <= 4.6) {
tmp = fma(fma((y * y), -0.5, 1.0), z, (x + y));
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -3600000.0) tmp = Float64(z + x); elseif (y <= 4.6) tmp = fma(fma(Float64(y * y), -0.5, 1.0), z, Float64(x + y)); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -3600000.0], N[(z + x), $MachinePrecision], If[LessEqual[y, 4.6], N[(N[(N[(y * y), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3600000:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 4.6:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, -0.5, 1\right), z, x + y\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -3.6e6 or 4.5999999999999996 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6466.2
Applied rewrites66.2%
if -3.6e6 < y < 4.5999999999999996Initial program 99.9%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6457.0
Applied rewrites57.0%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
Applied rewrites56.3%
(FPCore (x y z) :precision binary64 (if (<= y -3.8e+41) (+ z x) (if (<= y 9.5) (+ (+ z y) x) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e+41) {
tmp = z + x;
} else if (y <= 9.5) {
tmp = (z + y) + x;
} else {
tmp = z + x;
}
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 <= (-3.8d+41)) then
tmp = z + x
else if (y <= 9.5d0) then
tmp = (z + y) + x
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e+41) {
tmp = z + x;
} else if (y <= 9.5) {
tmp = (z + y) + x;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.8e+41: tmp = z + x elif y <= 9.5: tmp = (z + y) + x else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.8e+41) tmp = Float64(z + x); elseif (y <= 9.5) tmp = Float64(Float64(z + y) + x); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.8e+41) tmp = z + x; elseif (y <= 9.5) tmp = (z + y) + x; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.8e+41], N[(z + x), $MachinePrecision], If[LessEqual[y, 9.5], N[(N[(z + y), $MachinePrecision] + x), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+41}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 9.5:\\
\;\;\;\;\left(z + y\right) + x\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -3.8000000000000001e41 or 9.5 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6466.2
Applied rewrites66.2%
if -3.8000000000000001e41 < y < 9.5Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6461.6
Applied rewrites61.6%
(FPCore (x y z) :precision binary64 (if (<= x -4.9e-150) (+ z x) (if (<= x 1.22e-154) (+ z y) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.9e-150) {
tmp = z + x;
} else if (x <= 1.22e-154) {
tmp = z + y;
} else {
tmp = z + x;
}
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 <= (-4.9d-150)) then
tmp = z + x
else if (x <= 1.22d-154) then
tmp = z + y
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.9e-150) {
tmp = z + x;
} else if (x <= 1.22e-154) {
tmp = z + y;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.9e-150: tmp = z + x elif x <= 1.22e-154: tmp = z + y else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.9e-150) tmp = Float64(z + x); elseif (x <= 1.22e-154) tmp = Float64(z + y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.9e-150) tmp = z + x; elseif (x <= 1.22e-154) tmp = z + y; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.9e-150], N[(z + x), $MachinePrecision], If[LessEqual[x, 1.22e-154], N[(z + y), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.9 \cdot 10^{-150}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-154}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -4.8999999999999995e-150 or 1.22000000000000005e-154 < x Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6466.2
Applied rewrites66.2%
if -4.8999999999999995e-150 < x < 1.22000000000000005e-154Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-sin.f6458.7
Applied rewrites58.7%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6429.5
Applied rewrites29.5%
(FPCore (x y z) :precision binary64 (if (<= x -1.75e+50) (+ y x) (if (<= x 1.45e+50) (+ z y) (+ y x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.75e+50) {
tmp = y + x;
} else if (x <= 1.45e+50) {
tmp = z + y;
} else {
tmp = y + x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.75d+50)) then
tmp = y + x
else if (x <= 1.45d+50) then
tmp = z + y
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.75e+50) {
tmp = y + x;
} else if (x <= 1.45e+50) {
tmp = z + y;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.75e+50: tmp = y + x elif x <= 1.45e+50: tmp = z + y else: tmp = y + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.75e+50) tmp = Float64(y + x); elseif (x <= 1.45e+50) tmp = Float64(z + y); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.75e+50) tmp = y + x; elseif (x <= 1.45e+50) tmp = z + y; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.75e+50], N[(y + x), $MachinePrecision], If[LessEqual[x, 1.45e+50], N[(z + y), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+50}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+50}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if x < -1.75000000000000003e50 or 1.45e50 < x Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-sin.f64N/A
lift-fma.f64N/A
lift-cos.f6488.1
Applied rewrites88.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6458.5
Applied rewrites58.5%
Taylor expanded in y around 0
Applied rewrites38.6%
if -1.75000000000000003e50 < x < 1.45e50Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-sin.f6458.7
Applied rewrites58.7%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6429.5
Applied rewrites29.5%
(FPCore (x y z) :precision binary64 (if (<= z -3.2e+163) z (if (<= z 3.8e+137) (+ y x) z)))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.2e+163) {
tmp = z;
} else if (z <= 3.8e+137) {
tmp = y + x;
} else {
tmp = z;
}
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 (z <= (-3.2d+163)) then
tmp = z
else if (z <= 3.8d+137) then
tmp = y + x
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3.2e+163) {
tmp = z;
} else if (z <= 3.8e+137) {
tmp = y + x;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.2e+163: tmp = z elif z <= 3.8e+137: tmp = y + x else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.2e+163) tmp = z; elseif (z <= 3.8e+137) tmp = Float64(y + x); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.2e+163) tmp = z; elseif (z <= 3.8e+137) tmp = y + x; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.2e+163], z, If[LessEqual[z, 3.8e+137], N[(y + x), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+163}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+137}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -3.1999999999999998e163 or 3.79999999999999963e137 < z Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6466.2
Applied rewrites66.2%
Taylor expanded in x around 0
Applied rewrites26.1%
if -3.1999999999999998e163 < z < 3.79999999999999963e137Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
distribute-lft-inN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-sin.f64N/A
lift-fma.f64N/A
lift-cos.f6488.1
Applied rewrites88.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6458.5
Applied rewrites58.5%
Taylor expanded in y around 0
Applied rewrites38.6%
(FPCore (x y z) :precision binary64 z)
double code(double x, double y, double z) {
return z;
}
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 = z
end function
public static double code(double x, double y, double z) {
return z;
}
def code(x, y, z): return z
function code(x, y, z) return z end
function tmp = code(x, y, z) tmp = z; end
code[x_, y_, z_] := z
\begin{array}{l}
\\
z
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6466.2
Applied rewrites66.2%
Taylor expanded in x around 0
Applied rewrites26.1%
herbie shell --seed 2025136
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))