
(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 13 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(t - Float64(z - 1.0))), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(t - N[(z - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - y}{t - \left(z - 1\right)}, a, x\right)
\end{array}
Initial program 97.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.6
Applied rewrites99.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= t -3.5e+19)
t_1
(if (<= t 4.2e+105) (fma (/ (- z y) (- 1.0 z)) a x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / t), a, x);
double tmp;
if (t <= -3.5e+19) {
tmp = t_1;
} else if (t <= 4.2e+105) {
tmp = fma(((z - y) / (1.0 - z)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / t), a, x) tmp = 0.0 if (t <= -3.5e+19) tmp = t_1; elseif (t <= 4.2e+105) tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[t, -3.5e+19], t$95$1, If[LessEqual[t, 4.2e+105], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{if}\;t \leq -3.5 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.2 \cdot 10^{+105}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.5e19 or 4.2000000000000002e105 < t Initial program 96.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.2
Applied rewrites99.2%
Taylor expanded in t around inf
lower-/.f64N/A
lift--.f6486.1
Applied rewrites86.1%
if -3.5e19 < t < 4.2000000000000002e105Initial program 97.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
lower--.f6495.2
Applied rewrites95.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.2e+49)
(- x (/ (- y z) (/ (- z) a)))
(if (<= z 6e-18)
(- x (* a (/ y (+ 1.0 t))))
(fma (/ z (- t (- z 1.0))) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.2e+49) {
tmp = x - ((y - z) / (-z / a));
} else if (z <= 6e-18) {
tmp = x - (a * (y / (1.0 + t)));
} else {
tmp = fma((z / (t - (z - 1.0))), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.2e+49) tmp = Float64(x - Float64(Float64(y - z) / Float64(Float64(-z) / a))); elseif (z <= 6e-18) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 + t)))); else tmp = fma(Float64(z / Float64(t - Float64(z - 1.0))), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.2e+49], N[(x - N[(N[(y - z), $MachinePrecision] / N[((-z) / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e-18], N[(x - N[(a * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(t - N[(z - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+49}:\\
\;\;\;\;x - \frac{y - z}{\frac{-z}{a}}\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-18}:\\
\;\;\;\;x - a \cdot \frac{y}{1 + t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t - \left(z - 1\right)}, a, x\right)\\
\end{array}
\end{array}
if z < -3.20000000000000014e49Initial program 94.2%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6484.2
Applied rewrites84.2%
if -3.20000000000000014e49 < z < 5.99999999999999966e-18Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6490.6
Applied rewrites90.6%
if 5.99999999999999966e-18 < z Initial program 95.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites83.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.2e+49) (- x (/ (- y z) (/ (- z) a))) (if (<= z 1.62e-37) (- x (* a (/ y (+ 1.0 t)))) (fma (/ z (- t z)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.2e+49) {
tmp = x - ((y - z) / (-z / a));
} else if (z <= 1.62e-37) {
tmp = x - (a * (y / (1.0 + t)));
} else {
tmp = fma((z / (t - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.2e+49) tmp = Float64(x - Float64(Float64(y - z) / Float64(Float64(-z) / a))); elseif (z <= 1.62e-37) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 + t)))); else tmp = fma(Float64(z / Float64(t - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.2e+49], N[(x - N[(N[(y - z), $MachinePrecision] / N[((-z) / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.62e-37], N[(x - N[(a * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+49}:\\
\;\;\;\;x - \frac{y - z}{\frac{-z}{a}}\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{-37}:\\
\;\;\;\;x - a \cdot \frac{y}{1 + t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t - z}, a, x\right)\\
\end{array}
\end{array}
if z < -3.20000000000000014e49Initial program 94.2%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6484.2
Applied rewrites84.2%
if -3.20000000000000014e49 < z < 1.6199999999999999e-37Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6490.9
Applied rewrites90.9%
if 1.6199999999999999e-37 < z Initial program 96.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites82.6%
Taylor expanded in z around inf
Applied rewrites80.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- t z)) a x)))
(if (<= z -3.2e+49)
t_1
(if (<= z 1.62e-37) (- x (* a (/ y (+ 1.0 t)))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / (t - z)), a, x);
double tmp;
if (z <= -3.2e+49) {
tmp = t_1;
} else if (z <= 1.62e-37) {
tmp = x - (a * (y / (1.0 + t)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / Float64(t - z)), a, x) tmp = 0.0 if (z <= -3.2e+49) tmp = t_1; elseif (z <= 1.62e-37) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 + t)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -3.2e+49], t$95$1, If[LessEqual[z, 1.62e-37], N[(x - N[(a * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{t - z}, a, x\right)\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{-37}:\\
\;\;\;\;x - a \cdot \frac{y}{1 + t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.20000000000000014e49 or 1.6199999999999999e-37 < z Initial program 95.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites84.5%
Taylor expanded in z around inf
Applied rewrites83.5%
if -3.20000000000000014e49 < z < 1.6199999999999999e-37Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6490.9
Applied rewrites90.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- t z)) a x)))
(if (<= z -3.2e+49)
t_1
(if (<= z -3.3e-237)
(fma (/ (- z y) t) a x)
(if (<= z 4.6e-115) (- x (* a y)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / (t - z)), a, x);
double tmp;
if (z <= -3.2e+49) {
tmp = t_1;
} else if (z <= -3.3e-237) {
tmp = fma(((z - y) / t), a, x);
} else if (z <= 4.6e-115) {
tmp = x - (a * y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / Float64(t - z)), a, x) tmp = 0.0 if (z <= -3.2e+49) tmp = t_1; elseif (z <= -3.3e-237) tmp = fma(Float64(Float64(z - y) / t), a, x); elseif (z <= 4.6e-115) tmp = Float64(x - Float64(a * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -3.2e+49], t$95$1, If[LessEqual[z, -3.3e-237], N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 4.6e-115], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{t - z}, a, x\right)\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{-237}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-115}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.20000000000000014e49 or 4.59999999999999969e-115 < z Initial program 95.6%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites81.7%
Taylor expanded in z around inf
Applied rewrites79.7%
if -3.20000000000000014e49 < z < -3.3000000000000001e-237Initial program 99.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.5
Applied rewrites99.5%
Taylor expanded in t around inf
lower-/.f64N/A
lift--.f6465.8
Applied rewrites65.8%
if -3.3000000000000001e-237 < z < 4.59999999999999969e-115Initial program 99.2%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6496.8
Applied rewrites96.8%
Taylor expanded in t around 0
Applied rewrites74.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= t -3.15e+19)
t_1
(if (<= t -4e-155)
(- x (* a y))
(if (<= t 3e-86) (fma (/ z (- 1.0 z)) a x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / t), a, x);
double tmp;
if (t <= -3.15e+19) {
tmp = t_1;
} else if (t <= -4e-155) {
tmp = x - (a * y);
} else if (t <= 3e-86) {
tmp = fma((z / (1.0 - z)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / t), a, x) tmp = 0.0 if (t <= -3.15e+19) tmp = t_1; elseif (t <= -4e-155) tmp = Float64(x - Float64(a * y)); elseif (t <= 3e-86) tmp = fma(Float64(z / Float64(1.0 - z)), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[t, -3.15e+19], t$95$1, If[LessEqual[t, -4e-155], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3e-86], N[(N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{if}\;t \leq -3.15 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -4 \cdot 10^{-155}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;t \leq 3 \cdot 10^{-86}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.15e19 or 3.0000000000000001e-86 < t Initial program 96.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.4
Applied rewrites99.4%
Taylor expanded in t around inf
lower-/.f64N/A
lift--.f6477.5
Applied rewrites77.5%
if -3.15e19 < t < -4.00000000000000006e-155Initial program 97.6%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6467.8
Applied rewrites67.8%
Taylor expanded in t around 0
Applied rewrites64.3%
if -4.00000000000000006e-155 < t < 3.0000000000000001e-86Initial program 97.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites68.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= t -3.15e+19)
t_1
(if (<= t 2.2e-155)
(- x (* a y))
(if (<= t 1.95e-19) (- x (* (/ y (- z)) a)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / t), a, x);
double tmp;
if (t <= -3.15e+19) {
tmp = t_1;
} else if (t <= 2.2e-155) {
tmp = x - (a * y);
} else if (t <= 1.95e-19) {
tmp = x - ((y / -z) * a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / t), a, x) tmp = 0.0 if (t <= -3.15e+19) tmp = t_1; elseif (t <= 2.2e-155) tmp = Float64(x - Float64(a * y)); elseif (t <= 1.95e-19) tmp = Float64(x - Float64(Float64(y / Float64(-z)) * 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] / t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[t, -3.15e+19], t$95$1, If[LessEqual[t, 2.2e-155], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.95e-19], N[(x - N[(N[(y / (-z)), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{if}\;t \leq -3.15 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{-155}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{-19}:\\
\;\;\;\;x - \frac{y}{-z} \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.15e19 or 1.94999999999999998e-19 < t Initial program 96.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.3
Applied rewrites99.3%
Taylor expanded in t around inf
lower-/.f64N/A
lift--.f6481.9
Applied rewrites81.9%
if -3.15e19 < t < 2.1999999999999999e-155Initial program 97.7%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6467.3
Applied rewrites67.3%
Taylor expanded in t around 0
Applied rewrites66.0%
if 2.1999999999999999e-155 < t < 1.94999999999999998e-19Initial program 97.3%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6463.0
Applied rewrites63.0%
Taylor expanded in y around inf
Applied rewrites46.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6447.3
associate-+l-47.3
Applied rewrites47.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.2e+49)
(- x a)
(if (<= z -7.2e-260)
(- x (* a (/ y t)))
(if (<= z 5e-18)
(- x (* a y))
(if (<= z 3.2e+118) (fma (/ z t) a x) (- x a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.2e+49) {
tmp = x - a;
} else if (z <= -7.2e-260) {
tmp = x - (a * (y / t));
} else if (z <= 5e-18) {
tmp = x - (a * y);
} else if (z <= 3.2e+118) {
tmp = fma((z / t), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.2e+49) tmp = Float64(x - a); elseif (z <= -7.2e-260) tmp = Float64(x - Float64(a * Float64(y / t))); elseif (z <= 5e-18) tmp = Float64(x - Float64(a * y)); elseif (z <= 3.2e+118) tmp = fma(Float64(z / t), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.2e+49], N[(x - a), $MachinePrecision], If[LessEqual[z, -7.2e-260], N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e-18], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e+118], N[(N[(z / t), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+49}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -7.2 \cdot 10^{-260}:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-18}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+118}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.20000000000000014e49 or 3.20000000000000016e118 < z Initial program 94.2%
Taylor expanded in z around inf
Applied rewrites81.1%
if -3.20000000000000014e49 < z < -7.2000000000000002e-260Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6487.7
Applied rewrites87.7%
Taylor expanded in t around inf
Applied rewrites64.4%
if -7.2000000000000002e-260 < z < 5.00000000000000036e-18Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6493.4
Applied rewrites93.4%
Taylor expanded in t around 0
Applied rewrites72.2%
if 5.00000000000000036e-18 < z < 3.20000000000000016e118Initial program 98.1%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in t around inf
lower-/.f64N/A
lift--.f6454.7
Applied rewrites54.7%
Taylor expanded in y around 0
Applied rewrites48.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -28500000.0)
(- x a)
(if (<= z 5e-18)
(- x (* a y))
(if (<= z 3.2e+118) (fma (/ z t) a x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -28500000.0) {
tmp = x - a;
} else if (z <= 5e-18) {
tmp = x - (a * y);
} else if (z <= 3.2e+118) {
tmp = fma((z / t), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -28500000.0) tmp = Float64(x - a); elseif (z <= 5e-18) tmp = Float64(x - Float64(a * y)); elseif (z <= 3.2e+118) tmp = fma(Float64(z / t), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -28500000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 5e-18], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e+118], N[(N[(z / t), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -28500000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-18}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+118}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.85e7 or 3.20000000000000016e118 < z Initial program 94.5%
Taylor expanded in z around inf
Applied rewrites79.1%
if -2.85e7 < z < 5.00000000000000036e-18Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6492.6
Applied rewrites92.6%
Taylor expanded in t around 0
Applied rewrites71.5%
if 5.00000000000000036e-18 < z < 3.20000000000000016e118Initial program 98.1%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in t around inf
lower-/.f64N/A
lift--.f6454.7
Applied rewrites54.7%
Taylor expanded in y around 0
Applied rewrites48.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -28500000.0) (- x a) (if (<= z 6.4e+63) (- x (* a y)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -28500000.0) {
tmp = x - a;
} else if (z <= 6.4e+63) {
tmp = x - (a * 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 <= (-28500000.0d0)) then
tmp = x - a
else if (z <= 6.4d+63) then
tmp = x - (a * 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 <= -28500000.0) {
tmp = x - a;
} else if (z <= 6.4e+63) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -28500000.0: tmp = x - a elif z <= 6.4e+63: tmp = x - (a * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -28500000.0) tmp = Float64(x - a); elseif (z <= 6.4e+63) tmp = Float64(x - Float64(a * y)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -28500000.0) tmp = x - a; elseif (z <= 6.4e+63) tmp = x - (a * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -28500000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 6.4e+63], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -28500000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+63}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.85e7 or 6.40000000000000022e63 < z Initial program 94.8%
Taylor expanded in z around inf
Applied rewrites77.9%
if -2.85e7 < z < 6.40000000000000022e63Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6489.4
Applied rewrites89.4%
Taylor expanded in t around 0
Applied rewrites68.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -49000000.0) (- x a) (if (<= z 7.5e+63) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -49000000.0) {
tmp = x - a;
} else if (z <= 7.5e+63) {
tmp = x;
} 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 <= (-49000000.0d0)) then
tmp = x - a
else if (z <= 7.5d+63) then
tmp = x
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 <= -49000000.0) {
tmp = x - a;
} else if (z <= 7.5e+63) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -49000000.0: tmp = x - a elif z <= 7.5e+63: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -49000000.0) tmp = Float64(x - a); elseif (z <= 7.5e+63) tmp = x; else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -49000000.0) tmp = x - a; elseif (z <= 7.5e+63) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -49000000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 7.5e+63], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -49000000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+63}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.9e7 or 7.5000000000000005e63 < z Initial program 94.8%
Taylor expanded in z around inf
Applied rewrites77.9%
if -4.9e7 < z < 7.5000000000000005e63Initial program 99.0%
Taylor expanded in x around inf
Applied rewrites56.1%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
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, 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
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 97.2%
Taylor expanded in x around inf
Applied rewrites53.7%
herbie shell --seed 2025120
(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))))