
(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 15 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 (cos y) z x))) (if (<= z -0.32) t_0 (if (<= z 2.6e-17) (+ (+ x (sin y)) z) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(cos(y), z, x);
double tmp;
if (z <= -0.32) {
tmp = t_0;
} else if (z <= 2.6e-17) {
tmp = (x + sin(y)) + z;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(cos(y), z, x) tmp = 0.0 if (z <= -0.32) tmp = t_0; elseif (z <= 2.6e-17) tmp = Float64(Float64(x + sin(y)) + z); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[z, -0.32], t$95$0, If[LessEqual[z, 2.6e-17], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\cos y, z, x\right)\\
\mathbf{if}\;z \leq -0.32:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-17}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.320000000000000007 or 2.60000000000000003e-17 < 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
Applied rewrites98.6%
if -0.320000000000000007 < z < 2.60000000000000003e-17Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma (cos y) z x))) (if (<= z -1.32e-21) t_0 (if (<= z 2.3e-21) (+ (sin y) x) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(cos(y), z, x);
double tmp;
if (z <= -1.32e-21) {
tmp = t_0;
} else if (z <= 2.3e-21) {
tmp = sin(y) + x;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(cos(y), z, x) tmp = 0.0 if (z <= -1.32e-21) tmp = t_0; elseif (z <= 2.3e-21) tmp = Float64(sin(y) + x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[z, -1.32e-21], t$95$0, If[LessEqual[z, 2.3e-21], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\cos y, z, x\right)\\
\mathbf{if}\;z \leq -1.32 \cdot 10^{-21}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-21}:\\
\;\;\;\;\sin y + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.32e-21 or 2.29999999999999999e-21 < 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
Applied rewrites97.8%
if -1.32e-21 < z < 2.29999999999999999e-21Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6492.6
Applied rewrites92.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -7.2e+125)
t_0
(if (<= z -1.32e-21)
(+ z x)
(if (<= z 2.1e-17) (+ (sin y) x) (if (<= z 1.7e+116) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -7.2e+125) {
tmp = t_0;
} else if (z <= -1.32e-21) {
tmp = z + x;
} else if (z <= 2.1e-17) {
tmp = sin(y) + x;
} else if (z <= 1.7e+116) {
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 = cos(y) * z
if (z <= (-7.2d+125)) then
tmp = t_0
else if (z <= (-1.32d-21)) then
tmp = z + x
else if (z <= 2.1d-17) then
tmp = sin(y) + x
else if (z <= 1.7d+116) 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 = Math.cos(y) * z;
double tmp;
if (z <= -7.2e+125) {
tmp = t_0;
} else if (z <= -1.32e-21) {
tmp = z + x;
} else if (z <= 2.1e-17) {
tmp = Math.sin(y) + x;
} else if (z <= 1.7e+116) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.cos(y) * z tmp = 0 if z <= -7.2e+125: tmp = t_0 elif z <= -1.32e-21: tmp = z + x elif z <= 2.1e-17: tmp = math.sin(y) + x elif z <= 1.7e+116: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(cos(y) * z) tmp = 0.0 if (z <= -7.2e+125) tmp = t_0; elseif (z <= -1.32e-21) tmp = Float64(z + x); elseif (z <= 2.1e-17) tmp = Float64(sin(y) + x); elseif (z <= 1.7e+116) tmp = Float64(z + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = cos(y) * z; tmp = 0.0; if (z <= -7.2e+125) tmp = t_0; elseif (z <= -1.32e-21) tmp = z + x; elseif (z <= 2.1e-17) tmp = sin(y) + x; elseif (z <= 1.7e+116) tmp = z + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -7.2e+125], t$95$0, If[LessEqual[z, -1.32e-21], N[(z + x), $MachinePrecision], If[LessEqual[z, 2.1e-17], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.7e+116], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+125}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.32 \cdot 10^{-21}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-17}:\\
\;\;\;\;\sin y + x\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+116}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.2000000000000007e125 or 1.70000000000000011e116 < z Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-cos.f6483.5
Applied rewrites83.5%
if -7.2000000000000007e125 < z < -1.32e-21 or 2.09999999999999992e-17 < z < 1.70000000000000011e116Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6474.0
Applied rewrites74.0%
if -1.32e-21 < z < 2.09999999999999992e-17Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6492.5
Applied rewrites92.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (+ x (sin y)) (* z (cos y)))))
(if (<= t_0 -5e+15)
(+ z x)
(if (<= t_0 -0.0002)
(sin y)
(if (<= t_0 5e-11) (+ (+ z y) x) (if (<= t_0 5.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 <= -5e+15) {
tmp = z + x;
} else if (t_0 <= -0.0002) {
tmp = sin(y);
} else if (t_0 <= 5e-11) {
tmp = (z + y) + x;
} else if (t_0 <= 5.0) {
tmp = sin(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) :: t_0
real(8) :: tmp
t_0 = (x + sin(y)) + (z * cos(y))
if (t_0 <= (-5d+15)) then
tmp = z + x
else if (t_0 <= (-0.0002d0)) then
tmp = sin(y)
else if (t_0 <= 5d-11) then
tmp = (z + y) + x
else if (t_0 <= 5.0d0) then
tmp = sin(y)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + Math.sin(y)) + (z * Math.cos(y));
double tmp;
if (t_0 <= -5e+15) {
tmp = z + x;
} else if (t_0 <= -0.0002) {
tmp = Math.sin(y);
} else if (t_0 <= 5e-11) {
tmp = (z + y) + x;
} else if (t_0 <= 5.0) {
tmp = Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): t_0 = (x + math.sin(y)) + (z * math.cos(y)) tmp = 0 if t_0 <= -5e+15: tmp = z + x elif t_0 <= -0.0002: tmp = math.sin(y) elif t_0 <= 5e-11: tmp = (z + y) + x elif t_0 <= 5.0: tmp = math.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 <= -5e+15) tmp = Float64(z + x); elseif (t_0 <= -0.0002) tmp = sin(y); elseif (t_0 <= 5e-11) tmp = Float64(Float64(z + y) + x); elseif (t_0 <= 5.0) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + sin(y)) + (z * cos(y)); tmp = 0.0; if (t_0 <= -5e+15) tmp = z + x; elseif (t_0 <= -0.0002) tmp = sin(y); elseif (t_0 <= 5e-11) tmp = (z + y) + x; elseif (t_0 <= 5.0) tmp = sin(y); else tmp = z + x; end tmp_2 = 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, -5e+15], N[(z + x), $MachinePrecision], If[LessEqual[t$95$0, -0.0002], N[Sin[y], $MachinePrecision], If[LessEqual[t$95$0, 5e-11], N[(N[(z + y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$0, 5.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 -5 \cdot 10^{+15}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;t\_0 \leq -0.0002:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-11}:\\
\;\;\;\;\left(z + y\right) + x\\
\mathbf{elif}\;t\_0 \leq 5:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -5e15 or 5 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6476.9
Applied rewrites76.9%
if -5e15 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -2.0000000000000001e-4 or 5.00000000000000018e-11 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 5Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-sin.f6490.5
Applied rewrites90.5%
Taylor expanded in z around 0
lift-sin.f6482.3
Applied rewrites82.3%
if -2.0000000000000001e-4 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 5.00000000000000018e-11Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (sin y) x)))
(if (<= y -0.085)
t_0
(if (<= y 4200000000.0)
(+ (fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 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 <= -0.085) {
tmp = t_0;
} else if (y <= 4200000000.0) {
tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 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 <= -0.085) tmp = t_0; elseif (y <= 4200000000.0) tmp = Float64(fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, 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, -0.085], t$95$0, If[LessEqual[y, 4200000000.0], N[(N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + z), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y + x\\
\mathbf{if}\;y \leq -0.085:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4200000000:\\
\;\;\;\;\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}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.0850000000000000061 or 4.2e9 < y Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6462.0
Applied rewrites62.0%
if -0.0850000000000000061 < y < 4.2e9Initial program 100.0%
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-*.f6498.8
Applied rewrites98.8%
(FPCore (x y z)
:precision binary64
(if (<= y -4.5)
(+ z x)
(if (<= y 2450000000000.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 <= -4.5) {
tmp = z + x;
} else if (y <= 2450000000000.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 <= -4.5) tmp = Float64(z + x); elseif (y <= 2450000000000.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, -4.5], N[(z + x), $MachinePrecision], If[LessEqual[y, 2450000000000.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 -4.5:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 2450000000000:\\
\;\;\;\;\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 < -4.5 or 2.45e12 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6441.2
Applied rewrites41.2%
if -4.5 < y < 2.45e12Initial program 100.0%
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-*.f6498.4
Applied rewrites98.4%
(FPCore (x y z)
:precision binary64
(if (<= y -4.5)
(+ z x)
(if (<= y 2300000000000.0)
(fma (- (* (- (* 0.5 z) (/ 1.0 y)) y)) y (+ z x))
(+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.5) {
tmp = z + x;
} else if (y <= 2300000000000.0) {
tmp = fma(-(((0.5 * z) - (1.0 / y)) * y), y, (z + x));
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -4.5) tmp = Float64(z + x); elseif (y <= 2300000000000.0) tmp = fma(Float64(-Float64(Float64(Float64(0.5 * z) - Float64(1.0 / y)) * y)), y, Float64(z + x)); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -4.5], N[(z + x), $MachinePrecision], If[LessEqual[y, 2300000000000.0], N[((-N[(N[(N[(0.5 * z), $MachinePrecision] - N[(1.0 / y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]) * y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 2300000000000:\\
\;\;\;\;\mathsf{fma}\left(-\left(0.5 \cdot z - \frac{1}{y}\right) \cdot y, y, z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -4.5 or 2.3e12 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6441.2
Applied rewrites41.2%
if -4.5 < y < 2.3e12Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-+l+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-+.f6498.3
Applied rewrites98.3%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6498.2
Applied rewrites98.2%
(FPCore (x y z) :precision binary64 (if (<= y -4.5) (+ z x) (if (<= y 2300000000000.0) (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 <= -4.5) {
tmp = z + x;
} else if (y <= 2300000000000.0) {
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 <= -4.5) tmp = Float64(z + x); elseif (y <= 2300000000000.0) 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, -4.5], N[(z + x), $MachinePrecision], If[LessEqual[y, 2300000000000.0], 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 -4.5:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 2300000000000:\\
\;\;\;\;\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 < -4.5 or 2.3e12 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6441.2
Applied rewrites41.2%
if -4.5 < y < 2.3e12Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-+l+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-+.f6498.3
Applied rewrites98.3%
(FPCore (x y z) :precision binary64 (if (<= y -7e+85) (+ z x) (if (<= y 3.8e+83) (fma (- (* (/ -1.0 y) y)) y (+ z x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7e+85) {
tmp = z + x;
} else if (y <= 3.8e+83) {
tmp = fma(-((-1.0 / y) * y), y, (z + x));
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -7e+85) tmp = Float64(z + x); elseif (y <= 3.8e+83) tmp = fma(Float64(-Float64(Float64(-1.0 / y) * y)), y, Float64(z + x)); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -7e+85], N[(z + x), $MachinePrecision], If[LessEqual[y, 3.8e+83], N[((-N[(N[(-1.0 / y), $MachinePrecision] * y), $MachinePrecision]) * y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+85}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(-\frac{-1}{y} \cdot y, y, z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -7.0000000000000001e85 or 3.8000000000000002e83 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6441.3
Applied rewrites41.3%
if -7.0000000000000001e85 < y < 3.8000000000000002e83Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-+l+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-+.f6484.2
Applied rewrites84.2%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6484.2
Applied rewrites84.2%
Taylor expanded in y around 0
lower-/.f6485.8
Applied rewrites85.8%
(FPCore (x y z) :precision binary64 (if (<= y -7e+85) (+ z x) (if (<= y 3.8e+83) (+ (+ z y) x) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7e+85) {
tmp = z + x;
} else if (y <= 3.8e+83) {
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 <= (-7d+85)) then
tmp = z + x
else if (y <= 3.8d+83) 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 <= -7e+85) {
tmp = z + x;
} else if (y <= 3.8e+83) {
tmp = (z + y) + x;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7e+85: tmp = z + x elif y <= 3.8e+83: tmp = (z + y) + x else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7e+85) tmp = Float64(z + x); elseif (y <= 3.8e+83) 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 <= -7e+85) tmp = z + x; elseif (y <= 3.8e+83) tmp = (z + y) + x; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7e+85], N[(z + x), $MachinePrecision], If[LessEqual[y, 3.8e+83], N[(N[(z + y), $MachinePrecision] + x), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+85}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+83}:\\
\;\;\;\;\left(z + y\right) + x\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -7.0000000000000001e85 or 3.8000000000000002e83 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6441.3
Applied rewrites41.3%
if -7.0000000000000001e85 < y < 3.8000000000000002e83Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6485.8
Applied rewrites85.8%
(FPCore (x y z) :precision binary64 (+ z x))
double code(double x, double y, double z) {
return z + x;
}
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 + x
end function
public static double code(double x, double y, double z) {
return z + x;
}
def code(x, y, z): return z + x
function code(x, y, z) return Float64(z + x) end
function tmp = code(x, y, z) tmp = z + x; end
code[x_, y_, z_] := N[(z + x), $MachinePrecision]
\begin{array}{l}
\\
z + x
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6466.4
Applied rewrites66.4%
(FPCore (x y z) :precision binary64 (if (<= x -1.2e+53) x (if (<= x 2.6e-89) (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.2e+53) {
tmp = x;
} else if (x <= 2.6e-89) {
tmp = z + y;
} else {
tmp = 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.2d+53)) then
tmp = x
else if (x <= 2.6d-89) then
tmp = z + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.2e+53) {
tmp = x;
} else if (x <= 2.6e-89) {
tmp = z + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.2e+53: tmp = x elif x <= 2.6e-89: tmp = z + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.2e+53) tmp = x; elseif (x <= 2.6e-89) tmp = Float64(z + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.2e+53) tmp = x; elseif (x <= 2.6e-89) tmp = z + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.2e+53], x, If[LessEqual[x, 2.6e-89], N[(z + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+53}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-89}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.2e53 or 2.5999999999999999e-89 < x Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites68.8%
if -1.2e53 < x < 2.5999999999999999e-89Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-sin.f6488.8
Applied rewrites88.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6443.9
Applied rewrites43.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.2e+53) x (if (<= x 2.6e-89) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.2e+53) {
tmp = x;
} else if (x <= 2.6e-89) {
tmp = z;
} else {
tmp = 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.2d+53)) then
tmp = x
else if (x <= 2.6d-89) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.2e+53) {
tmp = x;
} else if (x <= 2.6e-89) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.2e+53: tmp = x elif x <= 2.6e-89: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.2e+53) tmp = x; elseif (x <= 2.6e-89) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.2e+53) tmp = x; elseif (x <= 2.6e-89) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.2e+53], x, If[LessEqual[x, 2.6e-89], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+53}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-89}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.2e53 or 2.5999999999999999e-89 < x Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites68.8%
if -1.2e53 < x < 2.5999999999999999e-89Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-sin.f6488.8
Applied rewrites88.8%
Taylor expanded in y around 0
Applied rewrites37.2%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
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
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites42.2%
herbie shell --seed 2025120
(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))))