
(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]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
Herbie found 10 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]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* y z)))
(t_2 (- t (* a z)))
(t_3 (fma (/ z (- (* a z) t)) y (/ x t_2)))
(t_4 (/ t_1 t_2)))
(if (<= t_4 -5e-79)
t_3
(if (<= t_4 2e-48)
(/ 1.0 (fma (/ z (- (* y z) x)) a (/ t t_1)))
(if (<= t_4 INFINITY) t_3 (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * z);
double t_2 = t - (a * z);
double t_3 = fma((z / ((a * z) - t)), y, (x / t_2));
double t_4 = t_1 / t_2;
double tmp;
if (t_4 <= -5e-79) {
tmp = t_3;
} else if (t_4 <= 2e-48) {
tmp = 1.0 / fma((z / ((y * z) - x)), a, (t / t_1));
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_3;
} else {
tmp = y / a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y * z)) t_2 = Float64(t - Float64(a * z)) t_3 = fma(Float64(z / Float64(Float64(a * z) - t)), y, Float64(x / t_2)) t_4 = Float64(t_1 / t_2) tmp = 0.0 if (t_4 <= -5e-79) tmp = t_3; elseif (t_4 <= 2e-48) tmp = Float64(1.0 / fma(Float64(z / Float64(Float64(y * z) - x)), a, Float64(t / t_1))); elseif (t_4 <= Inf) tmp = t_3; else tmp = Float64(y / a); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(z / N[(N[(a * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * y + N[(x / t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 / t$95$2), $MachinePrecision]}, If[LessEqual[t$95$4, -5e-79], t$95$3, If[LessEqual[t$95$4, 2e-48], N[(1.0 / N[(N[(z / N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] * a + N[(t / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], t$95$3, N[(y / a), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot z\\
t_2 := t - a \cdot z\\
t_3 := \mathsf{fma}\left(\frac{z}{a \cdot z - t}, y, \frac{x}{t\_2}\right)\\
t_4 := \frac{t\_1}{t\_2}\\
\mathbf{if}\;t\_4 \leq -5 \cdot 10^{-79}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{-48}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{z}{y \cdot z - x}, a, \frac{t}{t\_1}\right)}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -4.99999999999999999e-79 or 1.9999999999999999e-48 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 85.6%
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 rewrites89.1%
if -4.99999999999999999e-79 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 1.9999999999999999e-48Initial program 85.6%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
remove-double-negN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower--.f64N/A
distribute-lft-neg-outN/A
lift-*.f64N/A
remove-double-negN/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.2
Applied rewrites85.2%
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
div-addN/A
associate-/l*N/A
*-commutativeN/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6485.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.8
Applied rewrites85.8%
if +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 85.6%
Taylor expanded in z around inf
lower-/.f6434.9
Applied rewrites34.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (/ x t_1)))
(if (<= z -2.7e+128)
(fma (/ 1.0 a) y t_2)
(if (<= z 2e-61)
(/ (fma (- z) y x) t_1)
(if (<= z 4.4e+165)
(fma (/ y (- (* a z) t)) z t_2)
(* -1.0 (/ (- (/ x z) y) a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = x / t_1;
double tmp;
if (z <= -2.7e+128) {
tmp = fma((1.0 / a), y, t_2);
} else if (z <= 2e-61) {
tmp = fma(-z, y, x) / t_1;
} else if (z <= 4.4e+165) {
tmp = fma((y / ((a * z) - t)), z, t_2);
} else {
tmp = -1.0 * (((x / z) - y) / a);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(x / t_1) tmp = 0.0 if (z <= -2.7e+128) tmp = fma(Float64(1.0 / a), y, t_2); elseif (z <= 2e-61) tmp = Float64(fma(Float64(-z), y, x) / t_1); elseif (z <= 4.4e+165) tmp = fma(Float64(y / Float64(Float64(a * z) - t)), z, t_2); else tmp = Float64(-1.0 * Float64(Float64(Float64(x / z) - y) / 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[(x / t$95$1), $MachinePrecision]}, If[LessEqual[z, -2.7e+128], N[(N[(1.0 / a), $MachinePrecision] * y + t$95$2), $MachinePrecision], If[LessEqual[z, 2e-61], N[(N[((-z) * y + x), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[z, 4.4e+165], N[(N[(y / N[(N[(a * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * z + t$95$2), $MachinePrecision], N[(-1.0 * N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x}{t\_1}\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{a}, y, t\_2\right)\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-61}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, y, x\right)}{t\_1}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+165}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a \cdot z - t}, z, t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{x}{z} - y}{a}\\
\end{array}
\end{array}
if z < -2.70000000000000001e128Initial program 85.6%
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 rewrites89.1%
Taylor expanded in z around inf
lower-/.f6465.1
Applied rewrites65.1%
if -2.70000000000000001e128 < z < 2.0000000000000001e-61Initial program 85.6%
*-lft-identityN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
Applied rewrites85.6%
if 2.0000000000000001e-61 < z < 4.3999999999999998e165Initial program 85.6%
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 rewrites86.4%
if 4.3999999999999998e165 < z Initial program 85.6%
Taylor expanded in z around 0
Applied rewrites51.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.0
Applied rewrites51.0%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6450.5
Applied rewrites50.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ x (- t (* a z)))))
(if (<= z -5.5e+129)
(fma (/ 1.0 a) y t_1)
(if (<= z 4.7e+165)
(fma (/ z (- (* a z) t)) y t_1)
(* -1.0 (/ (- (/ x z) y) a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x / (t - (a * z));
double tmp;
if (z <= -5.5e+129) {
tmp = fma((1.0 / a), y, t_1);
} else if (z <= 4.7e+165) {
tmp = fma((z / ((a * z) - t)), y, t_1);
} else {
tmp = -1.0 * (((x / z) - y) / a);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x / Float64(t - Float64(a * z))) tmp = 0.0 if (z <= -5.5e+129) tmp = fma(Float64(1.0 / a), y, t_1); elseif (z <= 4.7e+165) tmp = fma(Float64(z / Float64(Float64(a * z) - t)), y, t_1); else tmp = Float64(-1.0 * Float64(Float64(Float64(x / z) - y) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e+129], N[(N[(1.0 / a), $MachinePrecision] * y + t$95$1), $MachinePrecision], If[LessEqual[z, 4.7e+165], N[(N[(z / N[(N[(a * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * y + t$95$1), $MachinePrecision], N[(-1.0 * N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t - a \cdot z}\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{+129}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{a}, y, t\_1\right)\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+165}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a \cdot z - t}, y, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{x}{z} - y}{a}\\
\end{array}
\end{array}
if z < -5.49999999999999984e129Initial program 85.6%
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 rewrites89.1%
Taylor expanded in z around inf
lower-/.f6465.1
Applied rewrites65.1%
if -5.49999999999999984e129 < z < 4.70000000000000016e165Initial program 85.6%
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 rewrites89.1%
if 4.70000000000000016e165 < z Initial program 85.6%
Taylor expanded in z around 0
Applied rewrites51.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.0
Applied rewrites51.0%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6450.5
Applied rewrites50.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.7e+128)
(fma (/ 1.0 a) y (/ x (- t (* a z))))
(if (<= z 4.7e+165)
(/ (- x (* y z)) (fma (- z) a t))
(* -1.0 (/ (- (/ x z) y) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.7e+128) {
tmp = fma((1.0 / a), y, (x / (t - (a * z))));
} else if (z <= 4.7e+165) {
tmp = (x - (y * z)) / fma(-z, a, t);
} else {
tmp = -1.0 * (((x / z) - y) / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.7e+128) tmp = fma(Float64(1.0 / a), y, Float64(x / Float64(t - Float64(a * z)))); elseif (z <= 4.7e+165) tmp = Float64(Float64(x - Float64(y * z)) / fma(Float64(-z), a, t)); else tmp = Float64(-1.0 * Float64(Float64(Float64(x / z) - y) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.7e+128], N[(N[(1.0 / a), $MachinePrecision] * y + N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.7e+165], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[((-z) * a + t), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{a}, y, \frac{x}{t - a \cdot z}\right)\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+165}:\\
\;\;\;\;\frac{x - y \cdot z}{\mathsf{fma}\left(-z, a, t\right)}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{x}{z} - y}{a}\\
\end{array}
\end{array}
if z < -2.70000000000000001e128Initial program 85.6%
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 rewrites89.1%
Taylor expanded in z around inf
lower-/.f6465.1
Applied rewrites65.1%
if -2.70000000000000001e128 < z < 4.70000000000000016e165Initial program 85.6%
remove-double-negN/A
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
distribute-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
lower-neg.f6485.6
Applied rewrites85.6%
if 4.70000000000000016e165 < z Initial program 85.6%
Taylor expanded in z around 0
Applied rewrites51.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.0
Applied rewrites51.0%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6450.5
Applied rewrites50.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -1.0 (/ (- (/ x z) y) a))))
(if (<= z -1.16e+122)
t_1
(if (<= z 4.7e+165) (/ (- x (* y z)) (fma (- z) a t)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -1.0 * (((x / z) - y) / a);
double tmp;
if (z <= -1.16e+122) {
tmp = t_1;
} else if (z <= 4.7e+165) {
tmp = (x - (y * z)) / fma(-z, a, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(-1.0 * Float64(Float64(Float64(x / z) - y) / a)) tmp = 0.0 if (z <= -1.16e+122) tmp = t_1; elseif (z <= 4.7e+165) tmp = Float64(Float64(x - Float64(y * z)) / fma(Float64(-z), a, t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-1.0 * N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.16e+122], t$95$1, If[LessEqual[z, 4.7e+165], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[((-z) * a + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \frac{\frac{x}{z} - y}{a}\\
\mathbf{if}\;z \leq -1.16 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+165}:\\
\;\;\;\;\frac{x - y \cdot z}{\mathsf{fma}\left(-z, a, t\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.16e122 or 4.70000000000000016e165 < z Initial program 85.6%
Taylor expanded in z around 0
Applied rewrites51.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.0
Applied rewrites51.0%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6450.5
Applied rewrites50.5%
if -1.16e122 < z < 4.70000000000000016e165Initial program 85.6%
remove-double-negN/A
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
distribute-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
lower-neg.f6485.6
Applied rewrites85.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -1.0 (/ (- (/ x z) y) a))))
(if (<= z -1.16e+122)
t_1
(if (<= z 4.7e+165) (/ (- x (* y z)) (- t (* a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -1.0 * (((x / z) - y) / a);
double tmp;
if (z <= -1.16e+122) {
tmp = t_1;
} else if (z <= 4.7e+165) {
tmp = (x - (y * z)) / (t - (a * z));
} 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 = (-1.0d0) * (((x / z) - y) / a)
if (z <= (-1.16d+122)) then
tmp = t_1
else if (z <= 4.7d+165) then
tmp = (x - (y * z)) / (t - (a * z))
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 = -1.0 * (((x / z) - y) / a);
double tmp;
if (z <= -1.16e+122) {
tmp = t_1;
} else if (z <= 4.7e+165) {
tmp = (x - (y * z)) / (t - (a * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -1.0 * (((x / z) - y) / a) tmp = 0 if z <= -1.16e+122: tmp = t_1 elif z <= 4.7e+165: tmp = (x - (y * z)) / (t - (a * z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(-1.0 * Float64(Float64(Float64(x / z) - y) / a)) tmp = 0.0 if (z <= -1.16e+122) tmp = t_1; elseif (z <= 4.7e+165) tmp = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -1.0 * (((x / z) - y) / a); tmp = 0.0; if (z <= -1.16e+122) tmp = t_1; elseif (z <= 4.7e+165) tmp = (x - (y * z)) / (t - (a * z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-1.0 * N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.16e+122], t$95$1, If[LessEqual[z, 4.7e+165], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \frac{\frac{x}{z} - y}{a}\\
\mathbf{if}\;z \leq -1.16 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+165}:\\
\;\;\;\;\frac{x - y \cdot z}{t - a \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.16e122 or 4.70000000000000016e165 < z Initial program 85.6%
Taylor expanded in z around 0
Applied rewrites51.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.0
Applied rewrites51.0%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6450.5
Applied rewrites50.5%
if -1.16e122 < z < 4.70000000000000016e165Initial program 85.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* -1.0 (/ (- (/ x z) y) a)))) (if (<= z -3e-48) t_1 (if (<= z 1450000.0) (/ x (- t (* a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -1.0 * (((x / z) - y) / a);
double tmp;
if (z <= -3e-48) {
tmp = t_1;
} else if (z <= 1450000.0) {
tmp = x / (t - (a * z));
} 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 = (-1.0d0) * (((x / z) - y) / a)
if (z <= (-3d-48)) then
tmp = t_1
else if (z <= 1450000.0d0) then
tmp = x / (t - (a * z))
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 = -1.0 * (((x / z) - y) / a);
double tmp;
if (z <= -3e-48) {
tmp = t_1;
} else if (z <= 1450000.0) {
tmp = x / (t - (a * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -1.0 * (((x / z) - y) / a) tmp = 0 if z <= -3e-48: tmp = t_1 elif z <= 1450000.0: tmp = x / (t - (a * z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(-1.0 * Float64(Float64(Float64(x / z) - y) / a)) tmp = 0.0 if (z <= -3e-48) tmp = t_1; elseif (z <= 1450000.0) tmp = Float64(x / Float64(t - Float64(a * z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -1.0 * (((x / z) - y) / a); tmp = 0.0; if (z <= -3e-48) tmp = t_1; elseif (z <= 1450000.0) tmp = x / (t - (a * z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-1.0 * N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3e-48], t$95$1, If[LessEqual[z, 1450000.0], N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \frac{\frac{x}{z} - y}{a}\\
\mathbf{if}\;z \leq -3 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1450000:\\
\;\;\;\;\frac{x}{t - a \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.9999999999999999e-48 or 1.45e6 < z Initial program 85.6%
Taylor expanded in z around 0
Applied rewrites51.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.0
Applied rewrites51.0%
Taylor expanded in a around -inf
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6450.5
Applied rewrites50.5%
if -2.9999999999999999e-48 < z < 1.45e6Initial program 85.6%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6454.7
Applied rewrites54.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -6.8e+125) (/ y a) (if (<= z 8200000.0) (/ x (- t (* a z))) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.8e+125) {
tmp = y / a;
} else if (z <= 8200000.0) {
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 <= (-6.8d+125)) then
tmp = y / a
else if (z <= 8200000.0d0) 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 <= -6.8e+125) {
tmp = y / a;
} else if (z <= 8200000.0) {
tmp = x / (t - (a * z));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.8e+125: tmp = y / a elif z <= 8200000.0: tmp = x / (t - (a * z)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.8e+125) tmp = Float64(y / a); elseif (z <= 8200000.0) 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 <= -6.8e+125) tmp = y / a; elseif (z <= 8200000.0) tmp = x / (t - (a * z)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.8e+125], N[(y / a), $MachinePrecision], If[LessEqual[z, 8200000.0], N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{+125}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 8200000:\\
\;\;\;\;\frac{x}{t - a \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -6.7999999999999998e125 or 8.2e6 < z Initial program 85.6%
Taylor expanded in z around inf
lower-/.f6434.9
Applied rewrites34.9%
if -6.7999999999999998e125 < z < 8.2e6Initial program 85.6%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6454.7
Applied rewrites54.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -8.6e-52) (/ y a) (if (<= z 1.9e-54) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.6e-52) {
tmp = y / a;
} else if (z <= 1.9e-54) {
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 <= (-8.6d-52)) then
tmp = y / a
else if (z <= 1.9d-54) 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 <= -8.6e-52) {
tmp = y / a;
} else if (z <= 1.9e-54) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8.6e-52: tmp = y / a elif z <= 1.9e-54: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8.6e-52) tmp = Float64(y / a); elseif (z <= 1.9e-54) 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 <= -8.6e-52) tmp = y / a; elseif (z <= 1.9e-54) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8.6e-52], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.9e-54], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.6 \cdot 10^{-52}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-54}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -8.6000000000000007e-52 or 1.9000000000000001e-54 < z Initial program 85.6%
Taylor expanded in z around inf
lower-/.f6434.9
Applied rewrites34.9%
if -8.6000000000000007e-52 < z < 1.9000000000000001e-54Initial program 85.6%
Taylor expanded in z around 0
lower-/.f6436.5
Applied rewrites36.5%
(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]
\begin{array}{l}
\\
\frac{x}{t}
\end{array}
Initial program 85.6%
Taylor expanded in z around 0
lower-/.f6436.5
Applied rewrites36.5%
herbie shell --seed 2025154
(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))))