
(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(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.7
Applied rewrites99.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= t -9.2e+113)
t_1
(if (<= t 5e+86) (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 <= -9.2e+113) {
tmp = t_1;
} else if (t <= 5e+86) {
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 <= -9.2e+113) tmp = t_1; elseif (t <= 5e+86) 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, -9.2e+113], t$95$1, If[LessEqual[t, 5e+86], 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 -9.2 \cdot 10^{+113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.19999999999999987e113 or 4.9999999999999998e86 < t Initial program 96.3%
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--.f6488.4
Applied rewrites88.4%
if -9.19999999999999987e113 < t < 4.9999999999999998e86Initial 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--.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
lower--.f6492.3
Applied rewrites92.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -72000000000000.0)
(fma (/ z (- t (- z 1.0))) a x)
(if (<= z 25000.0)
(- x (* a (/ y (+ 1.0 t))))
(fma (/ (- z y) (- z)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -72000000000000.0) {
tmp = fma((z / (t - (z - 1.0))), a, x);
} else if (z <= 25000.0) {
tmp = x - (a * (y / (1.0 + t)));
} else {
tmp = fma(((z - y) / -z), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -72000000000000.0) tmp = fma(Float64(z / Float64(t - Float64(z - 1.0))), a, x); elseif (z <= 25000.0) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 + t)))); else tmp = fma(Float64(Float64(z - y) / Float64(-z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -72000000000000.0], N[(N[(z / N[(t - N[(z - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 25000.0], N[(x - N[(a * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / (-z)), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -72000000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t - \left(z - 1\right)}, a, x\right)\\
\mathbf{elif}\;z \leq 25000:\\
\;\;\;\;x - a \cdot \frac{y}{1 + t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{-z}, a, x\right)\\
\end{array}
\end{array}
if z < -7.2e13Initial 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.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites85.5%
if -7.2e13 < z < 25000Initial program 99.1%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6491.8
Applied rewrites91.8%
if 25000 < z Initial program 94.9%
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--.f6485.7
Applied rewrites85.7%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6485.4
Applied rewrites85.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -72000000000000.0)
(fma (/ z (- t z)) a x)
(if (<= z 25000.0)
(- x (* a (/ y (+ 1.0 t))))
(fma (/ (- z y) (- z)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -72000000000000.0) {
tmp = fma((z / (t - z)), a, x);
} else if (z <= 25000.0) {
tmp = x - (a * (y / (1.0 + t)));
} else {
tmp = fma(((z - y) / -z), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -72000000000000.0) tmp = fma(Float64(z / Float64(t - z)), a, x); elseif (z <= 25000.0) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 + t)))); else tmp = fma(Float64(Float64(z - y) / Float64(-z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -72000000000000.0], N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 25000.0], N[(x - N[(a * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / (-z)), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -72000000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t - z}, a, x\right)\\
\mathbf{elif}\;z \leq 25000:\\
\;\;\;\;x - a \cdot \frac{y}{1 + t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{-z}, a, x\right)\\
\end{array}
\end{array}
if z < -7.2e13Initial 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.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites85.5%
Taylor expanded in z around inf
Applied rewrites85.5%
if -7.2e13 < z < 25000Initial program 99.1%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6491.8
Applied rewrites91.8%
if 25000 < z Initial program 94.9%
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--.f6485.7
Applied rewrites85.7%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6485.4
Applied rewrites85.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- t z)) a x)))
(if (<= z -72000000000000.0)
t_1
(if (<= z 15.5) (- 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 <= -72000000000000.0) {
tmp = t_1;
} else if (z <= 15.5) {
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 <= -72000000000000.0) tmp = t_1; elseif (z <= 15.5) 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, -72000000000000.0], t$95$1, If[LessEqual[z, 15.5], 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 -72000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 15.5:\\
\;\;\;\;x - a \cdot \frac{y}{1 + t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.2e13 or 15.5 < z Initial program 95.3%
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 rewrites85.2%
Taylor expanded in z around inf
Applied rewrites85.0%
if -7.2e13 < z < 15.5Initial program 99.1%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6492.0
Applied rewrites92.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- t z)) a x)))
(if (<= z -0.0055)
t_1
(if (<= z 5.7e-129)
(fma (/ (- z y) 1.0) a x)
(if (<= z 15.5) (- x (* a (/ y 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 <= -0.0055) {
tmp = t_1;
} else if (z <= 5.7e-129) {
tmp = fma(((z - y) / 1.0), a, x);
} else if (z <= 15.5) {
tmp = x - (a * (y / 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 <= -0.0055) tmp = t_1; elseif (z <= 5.7e-129) tmp = fma(Float64(Float64(z - y) / 1.0), a, x); elseif (z <= 15.5) tmp = Float64(x - Float64(a * Float64(y / 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, -0.0055], t$95$1, If[LessEqual[z, 5.7e-129], N[(N[(N[(z - y), $MachinePrecision] / 1.0), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 15.5], N[(x - N[(a * N[(y / t), $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 -0.0055:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-129}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1}, a, x\right)\\
\mathbf{elif}\;z \leq 15.5:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.0054999999999999997 or 15.5 < z Initial program 95.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 y around 0
Applied rewrites85.0%
Taylor expanded in z around inf
Applied rewrites84.7%
if -0.0054999999999999997 < z < 5.7000000000000001e-129Initial program 99.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.3
Applied rewrites99.3%
Taylor expanded in t around 0
lower--.f6475.1
Applied rewrites75.1%
Taylor expanded in z around 0
Applied rewrites74.9%
if 5.7000000000000001e-129 < z < 15.5Initial program 99.1%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6487.6
Applied rewrites87.6%
Taylor expanded in t around inf
Applied rewrites64.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* a (/ y t)))) (t_2 (fma (/ z (- t z)) a x)))
(if (<= z -4.1e-36)
t_2
(if (<= z 2.45e-293)
t_1
(if (<= z 5.7e-129) (- x (* a y)) (if (<= z 15.5) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (a * (y / t));
double t_2 = fma((z / (t - z)), a, x);
double tmp;
if (z <= -4.1e-36) {
tmp = t_2;
} else if (z <= 2.45e-293) {
tmp = t_1;
} else if (z <= 5.7e-129) {
tmp = x - (a * y);
} else if (z <= 15.5) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(a * Float64(y / t))) t_2 = fma(Float64(z / Float64(t - z)), a, x) tmp = 0.0 if (z <= -4.1e-36) tmp = t_2; elseif (z <= 2.45e-293) tmp = t_1; elseif (z <= 5.7e-129) tmp = Float64(x - Float64(a * y)); elseif (z <= 15.5) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -4.1e-36], t$95$2, If[LessEqual[z, 2.45e-293], t$95$1, If[LessEqual[z, 5.7e-129], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 15.5], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - a \cdot \frac{y}{t}\\
t_2 := \mathsf{fma}\left(\frac{z}{t - z}, a, x\right)\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{-36}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{-293}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-129}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;z \leq 15.5:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -4.10000000000000013e-36 or 15.5 < z Initial program 95.5%
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.1%
Taylor expanded in z around inf
Applied rewrites83.2%
if -4.10000000000000013e-36 < z < 2.45e-293 or 5.7000000000000001e-129 < z < 15.5Initial program 99.2%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6492.4
Applied rewrites92.4%
Taylor expanded in t around inf
Applied rewrites66.1%
if 2.45e-293 < z < 5.7000000000000001e-129Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6495.7
Applied rewrites95.7%
Taylor expanded in t around 0
Applied rewrites75.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= t -7600000000000.0)
t_1
(if (<= t -1.15e-55)
(- x (* a y))
(if (<= t 8.8e+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 <= -7600000000000.0) {
tmp = t_1;
} else if (t <= -1.15e-55) {
tmp = x - (a * y);
} else if (t <= 8.8e+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 <= -7600000000000.0) tmp = t_1; elseif (t <= -1.15e-55) tmp = Float64(x - Float64(a * y)); elseif (t <= 8.8e+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, -7600000000000.0], t$95$1, If[LessEqual[t, -1.15e-55], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.8e+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 -7600000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.15 \cdot 10^{-55}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;t \leq 8.8 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.6e12 or 8.80000000000000013e86 < t Initial program 96.5%
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--.f6485.0
Applied rewrites85.0%
if -7.6e12 < t < -1.15000000000000006e-55Initial program 97.5%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6469.2
Applied rewrites69.2%
Taylor expanded in t around 0
Applied rewrites62.6%
if -1.15000000000000006e-55 < t < 8.80000000000000013e86Initial program 97.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.9
Applied rewrites99.9%
Taylor expanded in t around 0
lower--.f6495.9
Applied rewrites95.9%
Taylor expanded in y around 0
Applied rewrites68.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.1e+54)
(- x a)
(if (<= z -5.6e-36)
(- x (/ (* (- z) a) t))
(if (<= z 2.45e-293)
(- x (* a (/ y t)))
(if (<= z 5.7e-129)
(- x (* a y))
(if (<= z 9.6e+58) (- x (/ y (/ t a))) (- x a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.1e+54) {
tmp = x - a;
} else if (z <= -5.6e-36) {
tmp = x - ((-z * a) / t);
} else if (z <= 2.45e-293) {
tmp = x - (a * (y / t));
} else if (z <= 5.7e-129) {
tmp = x - (a * y);
} else if (z <= 9.6e+58) {
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 <= (-4.1d+54)) then
tmp = x - a
else if (z <= (-5.6d-36)) then
tmp = x - ((-z * a) / t)
else if (z <= 2.45d-293) then
tmp = x - (a * (y / t))
else if (z <= 5.7d-129) then
tmp = x - (a * y)
else if (z <= 9.6d+58) 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 <= -4.1e+54) {
tmp = x - a;
} else if (z <= -5.6e-36) {
tmp = x - ((-z * a) / t);
} else if (z <= 2.45e-293) {
tmp = x - (a * (y / t));
} else if (z <= 5.7e-129) {
tmp = x - (a * y);
} else if (z <= 9.6e+58) {
tmp = x - (y / (t / a));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.1e+54: tmp = x - a elif z <= -5.6e-36: tmp = x - ((-z * a) / t) elif z <= 2.45e-293: tmp = x - (a * (y / t)) elif z <= 5.7e-129: tmp = x - (a * y) elif z <= 9.6e+58: tmp = x - (y / (t / a)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.1e+54) tmp = Float64(x - a); elseif (z <= -5.6e-36) tmp = Float64(x - Float64(Float64(Float64(-z) * a) / t)); elseif (z <= 2.45e-293) tmp = Float64(x - Float64(a * Float64(y / t))); elseif (z <= 5.7e-129) tmp = Float64(x - Float64(a * y)); elseif (z <= 9.6e+58) tmp = Float64(x - Float64(y / Float64(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 <= -4.1e+54) tmp = x - a; elseif (z <= -5.6e-36) tmp = x - ((-z * a) / t); elseif (z <= 2.45e-293) tmp = x - (a * (y / t)); elseif (z <= 5.7e-129) tmp = x - (a * y); elseif (z <= 9.6e+58) tmp = x - (y / (t / a)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.1e+54], N[(x - a), $MachinePrecision], If[LessEqual[z, -5.6e-36], N[(x - N[(N[((-z) * a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.45e-293], N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.7e-129], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.6e+58], N[(x - N[(y / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+54}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-36}:\\
\;\;\;\;x - \frac{\left(-z\right) \cdot a}{t}\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{-293}:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-129}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{+58}:\\
\;\;\;\;x - \frac{y}{\frac{t}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.09999999999999967e54 or 9.5999999999999999e58 < z Initial program 94.5%
Taylor expanded in z around inf
Applied rewrites79.5%
if -4.09999999999999967e54 < z < -5.6000000000000002e-36Initial program 98.6%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6459.5
Applied rewrites59.5%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6453.4
Applied rewrites53.4%
if -5.6000000000000002e-36 < z < 2.45e-293Initial program 99.2%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6494.6
Applied rewrites94.6%
Taylor expanded in t around inf
Applied rewrites67.0%
if 2.45e-293 < z < 5.7000000000000001e-129Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6495.7
Applied rewrites95.7%
Taylor expanded in t around 0
Applied rewrites75.3%
if 5.7000000000000001e-129 < z < 9.5999999999999999e58Initial program 99.0%
Taylor expanded in t around inf
Applied rewrites62.7%
Taylor expanded in y around inf
Applied rewrites60.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -9.8e+54)
(- x a)
(if (<= z -5.6e-36)
(fma (/ z t) a x)
(if (<= z 2.45e-293)
(- x (* a (/ y t)))
(if (<= z 5.7e-129)
(- x (* a y))
(if (<= z 9.6e+58) (- x (/ y (/ t a))) (- x a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.8e+54) {
tmp = x - a;
} else if (z <= -5.6e-36) {
tmp = fma((z / t), a, x);
} else if (z <= 2.45e-293) {
tmp = x - (a * (y / t));
} else if (z <= 5.7e-129) {
tmp = x - (a * y);
} else if (z <= 9.6e+58) {
tmp = x - (y / (t / a));
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.8e+54) tmp = Float64(x - a); elseif (z <= -5.6e-36) tmp = fma(Float64(z / t), a, x); elseif (z <= 2.45e-293) tmp = Float64(x - Float64(a * Float64(y / t))); elseif (z <= 5.7e-129) tmp = Float64(x - Float64(a * y)); elseif (z <= 9.6e+58) tmp = Float64(x - Float64(y / Float64(t / a))); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.8e+54], N[(x - a), $MachinePrecision], If[LessEqual[z, -5.6e-36], N[(N[(z / t), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 2.45e-293], N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.7e-129], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.6e+58], N[(x - N[(y / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.8 \cdot 10^{+54}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-36}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, a, x\right)\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{-293}:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-129}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{+58}:\\
\;\;\;\;x - \frac{y}{\frac{t}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.80000000000000002e54 or 9.5999999999999999e58 < z Initial program 94.5%
Taylor expanded in z around inf
Applied rewrites79.5%
if -9.80000000000000002e54 < z < -5.6000000000000002e-36Initial program 98.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.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites72.6%
Taylor expanded in t around inf
Applied rewrites53.6%
if -5.6000000000000002e-36 < z < 2.45e-293Initial program 99.2%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6494.6
Applied rewrites94.6%
Taylor expanded in t around inf
Applied rewrites67.0%
if 2.45e-293 < z < 5.7000000000000001e-129Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6495.7
Applied rewrites95.7%
Taylor expanded in t around 0
Applied rewrites75.3%
if 5.7000000000000001e-129 < z < 9.5999999999999999e58Initial program 99.0%
Taylor expanded in t around inf
Applied rewrites62.7%
Taylor expanded in y around inf
Applied rewrites60.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* a (/ y t)))))
(if (<= z -9.8e+54)
(- x a)
(if (<= z -5.6e-36)
(fma (/ z t) a x)
(if (<= z 2.45e-293)
t_1
(if (<= z 5.7e-129) (- x (* a y)) (if (<= z 8e+60) t_1 (- x a))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (a * (y / t));
double tmp;
if (z <= -9.8e+54) {
tmp = x - a;
} else if (z <= -5.6e-36) {
tmp = fma((z / t), a, x);
} else if (z <= 2.45e-293) {
tmp = t_1;
} else if (z <= 5.7e-129) {
tmp = x - (a * y);
} else if (z <= 8e+60) {
tmp = t_1;
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(a * Float64(y / t))) tmp = 0.0 if (z <= -9.8e+54) tmp = Float64(x - a); elseif (z <= -5.6e-36) tmp = fma(Float64(z / t), a, x); elseif (z <= 2.45e-293) tmp = t_1; elseif (z <= 5.7e-129) tmp = Float64(x - Float64(a * y)); elseif (z <= 8e+60) tmp = t_1; else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.8e+54], N[(x - a), $MachinePrecision], If[LessEqual[z, -5.6e-36], N[(N[(z / t), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 2.45e-293], t$95$1, If[LessEqual[z, 5.7e-129], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e+60], t$95$1, N[(x - a), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - a \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -9.8 \cdot 10^{+54}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-36}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, a, x\right)\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{-293}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-129}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+60}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.80000000000000002e54 or 7.9999999999999996e60 < z Initial program 94.5%
Taylor expanded in z around inf
Applied rewrites79.5%
if -9.80000000000000002e54 < z < -5.6000000000000002e-36Initial program 98.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.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites72.6%
Taylor expanded in t around inf
Applied rewrites53.6%
if -5.6000000000000002e-36 < z < 2.45e-293 or 5.7000000000000001e-129 < z < 7.9999999999999996e60Initial program 99.1%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6487.9
Applied rewrites87.9%
Taylor expanded in t around inf
Applied rewrites64.6%
if 2.45e-293 < z < 5.7000000000000001e-129Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6495.7
Applied rewrites95.7%
Taylor expanded in t around 0
Applied rewrites75.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= z -3.55e+53)
(- x a)
(if (<= z 2.45e-293)
t_1
(if (<= z 5.7e-129) (- x (* a y)) (if (<= z 8.6e+60) t_1 (- x a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / t), a, x);
double tmp;
if (z <= -3.55e+53) {
tmp = x - a;
} else if (z <= 2.45e-293) {
tmp = t_1;
} else if (z <= 5.7e-129) {
tmp = x - (a * y);
} else if (z <= 8.6e+60) {
tmp = t_1;
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / t), a, x) tmp = 0.0 if (z <= -3.55e+53) tmp = Float64(x - a); elseif (z <= 2.45e-293) tmp = t_1; elseif (z <= 5.7e-129) tmp = Float64(x - Float64(a * y)); elseif (z <= 8.6e+60) tmp = t_1; else tmp = Float64(x - a); 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[z, -3.55e+53], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.45e-293], t$95$1, If[LessEqual[z, 5.7e-129], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.6e+60], t$95$1, N[(x - a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{if}\;z \leq -3.55 \cdot 10^{+53}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{-293}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-129}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+60}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.54999999999999987e53 or 8.59999999999999942e60 < z Initial program 94.6%
Taylor expanded in z around inf
Applied rewrites79.5%
if -3.54999999999999987e53 < z < 2.45e-293 or 5.7000000000000001e-129 < z < 8.59999999999999942e60Initial 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.6
Applied rewrites99.6%
Taylor expanded in t around inf
lower-/.f64N/A
lift--.f6465.1
Applied rewrites65.1%
if 2.45e-293 < z < 5.7000000000000001e-129Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6495.7
Applied rewrites95.7%
Taylor expanded in t around 0
Applied rewrites75.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -1900000.0) (- x a) (if (<= z 2.4e+54) (- x (* a y)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1900000.0) {
tmp = x - a;
} else if (z <= 2.4e+54) {
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 <= (-1900000.0d0)) then
tmp = x - a
else if (z <= 2.4d+54) 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 <= -1900000.0) {
tmp = x - a;
} else if (z <= 2.4e+54) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1900000.0: tmp = x - a elif z <= 2.4e+54: tmp = x - (a * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1900000.0) tmp = Float64(x - a); elseif (z <= 2.4e+54) 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 <= -1900000.0) tmp = x - a; elseif (z <= 2.4e+54) tmp = x - (a * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1900000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.4e+54], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1900000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+54}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.9e6 or 2.39999999999999998e54 < z Initial program 94.9%
Taylor expanded in z around inf
Applied rewrites77.2%
if -1.9e6 < z < 2.39999999999999998e54Initial program 99.1%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6489.5
Applied rewrites89.5%
Taylor expanded in t around 0
Applied rewrites68.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -28000000000000.0) (- x a) (if (<= z 6.1e+85) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -28000000000000.0) {
tmp = x - a;
} else if (z <= 6.1e+85) {
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 <= (-28000000000000.0d0)) then
tmp = x - a
else if (z <= 6.1d+85) 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 <= -28000000000000.0) {
tmp = x - a;
} else if (z <= 6.1e+85) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -28000000000000.0: tmp = x - a elif z <= 6.1e+85: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -28000000000000.0) tmp = Float64(x - a); elseif (z <= 6.1e+85) 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 <= -28000000000000.0) tmp = x - a; elseif (z <= 6.1e+85) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -28000000000000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 6.1e+85], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -28000000000000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 6.1 \cdot 10^{+85}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.8e13 or 6.09999999999999981e85 < z Initial program 94.7%
Taylor expanded in z around inf
Applied rewrites78.3%
if -2.8e13 < z < 6.09999999999999981e85Initial program 99.0%
Taylor expanded in x around inf
Applied rewrites55.5%
(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.2%
herbie shell --seed 2025119
(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))))