
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- z y) (- (- t z) -1.0)) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - y) / ((t - z) - -1.0)), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - y) / Float64(Float64(t - z) - -1.0)), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - y}{\left(t - z\right) - -1}, a, x\right)
\end{array}
Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
(FPCore (x y z t a) :precision binary64 (if (<= z 2.7e+132) (fma (/ a (- (- t z) -1.0)) (- z y) x) (fma (/ (- z y) (- 1.0 z)) a x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 2.7e+132) {
tmp = fma((a / ((t - z) - -1.0)), (z - y), x);
} else {
tmp = fma(((z - y) / (1.0 - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= 2.7e+132) tmp = fma(Float64(a / Float64(Float64(t - z) - -1.0)), Float64(z - y), x); else tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 2.7e+132], N[(N[(a / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.7 \cdot 10^{+132}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{\left(t - z\right) - -1}, z - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\end{array}
\end{array}
if z < 2.7e132Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-/.f64N/A
div-flip-revN/A
lower-/.f64N/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.2%
if 2.7e132 < z Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in t around 0
lower--.f6479.5
Applied rewrites79.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) (- 1.0 z)) a x)))
(if (<= z -5e+23)
t_1
(if (<= z 3.7e+34) (- x (/ (- y z) (/ (+ t 1.0) a))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / (1.0 - z)), a, x);
double tmp;
if (z <= -5e+23) {
tmp = t_1;
} else if (z <= 3.7e+34) {
tmp = x - ((y - z) / ((t + 1.0) / a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x) tmp = 0.0 if (z <= -5e+23) tmp = t_1; elseif (z <= 3.7e+34) tmp = Float64(x - Float64(Float64(y - z) / Float64(Float64(t + 1.0) / a))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -5e+23], t$95$1, If[LessEqual[z, 3.7e+34], N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(t + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{if}\;z \leq -5 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+34}:\\
\;\;\;\;x - \frac{y - z}{\frac{t + 1}{a}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.9999999999999999e23 or 3.70000000000000009e34 < z Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in t around 0
lower--.f6479.5
Applied rewrites79.5%
if -4.9999999999999999e23 < z < 3.70000000000000009e34Initial program 96.9%
Taylor expanded in z around 0
Applied rewrites73.9%
(FPCore (x y z t a)
:precision binary64
(if (<= t -7e+21)
(- x (* (- a) (* y (/ -1.0 t))))
(if (<= t 0.0044)
(fma (/ (- z y) (- 1.0 z)) a x)
(fma (/ z (- (- t z) -1.0)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7e+21) {
tmp = x - (-a * (y * (-1.0 / t)));
} else if (t <= 0.0044) {
tmp = fma(((z - y) / (1.0 - z)), a, x);
} else {
tmp = fma((z / ((t - z) - -1.0)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7e+21) tmp = Float64(x - Float64(Float64(-a) * Float64(y * Float64(-1.0 / t)))); elseif (t <= 0.0044) tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); else tmp = fma(Float64(z / Float64(Float64(t - z) - -1.0)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7e+21], N[(x - N[((-a) * N[(y * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 0.0044], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(N[(z / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{+21}:\\
\;\;\;\;x - \left(-a\right) \cdot \left(y \cdot \frac{-1}{t}\right)\\
\mathbf{elif}\;t \leq 0.0044:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(t - z\right) - -1}, a, x\right)\\
\end{array}
\end{array}
if t < -7e21Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.7
Applied rewrites69.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6454.6
Applied rewrites54.6%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6456.7
Applied rewrites56.7%
if -7e21 < t < 0.00440000000000000027Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in t around 0
lower--.f6479.5
Applied rewrites79.5%
if 0.00440000000000000027 < t Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites73.6%
(FPCore (x y z t a)
:precision binary64
(if (<= t -7e+21)
(- x (* (- a) (* y (/ -1.0 t))))
(if (<= t 2.7e-5)
(fma (/ a (- 1.0 z)) (- z y) x)
(fma (/ z (- (- t z) -1.0)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7e+21) {
tmp = x - (-a * (y * (-1.0 / t)));
} else if (t <= 2.7e-5) {
tmp = fma((a / (1.0 - z)), (z - y), x);
} else {
tmp = fma((z / ((t - z) - -1.0)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7e+21) tmp = Float64(x - Float64(Float64(-a) * Float64(y * Float64(-1.0 / t)))); elseif (t <= 2.7e-5) tmp = fma(Float64(a / Float64(1.0 - z)), Float64(z - y), x); else tmp = fma(Float64(z / Float64(Float64(t - z) - -1.0)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7e+21], N[(x - N[((-a) * N[(y * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.7e-5], N[(N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision], N[(N[(z / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{+21}:\\
\;\;\;\;x - \left(-a\right) \cdot \left(y \cdot \frac{-1}{t}\right)\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{1 - z}, z - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(t - z\right) - -1}, a, x\right)\\
\end{array}
\end{array}
if t < -7e21Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.7
Applied rewrites69.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6454.6
Applied rewrites54.6%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6456.7
Applied rewrites56.7%
if -7e21 < t < 2.6999999999999999e-5Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in t around 0
lower--.f6479.5
Applied rewrites79.5%
lift-fma.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f6477.8
Applied rewrites77.8%
if 2.6999999999999999e-5 < t Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites73.6%
(FPCore (x y z t a)
:precision binary64
(if (<= t -7e+21)
(- x (* (- a) (* y (/ -1.0 t))))
(if (<= t 1.46e+16)
(fma (/ a (- 1.0 z)) (- z y) x)
(fma (/ (- z y) t) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7e+21) {
tmp = x - (-a * (y * (-1.0 / t)));
} else if (t <= 1.46e+16) {
tmp = fma((a / (1.0 - z)), (z - y), x);
} else {
tmp = fma(((z - y) / t), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7e+21) tmp = Float64(x - Float64(Float64(-a) * Float64(y * Float64(-1.0 / t)))); elseif (t <= 1.46e+16) tmp = fma(Float64(a / Float64(1.0 - z)), Float64(z - y), x); else tmp = fma(Float64(Float64(z - y) / t), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7e+21], N[(x - N[((-a) * N[(y * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.46e+16], N[(N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{+21}:\\
\;\;\;\;x - \left(-a\right) \cdot \left(y \cdot \frac{-1}{t}\right)\\
\mathbf{elif}\;t \leq 1.46 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{1 - z}, z - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\end{array}
\end{array}
if t < -7e21Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.7
Applied rewrites69.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6454.6
Applied rewrites54.6%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6456.7
Applied rewrites56.7%
if -7e21 < t < 1.46e16Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in t around 0
lower--.f6479.5
Applied rewrites79.5%
lift-fma.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f6477.8
Applied rewrites77.8%
if 1.46e16 < t Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6454.2
Applied rewrites54.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.2e+77)
(- x a)
(if (<= z 1.35e+35)
(- x (* (/ a (- t -1.0)) y))
(fma (/ z (- 1.0 z)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.2e+77) {
tmp = x - a;
} else if (z <= 1.35e+35) {
tmp = x - ((a / (t - -1.0)) * y);
} else {
tmp = fma((z / (1.0 - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.2e+77) tmp = Float64(x - a); elseif (z <= 1.35e+35) tmp = Float64(x - Float64(Float64(a / Float64(t - -1.0)) * y)); else tmp = fma(Float64(z / Float64(1.0 - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.2e+77], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.35e+35], N[(x - N[(N[(a / N[(t - -1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+77}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+35}:\\
\;\;\;\;x - \frac{a}{t - -1} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 - z}, a, x\right)\\
\end{array}
\end{array}
if z < -1.1999999999999999e77Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites59.3%
if -1.1999999999999999e77 < z < 1.35000000000000001e35Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.7
Applied rewrites69.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6472.6
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6472.6
Applied rewrites72.6%
if 1.35000000000000001e35 < z Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in t around 0
lower--.f6479.5
Applied rewrites79.5%
Taylor expanded in y around 0
Applied rewrites66.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5e+23)
(- x a)
(if (<= z 4.6e-281)
(fma (/ (- z y) t) a x)
(if (<= z 2.4e+82) (- x (/ (* a y) (- 1.0 z))) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e+23) {
tmp = x - a;
} else if (z <= 4.6e-281) {
tmp = fma(((z - y) / t), a, x);
} else if (z <= 2.4e+82) {
tmp = x - ((a * y) / (1.0 - z));
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e+23) tmp = Float64(x - a); elseif (z <= 4.6e-281) tmp = fma(Float64(Float64(z - y) / t), a, x); elseif (z <= 2.4e+82) tmp = Float64(x - Float64(Float64(a * y) / Float64(1.0 - z))); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e+23], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.6e-281], N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 2.4e+82], N[(x - N[(N[(a * y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+23}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-281}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+82}:\\
\;\;\;\;x - \frac{a \cdot y}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.9999999999999999e23 or 2.39999999999999998e82 < z Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites59.3%
if -4.9999999999999999e23 < z < 4.59999999999999978e-281Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6454.2
Applied rewrites54.2%
if 4.59999999999999978e-281 < z < 2.39999999999999998e82Initial program 96.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.7
Applied rewrites69.7%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6463.6
Applied rewrites63.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5e+23)
(- x a)
(if (<= z 4.6e-281)
(fma (/ (- z y) t) a x)
(if (<= z 2.4e+82) (- x (* (/ y (- 1.0 z)) a)) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e+23) {
tmp = x - a;
} else if (z <= 4.6e-281) {
tmp = fma(((z - y) / t), a, x);
} else if (z <= 2.4e+82) {
tmp = x - ((y / (1.0 - z)) * a);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e+23) tmp = Float64(x - a); elseif (z <= 4.6e-281) tmp = fma(Float64(Float64(z - y) / t), a, x); elseif (z <= 2.4e+82) tmp = Float64(x - Float64(Float64(y / Float64(1.0 - z)) * a)); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e+23], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.6e-281], N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 2.4e+82], N[(x - N[(N[(y / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+23}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-281}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+82}:\\
\;\;\;\;x - \frac{y}{1 - z} \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.9999999999999999e23 or 2.39999999999999998e82 < z Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites59.3%
if -4.9999999999999999e23 < z < 4.59999999999999978e-281Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6454.2
Applied rewrites54.2%
if 4.59999999999999978e-281 < z < 2.39999999999999998e82Initial program 96.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.7
Applied rewrites69.7%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6463.6
Applied rewrites63.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6465.4
Applied rewrites65.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5e+23)
(- x a)
(if (<= z 4.6e-281)
(fma (/ (- z y) t) a x)
(if (<= z 3.05e+34) (- x (/ (* a y) 1.0)) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e+23) {
tmp = x - a;
} else if (z <= 4.6e-281) {
tmp = fma(((z - y) / t), a, x);
} else if (z <= 3.05e+34) {
tmp = x - ((a * y) / 1.0);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e+23) tmp = Float64(x - a); elseif (z <= 4.6e-281) tmp = fma(Float64(Float64(z - y) / t), a, x); elseif (z <= 3.05e+34) tmp = Float64(x - Float64(Float64(a * y) / 1.0)); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e+23], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.6e-281], N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 3.05e+34], N[(x - N[(N[(a * y), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+23}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-281}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{elif}\;z \leq 3.05 \cdot 10^{+34}:\\
\;\;\;\;x - \frac{a \cdot y}{1}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.9999999999999999e23 or 3.04999999999999998e34 < z Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites59.3%
if -4.9999999999999999e23 < z < 4.59999999999999978e-281Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6454.2
Applied rewrites54.2%
if 4.59999999999999978e-281 < z < 3.04999999999999998e34Initial program 96.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.7
Applied rewrites69.7%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6463.6
Applied rewrites63.6%
Taylor expanded in z around 0
Applied rewrites57.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.9e+38)
(- x a)
(if (<= z 4.6e-281)
(- x (* (/ y t) a))
(if (<= z 3.05e+34) (- x (/ (* a y) 1.0)) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.9e+38) {
tmp = x - a;
} else if (z <= 4.6e-281) {
tmp = x - ((y / t) * a);
} else if (z <= 3.05e+34) {
tmp = x - ((a * y) / 1.0);
} else {
tmp = x - a;
}
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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-2.9d+38)) then
tmp = x - a
else if (z <= 4.6d-281) then
tmp = x - ((y / t) * a)
else if (z <= 3.05d+34) then
tmp = x - ((a * y) / 1.0d0)
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.9e+38) {
tmp = x - a;
} else if (z <= 4.6e-281) {
tmp = x - ((y / t) * a);
} else if (z <= 3.05e+34) {
tmp = x - ((a * y) / 1.0);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.9e+38: tmp = x - a elif z <= 4.6e-281: tmp = x - ((y / t) * a) elif z <= 3.05e+34: tmp = x - ((a * y) / 1.0) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.9e+38) tmp = Float64(x - a); elseif (z <= 4.6e-281) tmp = Float64(x - Float64(Float64(y / t) * a)); elseif (z <= 3.05e+34) tmp = Float64(x - Float64(Float64(a * y) / 1.0)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.9e+38) tmp = x - a; elseif (z <= 4.6e-281) tmp = x - ((y / t) * a); elseif (z <= 3.05e+34) tmp = x - ((a * y) / 1.0); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.9e+38], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.6e-281], N[(x - N[(N[(y / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.05e+34], N[(x - N[(N[(a * y), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+38}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-281}:\\
\;\;\;\;x - \frac{y}{t} \cdot a\\
\mathbf{elif}\;z \leq 3.05 \cdot 10^{+34}:\\
\;\;\;\;x - \frac{a \cdot y}{1}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.90000000000000007e38 or 3.04999999999999998e34 < z Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites59.3%
if -2.90000000000000007e38 < z < 4.59999999999999978e-281Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.7
Applied rewrites69.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6454.6
Applied rewrites54.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.7
Applied rewrites56.7%
if 4.59999999999999978e-281 < z < 3.04999999999999998e34Initial program 96.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6469.7
Applied rewrites69.7%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6463.6
Applied rewrites63.6%
Taylor expanded in z around 0
Applied rewrites57.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -4.1e+21) (- x (* (/ y t) a)) (if (<= t 1.62e+136) (fma (/ z (- 1.0 z)) a x) (fma (/ (- z y) t) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.1e+21) {
tmp = x - ((y / t) * a);
} else if (t <= 1.62e+136) {
tmp = fma((z / (1.0 - z)), a, x);
} else {
tmp = fma(((z - y) / t), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.1e+21) tmp = Float64(x - Float64(Float64(y / t) * a)); elseif (t <= 1.62e+136) tmp = fma(Float64(z / Float64(1.0 - z)), a, x); else tmp = fma(Float64(Float64(z - y) / t), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.1e+21], N[(x - N[(N[(y / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.62e+136], N[(N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.1 \cdot 10^{+21}:\\
\;\;\;\;x - \frac{y}{t} \cdot a\\
\mathbf{elif}\;t \leq 1.62 \cdot 10^{+136}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\end{array}
\end{array}
if t < -4.1e21Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.7
Applied rewrites69.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6454.6
Applied rewrites54.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.7
Applied rewrites56.7%
if -4.1e21 < t < 1.6200000000000001e136Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in t around 0
lower--.f6479.5
Applied rewrites79.5%
Taylor expanded in y around 0
Applied rewrites66.3%
if 1.6200000000000001e136 < t Initial program 96.9%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
frac-2negN/A
distribute-neg-frac2N/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.8
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6454.2
Applied rewrites54.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.9e+38) (- x a) (if (<= z 7.6e+34) (- x (* (/ y t) a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.9e+38) {
tmp = x - a;
} else if (z <= 7.6e+34) {
tmp = x - ((y / t) * a);
} else {
tmp = x - a;
}
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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-2.9d+38)) then
tmp = x - a
else if (z <= 7.6d+34) then
tmp = x - ((y / t) * a)
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.9e+38) {
tmp = x - a;
} else if (z <= 7.6e+34) {
tmp = x - ((y / t) * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.9e+38: tmp = x - a elif z <= 7.6e+34: tmp = x - ((y / t) * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.9e+38) tmp = Float64(x - a); elseif (z <= 7.6e+34) tmp = Float64(x - Float64(Float64(y / t) * a)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.9e+38) tmp = x - a; elseif (z <= 7.6e+34) tmp = x - ((y / t) * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.9e+38], N[(x - a), $MachinePrecision], If[LessEqual[z, 7.6e+34], N[(x - N[(N[(y / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+38}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+34}:\\
\;\;\;\;x - \frac{y}{t} \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.90000000000000007e38 or 7.6000000000000003e34 < z Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites59.3%
if -2.90000000000000007e38 < z < 7.6000000000000003e34Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.7
Applied rewrites69.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6454.6
Applied rewrites54.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.7
Applied rewrites56.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.3e+37) (- x a) (if (<= z 5e-98) (- x (* (/ a t) y)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+37) {
tmp = x - a;
} else if (z <= 5e-98) {
tmp = x - ((a / t) * y);
} else {
tmp = x - a;
}
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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-2.3d+37)) then
tmp = x - a
else if (z <= 5d-98) then
tmp = x - ((a / t) * y)
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+37) {
tmp = x - a;
} else if (z <= 5e-98) {
tmp = x - ((a / t) * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.3e+37: tmp = x - a elif z <= 5e-98: tmp = x - ((a / t) * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.3e+37) tmp = Float64(x - a); elseif (z <= 5e-98) tmp = Float64(x - Float64(Float64(a / t) * y)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.3e+37) tmp = x - a; elseif (z <= 5e-98) tmp = x - ((a / t) * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.3e+37], N[(x - a), $MachinePrecision], If[LessEqual[z, 5e-98], N[(x - N[(N[(a / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+37}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-98}:\\
\;\;\;\;x - \frac{a}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.30000000000000002e37 or 5.00000000000000018e-98 < z Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites59.3%
if -2.30000000000000002e37 < z < 5.00000000000000018e-98Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6469.7
Applied rewrites69.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6454.6
Applied rewrites54.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6456.4
Applied rewrites56.4%
(FPCore (x y z t a) :precision binary64 (- x a))
double code(double x, double y, double z, double t, double a) {
return x - a;
}
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, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - a
end function
public static double code(double x, double y, double z, double t, double a) {
return x - a;
}
def code(x, y, z, t, a): return x - a
function code(x, y, z, t, a) return Float64(x - a) end
function tmp = code(x, y, z, t, a) tmp = x - a; end
code[x_, y_, z_, t_, a_] := N[(x - a), $MachinePrecision]
\begin{array}{l}
\\
x - a
\end{array}
Initial program 96.9%
Taylor expanded in z around inf
Applied rewrites59.3%
herbie shell --seed 2025143
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))