
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x - y \cdot z}{t - a \cdot z}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x - y \cdot z}{t - a \cdot z}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* a z) t))
(t_2 (- x (* y z)))
(t_3 (- t (* a z)))
(t_4 (/ x t_3))
(t_5 (/ t_2 t_3)))
(if (<= t_5 -1e-113)
(fma (/ y t_1) z t_4)
(if (<= t_5 1e-22)
(/ 1.0 (fma (/ z (- (* y z) x)) a (/ t t_2)))
(if (<= t_5 INFINITY) (fma (/ z t_1) y t_4) (/ y a))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (a * z) - t;
double t_2 = x - (y * z);
double t_3 = t - (a * z);
double t_4 = x / t_3;
double t_5 = t_2 / t_3;
double tmp;
if (t_5 <= -1e-113) {
tmp = fma((y / t_1), z, t_4);
} else if (t_5 <= 1e-22) {
tmp = 1.0 / fma((z / ((y * z) - x)), a, (t / t_2));
} else if (t_5 <= ((double) INFINITY)) {
tmp = fma((z / t_1), y, t_4);
} else {
tmp = y / a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(a * z) - t) t_2 = Float64(x - Float64(y * z)) t_3 = Float64(t - Float64(a * z)) t_4 = Float64(x / t_3) t_5 = Float64(t_2 / t_3) tmp = 0.0 if (t_5 <= -1e-113) tmp = fma(Float64(y / t_1), z, t_4); elseif (t_5 <= 1e-22) tmp = Float64(1.0 / fma(Float64(z / Float64(Float64(y * z) - x)), a, Float64(t / t_2))); elseif (t_5 <= Inf) tmp = fma(Float64(z / t_1), y, t_4); else tmp = Float64(y / a); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a * z), $MachinePrecision] - t), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(x / t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$2 / t$95$3), $MachinePrecision]}, If[LessEqual[t$95$5, -1e-113], N[(N[(y / t$95$1), $MachinePrecision] * z + t$95$4), $MachinePrecision], If[LessEqual[t$95$5, 1e-22], N[(1.0 / N[(N[(z / N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] * a + N[(t / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, Infinity], N[(N[(z / t$95$1), $MachinePrecision] * y + t$95$4), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_1 := a \cdot z - t\\
t_2 := x - y \cdot z\\
t_3 := t - a \cdot z\\
t_4 := \frac{x}{t\_3}\\
t_5 := \frac{t\_2}{t\_3}\\
\mathbf{if}\;t\_5 \leq -1 \cdot 10^{-113}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t\_1}, z, t\_4\right)\\
\mathbf{elif}\;t\_5 \leq 10^{-22}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{z}{y \cdot z - x}, a, \frac{t}{t\_2}\right)}\\
\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t\_1}, y, t\_4\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -9.9999999999999998e-114Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites85.0%
if -9.9999999999999998e-114 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 1e-22Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites85.0%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
frac-2negN/A
lift-*.f64N/A
sub-negate-revN/A
lift--.f64N/A
div-add-revN/A
sub-flipN/A
sub-negate-revN/A
lift--.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
Applied rewrites84.8%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6485.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.7%
Applied rewrites85.7%
if 1e-22 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.1%
if +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 85.2%
Taylor expanded in z around inf
lower-/.f6435.5%
Applied rewrites35.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (+ y (* -1.0 (/ x z))) a)))
(if (<= z -4.1e+229)
t_1
(if (<= z 4.2e+197)
(fma (/ y (- (* a z) t)) z (/ x (- t (* a z))))
t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = (y + (-1.0 * (x / z))) / a;
double tmp;
if (z <= -4.1e+229) {
tmp = t_1;
} else if (z <= 4.2e+197) {
tmp = fma((y / ((a * z) - t)), z, (x / (t - (a * z))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y + Float64(-1.0 * Float64(x / z))) / a) tmp = 0.0 if (z <= -4.1e+229) tmp = t_1; elseif (z <= 4.2e+197) tmp = fma(Float64(y / Float64(Float64(a * z) - t)), z, Float64(x / Float64(t - Float64(a * z)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + N[(-1.0 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -4.1e+229], t$95$1, If[LessEqual[z, 4.2e+197], N[(N[(y / N[(N[(a * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * z + N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{y + -1 \cdot \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{+229}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+197}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a \cdot z - t}, z, \frac{x}{t - a \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -4.1000000000000001e229 or 4.2000000000000001e197 < z Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6451.1%
Applied rewrites51.1%
if -4.1000000000000001e229 < z < 4.2000000000000001e197Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites85.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (/ (- x (* y z)) t_1)))
(if (<= t_2 (- INFINITY))
(fma (/ z (- (* a z) t)) y (/ x t))
(if (<= t_2 4e+256)
(/ (fma (- z) y x) t_1)
(/ (+ y (* -1.0 (/ x z))) a)))))double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x - (y * z)) / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma((z / ((a * z) - t)), y, (x / t));
} else if (t_2 <= 4e+256) {
tmp = fma(-z, y, x) / t_1;
} else {
tmp = (y + (-1.0 * (x / z))) / a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x - Float64(y * z)) / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(Float64(z / Float64(Float64(a * z) - t)), y, Float64(x / t)); elseif (t_2 <= 4e+256) tmp = Float64(fma(Float64(-z), y, x) / t_1); else tmp = Float64(Float64(y + Float64(-1.0 * Float64(x / z))) / a); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(z / N[(N[(a * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * y + N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+256], N[(N[((-z) * y + x), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(y + N[(-1.0 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x - y \cdot z}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a \cdot z - t}, y, \frac{x}{t}\right)\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+256}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, y, x\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + -1 \cdot \frac{x}{z}}{a}\\
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.1%
Taylor expanded in z around 0
Applied rewrites61.7%
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 4.0000000000000001e256Initial program 85.2%
*-lft-identityN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
Applied rewrites85.2%
if 4.0000000000000001e256 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6451.1%
Applied rewrites51.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))))
(if (<= (/ (- x (* y z)) t_1) INFINITY)
(fma (/ z (- (* a z) t)) y (/ x t_1))
(/ y a))))double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double tmp;
if (((x - (y * z)) / t_1) <= ((double) INFINITY)) {
tmp = fma((z / ((a * z) - t)), y, (x / t_1));
} else {
tmp = y / a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) tmp = 0.0 if (Float64(Float64(x - Float64(y * z)) / t_1) <= Inf) tmp = fma(Float64(z / Float64(Float64(a * z) - t)), y, Float64(x / t_1)); else tmp = Float64(y / a); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], Infinity], N[(N[(z / N[(N[(a * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * y + N[(x / t$95$1), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
t_1 := t - a \cdot z\\
\mathbf{if}\;\frac{x - y \cdot z}{t\_1} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a \cdot z - t}, y, \frac{x}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.1%
if +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 85.2%
Taylor expanded in z around inf
lower-/.f6435.5%
Applied rewrites35.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))))
(if (<= (/ (- x (* y z)) t_1) 4e+256)
(/ (fma (- z) y x) t_1)
(/ (+ y (* -1.0 (/ x z))) a))))double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double tmp;
if (((x - (y * z)) / t_1) <= 4e+256) {
tmp = fma(-z, y, x) / t_1;
} else {
tmp = (y + (-1.0 * (x / z))) / a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) tmp = 0.0 if (Float64(Float64(x - Float64(y * z)) / t_1) <= 4e+256) tmp = Float64(fma(Float64(-z), y, x) / t_1); else tmp = Float64(Float64(y + Float64(-1.0 * Float64(x / z))) / a); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], 4e+256], N[(N[((-z) * y + x), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(y + N[(-1.0 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
t_1 := t - a \cdot z\\
\mathbf{if}\;\frac{x - y \cdot z}{t\_1} \leq 4 \cdot 10^{+256}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, y, x\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + -1 \cdot \frac{x}{z}}{a}\\
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 4.0000000000000001e256Initial program 85.2%
*-lft-identityN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
Applied rewrites85.2%
if 4.0000000000000001e256 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6451.1%
Applied rewrites51.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- x (* y z)) (- t (* a z))))) (if (<= t_1 4e+256) t_1 (/ (+ y (* -1.0 (/ x z))) a))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (a * z));
double tmp;
if (t_1 <= 4e+256) {
tmp = t_1;
} else {
tmp = (y + (-1.0 * (x / z))) / 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) :: t_1
real(8) :: tmp
t_1 = (x - (y * z)) / (t - (a * z))
if (t_1 <= 4d+256) then
tmp = t_1
else
tmp = (y + ((-1.0d0) * (x / z))) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (a * z));
double tmp;
if (t_1 <= 4e+256) {
tmp = t_1;
} else {
tmp = (y + (-1.0 * (x / z))) / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (y * z)) / (t - (a * z)) tmp = 0 if t_1 <= 4e+256: tmp = t_1 else: tmp = (y + (-1.0 * (x / z))) / a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) tmp = 0.0 if (t_1 <= 4e+256) tmp = t_1; else tmp = Float64(Float64(y + Float64(-1.0 * Float64(x / z))) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (y * z)) / (t - (a * z)); tmp = 0.0; if (t_1 <= 4e+256) tmp = t_1; else tmp = (y + (-1.0 * (x / z))) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 4e+256], t$95$1, N[(N[(y + N[(-1.0 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
t_1 := \frac{x - y \cdot z}{t - a \cdot z}\\
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{+256}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y + -1 \cdot \frac{x}{z}}{a}\\
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 4.0000000000000001e256Initial program 85.2%
if 4.0000000000000001e256 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6451.1%
Applied rewrites51.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (+ y (* -1.0 (/ x z))) a))) (if (<= z -2.8e+82) t_1 (if (<= z 1.5e+57) (- (/ x t) (* z (/ y t))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y + (-1.0 * (x / z))) / a;
double tmp;
if (z <= -2.8e+82) {
tmp = t_1;
} else if (z <= 1.5e+57) {
tmp = (x / t) - (z * (y / t));
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = (y + ((-1.0d0) * (x / z))) / a
if (z <= (-2.8d+82)) then
tmp = t_1
else if (z <= 1.5d+57) then
tmp = (x / t) - (z * (y / t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y + (-1.0 * (x / z))) / a;
double tmp;
if (z <= -2.8e+82) {
tmp = t_1;
} else if (z <= 1.5e+57) {
tmp = (x / t) - (z * (y / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + (-1.0 * (x / z))) / a tmp = 0 if z <= -2.8e+82: tmp = t_1 elif z <= 1.5e+57: tmp = (x / t) - (z * (y / t)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y + Float64(-1.0 * Float64(x / z))) / a) tmp = 0.0 if (z <= -2.8e+82) tmp = t_1; elseif (z <= 1.5e+57) tmp = Float64(Float64(x / t) - Float64(z * Float64(y / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y + (-1.0 * (x / z))) / a; tmp = 0.0; if (z <= -2.8e+82) tmp = t_1; elseif (z <= 1.5e+57) tmp = (x / t) - (z * (y / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + N[(-1.0 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -2.8e+82], t$95$1, If[LessEqual[z, 1.5e+57], N[(N[(x / t), $MachinePrecision] - N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{y + -1 \cdot \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+57}:\\
\;\;\;\;\frac{x}{t} - z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -2.8e82 or 1.5e57 < z Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6451.1%
Applied rewrites51.1%
if -2.8e82 < z < 1.5e57Initial program 85.2%
Taylor expanded in z around 0
Applied rewrites51.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.4%
Applied rewrites50.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (+ y (* -1.0 (/ x z))) a))) (if (<= z -2.75e+82) t_1 (if (<= z 1.5e+57) (/ (- x (* y z)) t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y + (-1.0 * (x / z))) / a;
double tmp;
if (z <= -2.75e+82) {
tmp = t_1;
} else if (z <= 1.5e+57) {
tmp = (x - (y * z)) / t;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = (y + ((-1.0d0) * (x / z))) / a
if (z <= (-2.75d+82)) then
tmp = t_1
else if (z <= 1.5d+57) then
tmp = (x - (y * z)) / t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y + (-1.0 * (x / z))) / a;
double tmp;
if (z <= -2.75e+82) {
tmp = t_1;
} else if (z <= 1.5e+57) {
tmp = (x - (y * z)) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + (-1.0 * (x / z))) / a tmp = 0 if z <= -2.75e+82: tmp = t_1 elif z <= 1.5e+57: tmp = (x - (y * z)) / t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y + Float64(-1.0 * Float64(x / z))) / a) tmp = 0.0 if (z <= -2.75e+82) tmp = t_1; elseif (z <= 1.5e+57) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y + (-1.0 * (x / z))) / a; tmp = 0.0; if (z <= -2.75e+82) tmp = t_1; elseif (z <= 1.5e+57) tmp = (x - (y * z)) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + N[(-1.0 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -2.75e+82], t$95$1, If[LessEqual[z, 1.5e+57], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{y + -1 \cdot \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -2.75 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+57}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -2.75e82 or 1.5e57 < z Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.1%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6451.1%
Applied rewrites51.1%
if -2.75e82 < z < 1.5e57Initial program 85.2%
Taylor expanded in z around 0
Applied rewrites51.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -8e-18) (/ (fma (- z) y x) t) (if (<= t 1.3e-136) (/ (- (* y z) x) (* a z)) (/ (- x (* y z)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8e-18) {
tmp = fma(-z, y, x) / t;
} else if (t <= 1.3e-136) {
tmp = ((y * z) - x) / (a * z);
} else {
tmp = (x - (y * z)) / t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8e-18) tmp = Float64(fma(Float64(-z), y, x) / t); elseif (t <= 1.3e-136) tmp = Float64(Float64(Float64(y * z) - x) / Float64(a * z)); else tmp = Float64(Float64(x - Float64(y * z)) / t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8e-18], N[(N[((-z) * y + x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 1.3e-136], N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(a * z), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{-18}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, y, x\right)}{t}\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{-136}:\\
\;\;\;\;\frac{y \cdot z - x}{a \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\end{array}
if t < -8.0000000000000006e-18Initial program 85.2%
*-lft-identityN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
Applied rewrites85.2%
Taylor expanded in z around 0
Applied rewrites51.3%
if -8.0000000000000006e-18 < t < 1.3e-136Initial program 85.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites85.0%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
frac-2negN/A
lift-*.f64N/A
sub-negate-revN/A
lift--.f64N/A
div-add-revN/A
sub-flipN/A
sub-negate-revN/A
lift--.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
Applied rewrites84.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6440.5%
Applied rewrites40.5%
if 1.3e-136 < t Initial program 85.2%
Taylor expanded in z around 0
Applied rewrites51.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.5e+130) (/ y a) (if (<= z 2.15e+151) (/ (fma (- z) y x) t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e+130) {
tmp = y / a;
} else if (z <= 2.15e+151) {
tmp = fma(-z, y, x) / t;
} else {
tmp = y / a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.5e+130) tmp = Float64(y / a); elseif (z <= 2.15e+151) tmp = Float64(fma(Float64(-z), y, x) / t); else tmp = Float64(y / a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.5e+130], N[(y / a), $MachinePrecision], If[LessEqual[z, 2.15e+151], N[(N[((-z) * y + x), $MachinePrecision] / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+130}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+151}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, y, x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
if z < -5.4999999999999997e130 or 2.1499999999999999e151 < z Initial program 85.2%
Taylor expanded in z around inf
lower-/.f6435.5%
Applied rewrites35.5%
if -5.4999999999999997e130 < z < 2.1499999999999999e151Initial program 85.2%
*-lft-identityN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
Applied rewrites85.2%
Taylor expanded in z around 0
Applied rewrites51.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.5e+130) (/ y a) (if (<= z 2.15e+151) (/ (- x (* y z)) t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e+130) {
tmp = y / a;
} else if (z <= 2.15e+151) {
tmp = (x - (y * z)) / t;
} else {
tmp = y / 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 <= (-5.5d+130)) then
tmp = y / a
else if (z <= 2.15d+151) then
tmp = (x - (y * z)) / t
else
tmp = y / 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 <= -5.5e+130) {
tmp = y / a;
} else if (z <= 2.15e+151) {
tmp = (x - (y * z)) / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.5e+130: tmp = y / a elif z <= 2.15e+151: tmp = (x - (y * z)) / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.5e+130) tmp = Float64(y / a); elseif (z <= 2.15e+151) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5.5e+130) tmp = y / a; elseif (z <= 2.15e+151) tmp = (x - (y * z)) / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.5e+130], N[(y / a), $MachinePrecision], If[LessEqual[z, 2.15e+151], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+130}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+151}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
if z < -5.4999999999999997e130 or 2.1499999999999999e151 < z Initial program 85.2%
Taylor expanded in z around inf
lower-/.f6435.5%
Applied rewrites35.5%
if -5.4999999999999997e130 < z < 2.1499999999999999e151Initial program 85.2%
Taylor expanded in z around 0
Applied rewrites51.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -9.5e+135) (/ y a) (if (<= z 9.5e+101) (/ x (- t (* a z))) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.5e+135) {
tmp = y / a;
} else if (z <= 9.5e+101) {
tmp = x / (t - (a * z));
} else {
tmp = y / 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 <= (-9.5d+135)) then
tmp = y / a
else if (z <= 9.5d+101) then
tmp = x / (t - (a * z))
else
tmp = y / 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 <= -9.5e+135) {
tmp = y / a;
} else if (z <= 9.5e+101) {
tmp = x / (t - (a * z));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -9.5e+135: tmp = y / a elif z <= 9.5e+101: tmp = x / (t - (a * z)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.5e+135) tmp = Float64(y / a); elseif (z <= 9.5e+101) tmp = Float64(x / Float64(t - Float64(a * z))); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -9.5e+135) tmp = y / a; elseif (z <= 9.5e+101) tmp = x / (t - (a * z)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.5e+135], N[(y / a), $MachinePrecision], If[LessEqual[z, 9.5e+101], N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+135}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+101}:\\
\;\;\;\;\frac{x}{t - a \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
if z < -9.5000000000000004e135 or 9.4999999999999995e101 < z Initial program 85.2%
Taylor expanded in z around inf
lower-/.f6435.5%
Applied rewrites35.5%
if -9.5000000000000004e135 < z < 9.4999999999999995e101Initial program 85.2%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -38.0) (/ y a) (if (<= z 1.8e+57) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -38.0) {
tmp = y / a;
} else if (z <= 1.8e+57) {
tmp = x / t;
} else {
tmp = y / 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 <= (-38.0d0)) then
tmp = y / a
else if (z <= 1.8d+57) then
tmp = x / t
else
tmp = y / 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 <= -38.0) {
tmp = y / a;
} else if (z <= 1.8e+57) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -38.0: tmp = y / a elif z <= 1.8e+57: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -38.0) tmp = Float64(y / a); elseif (z <= 1.8e+57) tmp = Float64(x / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -38.0) tmp = y / a; elseif (z <= 1.8e+57) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -38.0], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.8e+57], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -38:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+57}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
if z < -38 or 1.8000000000000001e57 < z Initial program 85.2%
Taylor expanded in z around inf
lower-/.f6435.5%
Applied rewrites35.5%
if -38 < z < 1.8000000000000001e57Initial program 85.2%
Taylor expanded in z around 0
lower-/.f6435.4%
Applied rewrites35.4%
(FPCore (x y z t a) :precision binary64 (/ x t))
double code(double x, double y, double z, double t, double a) {
return x / t;
}
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 / t
end function
public static double code(double x, double y, double z, double t, double a) {
return x / t;
}
def code(x, y, z, t, a): return x / t
function code(x, y, z, t, a) return Float64(x / t) end
function tmp = code(x, y, z, t, a) tmp = x / t; end
code[x_, y_, z_, t_, a_] := N[(x / t), $MachinePrecision]
\frac{x}{t}
Initial program 85.2%
Taylor expanded in z around 0
lower-/.f6435.4%
Applied rewrites35.4%
herbie shell --seed 2025205
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
(/ (- x (* y z)) (- t (* a z))))