
(FPCore (x y z t a b) :precision binary64 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
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, b)
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), intent (in) :: b
code = ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
def code(x, y, z, t, a, b): return ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
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, b)
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), intent (in) :: b
code = ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
def code(x, y, z, t, a, b): return ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- b y) z y))
(t_2 (/ (- t a) (- b y)))
(t_3 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_4 (* (fma z (/ (- t a) (* t_1 x)) (/ y t_1)) x)))
(if (<= t_3 (- INFINITY))
t_4
(if (<= t_3 -1e-291)
t_3
(if (<= t_3 2e-269)
(+
(-
(/
(-
(- (* x (/ y (- b y))))
(- (/ (* (- t a) y) (* (- b y) (- b y)))))
z))
t_2)
(if (<= t_3 5e+298)
(+ (/ (fma t z (* y x)) t_1) (/ (* (- a) z) t_1))
(if (<= t_3 INFINITY) t_4 t_2)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((b - y), z, y);
double t_2 = (t - a) / (b - y);
double t_3 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_4 = fma(z, ((t - a) / (t_1 * x)), (y / t_1)) * x;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_3 <= -1e-291) {
tmp = t_3;
} else if (t_3 <= 2e-269) {
tmp = -((-(x * (y / (b - y))) - -(((t - a) * y) / ((b - y) * (b - y)))) / z) + t_2;
} else if (t_3 <= 5e+298) {
tmp = (fma(t, z, (y * x)) / t_1) + ((-a * z) / t_1);
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_4;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(b - y), z, y) t_2 = Float64(Float64(t - a) / Float64(b - y)) t_3 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_4 = Float64(fma(z, Float64(Float64(t - a) / Float64(t_1 * x)), Float64(y / t_1)) * x) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_4; elseif (t_3 <= -1e-291) tmp = t_3; elseif (t_3 <= 2e-269) tmp = Float64(Float64(-Float64(Float64(Float64(-Float64(x * Float64(y / Float64(b - y)))) - Float64(-Float64(Float64(Float64(t - a) * y) / Float64(Float64(b - y) * Float64(b - y))))) / z)) + t_2); elseif (t_3 <= 5e+298) tmp = Float64(Float64(fma(t, z, Float64(y * x)) / t_1) + Float64(Float64(Float64(-a) * z) / t_1)); elseif (t_3 <= Inf) tmp = t_4; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(z * N[(N[(t - a), $MachinePrecision] / N[(t$95$1 * x), $MachinePrecision]), $MachinePrecision] + N[(y / t$95$1), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, -1e-291], t$95$3, If[LessEqual[t$95$3, 2e-269], N[((-N[(N[((-N[(x * N[(y / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) - (-N[(N[(N[(t - a), $MachinePrecision] * y), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision] / z), $MachinePrecision]) + t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 5e+298], N[(N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[((-a) * z), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$4, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b - y, z, y\right)\\
t_2 := \frac{t - a}{b - y}\\
t_3 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_4 := \mathsf{fma}\left(z, \frac{t - a}{t\_1 \cdot x}, \frac{y}{t\_1}\right) \cdot x\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-291}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-269}:\\
\;\;\;\;\left(-\frac{\left(-x \cdot \frac{y}{b - y}\right) - \left(-\frac{\left(t - a\right) \cdot y}{\left(b - y\right) \cdot \left(b - y\right)}\right)}{z}\right) + t\_2\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+298}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{t\_1} + \frac{\left(-a\right) \cdot z}{t\_1}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or 5.0000000000000003e298 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 66.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.0%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -9.99999999999999962e-292Initial program 66.6%
if -9.99999999999999962e-292 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1.9999999999999999e-269Initial program 66.6%
Taylor expanded in z around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
Applied rewrites49.3%
if 1.9999999999999999e-269 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 5.0000000000000003e298Initial program 66.6%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites66.1%
if +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.4
Applied rewrites51.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y)))
(t_2 (fma (- b y) z y))
(t_3 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_4 (* (fma z (/ (- t a) (* t_2 x)) (/ y t_2)) x)))
(if (<= t_3 (- INFINITY))
t_4
(if (<= t_3 -1e-291)
t_3
(if (<= t_3 2e-269)
t_1
(if (<= t_3 5e+298)
(+ (/ (fma t z (* y x)) t_2) (/ (* (- a) z) t_2))
(if (<= t_3 INFINITY) t_4 t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double t_2 = fma((b - y), z, y);
double t_3 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_4 = fma(z, ((t - a) / (t_2 * x)), (y / t_2)) * x;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_3 <= -1e-291) {
tmp = t_3;
} else if (t_3 <= 2e-269) {
tmp = t_1;
} else if (t_3 <= 5e+298) {
tmp = (fma(t, z, (y * x)) / t_2) + ((-a * z) / t_2);
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_4;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) t_2 = fma(Float64(b - y), z, y) t_3 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_4 = Float64(fma(z, Float64(Float64(t - a) / Float64(t_2 * x)), Float64(y / t_2)) * x) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_4; elseif (t_3 <= -1e-291) tmp = t_3; elseif (t_3 <= 2e-269) tmp = t_1; elseif (t_3 <= 5e+298) tmp = Float64(Float64(fma(t, z, Float64(y * x)) / t_2) + Float64(Float64(Float64(-a) * z) / t_2)); elseif (t_3 <= Inf) tmp = t_4; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(z * N[(N[(t - a), $MachinePrecision] / N[(t$95$2 * x), $MachinePrecision]), $MachinePrecision] + N[(y / t$95$2), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, -1e-291], t$95$3, If[LessEqual[t$95$3, 2e-269], t$95$1, If[LessEqual[t$95$3, 5e+298], N[(N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] + N[(N[((-a) * z), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$4, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
t_2 := \mathsf{fma}\left(b - y, z, y\right)\\
t_3 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_4 := \mathsf{fma}\left(z, \frac{t - a}{t\_2 \cdot x}, \frac{y}{t\_2}\right) \cdot x\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-291}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-269}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+298}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{t\_2} + \frac{\left(-a\right) \cdot z}{t\_2}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or 5.0000000000000003e298 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 66.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.0%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -9.99999999999999962e-292Initial program 66.6%
if -9.99999999999999962e-292 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1.9999999999999999e-269 or +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.4
Applied rewrites51.4%
if 1.9999999999999999e-269 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 5.0000000000000003e298Initial program 66.6%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites66.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y)))
(t_2 (fma (- b y) z y))
(t_3 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_4 (* (fma z (/ (- t a) (* t_2 x)) (/ y t_2)) x)))
(if (<= t_3 (- INFINITY))
t_4
(if (<= t_3 -1e-291)
t_3
(if (<= t_3 2e-269)
t_1
(if (<= t_3 5e+298) t_3 (if (<= t_3 INFINITY) t_4 t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double t_2 = fma((b - y), z, y);
double t_3 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_4 = fma(z, ((t - a) / (t_2 * x)), (y / t_2)) * x;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_3 <= -1e-291) {
tmp = t_3;
} else if (t_3 <= 2e-269) {
tmp = t_1;
} else if (t_3 <= 5e+298) {
tmp = t_3;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_4;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) t_2 = fma(Float64(b - y), z, y) t_3 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_4 = Float64(fma(z, Float64(Float64(t - a) / Float64(t_2 * x)), Float64(y / t_2)) * x) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_4; elseif (t_3 <= -1e-291) tmp = t_3; elseif (t_3 <= 2e-269) tmp = t_1; elseif (t_3 <= 5e+298) tmp = t_3; elseif (t_3 <= Inf) tmp = t_4; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(z * N[(N[(t - a), $MachinePrecision] / N[(t$95$2 * x), $MachinePrecision]), $MachinePrecision] + N[(y / t$95$2), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, -1e-291], t$95$3, If[LessEqual[t$95$3, 2e-269], t$95$1, If[LessEqual[t$95$3, 5e+298], t$95$3, If[LessEqual[t$95$3, Infinity], t$95$4, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
t_2 := \mathsf{fma}\left(b - y, z, y\right)\\
t_3 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_4 := \mathsf{fma}\left(z, \frac{t - a}{t\_2 \cdot x}, \frac{y}{t\_2}\right) \cdot x\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-291}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-269}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+298}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or 5.0000000000000003e298 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 66.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.0%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -9.99999999999999962e-292 or 1.9999999999999999e-269 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 5.0000000000000003e298Initial program 66.6%
if -9.99999999999999962e-292 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1.9999999999999999e-269 or +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.4
Applied rewrites51.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y)))
(t_2 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y))))))
(if (<= t_2 (- INFINITY))
(* (fma z (/ (- t a) (* x y)) (/ y (fma (- b y) z y))) x)
(if (<= t_2 -1e-291)
t_2
(if (<= t_2 2e-269) t_1 (if (<= t_2 1e+270) t_2 t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double t_2 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(z, ((t - a) / (x * y)), (y / fma((b - y), z, y))) * x;
} else if (t_2 <= -1e-291) {
tmp = t_2;
} else if (t_2 <= 2e-269) {
tmp = t_1;
} else if (t_2 <= 1e+270) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) t_2 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(fma(z, Float64(Float64(t - a) / Float64(x * y)), Float64(y / fma(Float64(b - y), z, y))) * x); elseif (t_2 <= -1e-291) tmp = t_2; elseif (t_2 <= 2e-269) tmp = t_1; elseif (t_2 <= 1e+270) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(z * N[(N[(t - a), $MachinePrecision] / N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(y / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$2, -1e-291], t$95$2, If[LessEqual[t$95$2, 2e-269], t$95$1, If[LessEqual[t$95$2, 1e+270], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
t_2 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{x \cdot y}, \frac{y}{\mathsf{fma}\left(b - y, z, y\right)}\right) \cdot x\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-291}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-269}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+270}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0Initial program 66.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.0%
Taylor expanded in z around 0
lower-/.f64N/A
lift--.f64N/A
lower-*.f6439.3
Applied rewrites39.3%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -9.99999999999999962e-292 or 1.9999999999999999e-269 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1e270Initial program 66.6%
if -9.99999999999999962e-292 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1.9999999999999999e-269 or 1e270 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.4
Applied rewrites51.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_2 (/ (- t a) (- b y))))
(if (<= t_1 -1e-291)
t_1
(if (<= t_1 2e-269) t_2 (if (<= t_1 1e+270) t_1 t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_2 = (t - a) / (b - y);
double tmp;
if (t_1 <= -1e-291) {
tmp = t_1;
} else if (t_1 <= 2e-269) {
tmp = t_2;
} else if (t_1 <= 1e+270) {
tmp = t_1;
} else {
tmp = t_2;
}
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, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
t_2 = (t - a) / (b - y)
if (t_1 <= (-1d-291)) then
tmp = t_1
else if (t_1 <= 2d-269) then
tmp = t_2
else if (t_1 <= 1d+270) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_2 = (t - a) / (b - y);
double tmp;
if (t_1 <= -1e-291) {
tmp = t_1;
} else if (t_1 <= 2e-269) {
tmp = t_2;
} else if (t_1 <= 1e+270) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((x * y) + (z * (t - a))) / (y + (z * (b - y))) t_2 = (t - a) / (b - y) tmp = 0 if t_1 <= -1e-291: tmp = t_1 elif t_1 <= 2e-269: tmp = t_2 elif t_1 <= 1e+270: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_2 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (t_1 <= -1e-291) tmp = t_1; elseif (t_1 <= 2e-269) tmp = t_2; elseif (t_1 <= 1e+270) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); t_2 = (t - a) / (b - y); tmp = 0.0; if (t_1 <= -1e-291) tmp = t_1; elseif (t_1 <= 2e-269) tmp = t_2; elseif (t_1 <= 1e+270) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-291], t$95$1, If[LessEqual[t$95$1, 2e-269], t$95$2, If[LessEqual[t$95$1, 1e+270], t$95$1, t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_2 := \frac{t - a}{b - y}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-291}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-269}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+270}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -9.99999999999999962e-292 or 1.9999999999999999e-269 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1e270Initial program 66.6%
if -9.99999999999999962e-292 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1.9999999999999999e-269 or 1e270 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.4
Applied rewrites51.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))) (t_2 (fma (- b y) z y)))
(if (<= z -7.4e-84)
t_1
(if (<= z 2.4e-130)
(* x (/ y (fma b z y)))
(if (<= z 1.2e-47)
(/ (* (- t a) z) t_2)
(if (<= z 6.8e+45) (/ (fma t z (* y x)) t_2) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double t_2 = fma((b - y), z, y);
double tmp;
if (z <= -7.4e-84) {
tmp = t_1;
} else if (z <= 2.4e-130) {
tmp = x * (y / fma(b, z, y));
} else if (z <= 1.2e-47) {
tmp = ((t - a) * z) / t_2;
} else if (z <= 6.8e+45) {
tmp = fma(t, z, (y * x)) / t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) t_2 = fma(Float64(b - y), z, y) tmp = 0.0 if (z <= -7.4e-84) tmp = t_1; elseif (z <= 2.4e-130) tmp = Float64(x * Float64(y / fma(b, z, y))); elseif (z <= 1.2e-47) tmp = Float64(Float64(Float64(t - a) * z) / t_2); elseif (z <= 6.8e+45) tmp = Float64(fma(t, z, Float64(y * x)) / t_2); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, If[LessEqual[z, -7.4e-84], t$95$1, If[LessEqual[z, 2.4e-130], N[(x * N[(y / N[(b * z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-47], N[(N[(N[(t - a), $MachinePrecision] * z), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[z, 6.8e+45], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
t_2 := \mathsf{fma}\left(b - y, z, y\right)\\
\mathbf{if}\;z \leq -7.4 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-130}:\\
\;\;\;\;x \cdot \frac{y}{\mathsf{fma}\left(b, z, y\right)}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-47}:\\
\;\;\;\;\frac{\left(t - a\right) \cdot z}{t\_2}\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+45}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.3999999999999999e-84 or 6.8e45 < z Initial program 66.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.4
Applied rewrites51.4%
if -7.3999999999999999e-84 < z < 2.39999999999999997e-130Initial program 66.6%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6436.3
Applied rewrites36.3%
Taylor expanded in y around 0
Applied rewrites31.9%
if 2.39999999999999997e-130 < z < 1.2e-47Initial program 66.6%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6441.4
Applied rewrites41.4%
if 1.2e-47 < z < 6.8e45Initial program 66.6%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6447.3
Applied rewrites47.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -7.4e-84)
t_1
(if (<= z 2.4e-130)
(* x (/ y (fma b z y)))
(if (<= z 1.2e-47)
(/ (* (- t a) z) (fma (- b y) z y))
(if (<= z 7e-7) (/ (fma t z (* y x)) (fma b z y)) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -7.4e-84) {
tmp = t_1;
} else if (z <= 2.4e-130) {
tmp = x * (y / fma(b, z, y));
} else if (z <= 1.2e-47) {
tmp = ((t - a) * z) / fma((b - y), z, y);
} else if (z <= 7e-7) {
tmp = fma(t, z, (y * x)) / fma(b, z, y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -7.4e-84) tmp = t_1; elseif (z <= 2.4e-130) tmp = Float64(x * Float64(y / fma(b, z, y))); elseif (z <= 1.2e-47) tmp = Float64(Float64(Float64(t - a) * z) / fma(Float64(b - y), z, y)); elseif (z <= 7e-7) tmp = Float64(fma(t, z, Float64(y * x)) / fma(b, z, y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.4e-84], t$95$1, If[LessEqual[z, 2.4e-130], N[(x * N[(y / N[(b * z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-47], N[(N[(N[(t - a), $MachinePrecision] * z), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7e-7], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(b * z + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -7.4 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-130}:\\
\;\;\;\;x \cdot \frac{y}{\mathsf{fma}\left(b, z, y\right)}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-47}:\\
\;\;\;\;\frac{\left(t - a\right) \cdot z}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-7}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{\mathsf{fma}\left(b, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.3999999999999999e-84 or 6.99999999999999968e-7 < z Initial program 66.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.4
Applied rewrites51.4%
if -7.3999999999999999e-84 < z < 2.39999999999999997e-130Initial program 66.6%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6436.3
Applied rewrites36.3%
Taylor expanded in y around 0
Applied rewrites31.9%
if 2.39999999999999997e-130 < z < 1.2e-47Initial program 66.6%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6441.4
Applied rewrites41.4%
if 1.2e-47 < z < 6.99999999999999968e-7Initial program 66.6%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6447.3
Applied rewrites47.3%
Taylor expanded in y around 0
Applied rewrites41.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -8.1e-84)
t_1
(if (<= z 5.6e-87)
(/ (fma (- t a) z (* y x)) (fma (- y) z y))
(if (<= z 6.8e+45) (/ (fma t z (* y x)) (fma (- b y) z y)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -8.1e-84) {
tmp = t_1;
} else if (z <= 5.6e-87) {
tmp = fma((t - a), z, (y * x)) / fma(-y, z, y);
} else if (z <= 6.8e+45) {
tmp = fma(t, z, (y * x)) / fma((b - y), z, y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -8.1e-84) tmp = t_1; elseif (z <= 5.6e-87) tmp = Float64(fma(Float64(t - a), z, Float64(y * x)) / fma(Float64(-y), z, y)); elseif (z <= 6.8e+45) tmp = Float64(fma(t, z, Float64(y * x)) / fma(Float64(b - y), z, y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.1e-84], t$95$1, If[LessEqual[z, 5.6e-87], N[(N[(N[(t - a), $MachinePrecision] * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[((-y) * z + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.8e+45], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -8.1 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-87}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t - a, z, y \cdot x\right)}{\mathsf{fma}\left(-y, z, y\right)}\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+45}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.0999999999999997e-84 or 6.8e45 < z Initial program 66.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.4
Applied rewrites51.4%
if -8.0999999999999997e-84 < z < 5.6000000000000002e-87Initial program 66.6%
Taylor expanded in b around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f6443.1
Applied rewrites43.1%
if 5.6000000000000002e-87 < z < 6.8e45Initial program 66.6%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6447.3
Applied rewrites47.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -8.1e-84)
t_1
(if (<= z 7e-7) (/ (fma t z (* y x)) (fma b z y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -8.1e-84) {
tmp = t_1;
} else if (z <= 7e-7) {
tmp = fma(t, z, (y * x)) / fma(b, z, y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -8.1e-84) tmp = t_1; elseif (z <= 7e-7) tmp = Float64(fma(t, z, Float64(y * x)) / fma(b, z, y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.1e-84], t$95$1, If[LessEqual[z, 7e-7], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(b * z + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -8.1 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-7}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{\mathsf{fma}\left(b, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.0999999999999997e-84 or 6.99999999999999968e-7 < z Initial program 66.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.4
Applied rewrites51.4%
if -8.0999999999999997e-84 < z < 6.99999999999999968e-7Initial program 66.6%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6447.3
Applied rewrites47.3%
Taylor expanded in y around 0
Applied rewrites41.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -7.4e-84) t_1 (if (<= z 7.2e-89) (* x (/ y (fma b z y))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -7.4e-84) {
tmp = t_1;
} else if (z <= 7.2e-89) {
tmp = x * (y / fma(b, z, y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -7.4e-84) tmp = t_1; elseif (z <= 7.2e-89) tmp = Float64(x * Float64(y / fma(b, z, y))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.4e-84], t$95$1, If[LessEqual[z, 7.2e-89], N[(x * N[(y / N[(b * z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -7.4 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-89}:\\
\;\;\;\;x \cdot \frac{y}{\mathsf{fma}\left(b, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.3999999999999999e-84 or 7.20000000000000014e-89 < z Initial program 66.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.4
Applied rewrites51.4%
if -7.3999999999999999e-84 < z < 7.20000000000000014e-89Initial program 66.6%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6436.3
Applied rewrites36.3%
Taylor expanded in y around 0
Applied rewrites31.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -7.4e-84) t_1 (if (<= z 6.2e-89) (* (+ 1.0 z) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -7.4e-84) {
tmp = t_1;
} else if (z <= 6.2e-89) {
tmp = (1.0 + z) * x;
} 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, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (t - a) / (b - y)
if (z <= (-7.4d-84)) then
tmp = t_1
else if (z <= 6.2d-89) then
tmp = (1.0d0 + z) * x
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 b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -7.4e-84) {
tmp = t_1;
} else if (z <= 6.2e-89) {
tmp = (1.0 + z) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -7.4e-84: tmp = t_1 elif z <= 6.2e-89: tmp = (1.0 + z) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -7.4e-84) tmp = t_1; elseif (z <= 6.2e-89) tmp = Float64(Float64(1.0 + z) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / (b - y); tmp = 0.0; if (z <= -7.4e-84) tmp = t_1; elseif (z <= 6.2e-89) tmp = (1.0 + z) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.4e-84], t$95$1, If[LessEqual[z, 6.2e-89], N[(N[(1.0 + z), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -7.4 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-89}:\\
\;\;\;\;\left(1 + z\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.3999999999999999e-84 or 6.19999999999999993e-89 < z Initial program 66.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.4
Applied rewrites51.4%
if -7.3999999999999999e-84 < z < 6.19999999999999993e-89Initial program 66.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.0%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6433.5
Applied rewrites33.5%
Taylor expanded in z around 0
lower-+.f6425.1
Applied rewrites25.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- x) (- z 1.0)))) (if (<= y -9.2e-42) t_1 (if (<= y 4.2e-41) (/ (- t a) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -x / (z - 1.0);
double tmp;
if (y <= -9.2e-42) {
tmp = t_1;
} else if (y <= 4.2e-41) {
tmp = (t - a) / b;
} 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, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = -x / (z - 1.0d0)
if (y <= (-9.2d-42)) then
tmp = t_1
else if (y <= 4.2d-41) then
tmp = (t - a) / b
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 b) {
double t_1 = -x / (z - 1.0);
double tmp;
if (y <= -9.2e-42) {
tmp = t_1;
} else if (y <= 4.2e-41) {
tmp = (t - a) / b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -x / (z - 1.0) tmp = 0 if y <= -9.2e-42: tmp = t_1 elif y <= 4.2e-41: tmp = (t - a) / b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-x) / Float64(z - 1.0)) tmp = 0.0 if (y <= -9.2e-42) tmp = t_1; elseif (y <= 4.2e-41) tmp = Float64(Float64(t - a) / b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -x / (z - 1.0); tmp = 0.0; if (y <= -9.2e-42) tmp = t_1; elseif (y <= 4.2e-41) tmp = (t - a) / b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-x) / N[(z - 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.2e-42], t$95$1, If[LessEqual[y, 4.2e-41], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-x}{z - 1}\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-41}:\\
\;\;\;\;\frac{t - a}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.20000000000000015e-42 or 4.20000000000000025e-41 < y Initial program 66.6%
Taylor expanded in y around -inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f6433.5
Applied rewrites33.5%
if -9.20000000000000015e-42 < y < 4.20000000000000025e-41Initial program 66.6%
Taylor expanded in y around 0
lower-/.f64N/A
lift--.f6435.3
Applied rewrites35.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) b)))
(if (<= z -7.4e-84)
t_1
(if (<= z 6.2e-89)
(* (+ 1.0 z) x)
(if (<= z 5.2e+54) t_1 (/ t (- b y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / b;
double tmp;
if (z <= -7.4e-84) {
tmp = t_1;
} else if (z <= 6.2e-89) {
tmp = (1.0 + z) * x;
} else if (z <= 5.2e+54) {
tmp = t_1;
} else {
tmp = t / (b - y);
}
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, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (t - a) / b
if (z <= (-7.4d-84)) then
tmp = t_1
else if (z <= 6.2d-89) then
tmp = (1.0d0 + z) * x
else if (z <= 5.2d+54) then
tmp = t_1
else
tmp = t / (b - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / b;
double tmp;
if (z <= -7.4e-84) {
tmp = t_1;
} else if (z <= 6.2e-89) {
tmp = (1.0 + z) * x;
} else if (z <= 5.2e+54) {
tmp = t_1;
} else {
tmp = t / (b - y);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / b tmp = 0 if z <= -7.4e-84: tmp = t_1 elif z <= 6.2e-89: tmp = (1.0 + z) * x elif z <= 5.2e+54: tmp = t_1 else: tmp = t / (b - y) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / b) tmp = 0.0 if (z <= -7.4e-84) tmp = t_1; elseif (z <= 6.2e-89) tmp = Float64(Float64(1.0 + z) * x); elseif (z <= 5.2e+54) tmp = t_1; else tmp = Float64(t / Float64(b - y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / b; tmp = 0.0; if (z <= -7.4e-84) tmp = t_1; elseif (z <= 6.2e-89) tmp = (1.0 + z) * x; elseif (z <= 5.2e+54) tmp = t_1; else tmp = t / (b - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision]}, If[LessEqual[z, -7.4e-84], t$95$1, If[LessEqual[z, 6.2e-89], N[(N[(1.0 + z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 5.2e+54], t$95$1, N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b}\\
\mathbf{if}\;z \leq -7.4 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-89}:\\
\;\;\;\;\left(1 + z\right) \cdot x\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{b - y}\\
\end{array}
\end{array}
if z < -7.3999999999999999e-84 or 6.19999999999999993e-89 < z < 5.20000000000000013e54Initial program 66.6%
Taylor expanded in y around 0
lower-/.f64N/A
lift--.f6435.3
Applied rewrites35.3%
if -7.3999999999999999e-84 < z < 6.19999999999999993e-89Initial program 66.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.0%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6433.5
Applied rewrites33.5%
Taylor expanded in z around 0
lower-+.f6425.1
Applied rewrites25.1%
if 5.20000000000000013e54 < z Initial program 66.6%
Taylor expanded in t around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6425.2
Applied rewrites25.2%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f6427.1
Applied rewrites27.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ t (- b y)))) (if (<= z -2.1e-41) t_1 (if (<= z 8e-36) (* x 1.0) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t / (b - y);
double tmp;
if (z <= -2.1e-41) {
tmp = t_1;
} else if (z <= 8e-36) {
tmp = x * 1.0;
} 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, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = t / (b - y)
if (z <= (-2.1d-41)) then
tmp = t_1
else if (z <= 8d-36) then
tmp = x * 1.0d0
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 b) {
double t_1 = t / (b - y);
double tmp;
if (z <= -2.1e-41) {
tmp = t_1;
} else if (z <= 8e-36) {
tmp = x * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = t / (b - y) tmp = 0 if z <= -2.1e-41: tmp = t_1 elif z <= 8e-36: tmp = x * 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(t / Float64(b - y)) tmp = 0.0 if (z <= -2.1e-41) tmp = t_1; elseif (z <= 8e-36) tmp = Float64(x * 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = t / (b - y); tmp = 0.0; if (z <= -2.1e-41) tmp = t_1; elseif (z <= 8e-36) tmp = x * 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e-41], t$95$1, If[LessEqual[z, 8e-36], N[(x * 1.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{b - y}\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{-41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-36}:\\
\;\;\;\;x \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.10000000000000013e-41 or 7.9999999999999995e-36 < z Initial program 66.6%
Taylor expanded in t around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6425.2
Applied rewrites25.2%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f6427.1
Applied rewrites27.1%
if -2.10000000000000013e-41 < z < 7.9999999999999995e-36Initial program 66.6%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6436.3
Applied rewrites36.3%
Taylor expanded in z around 0
Applied rewrites25.1%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.3e-47) (* x 1.0) (if (<= y 6e-40) (/ t b) (* x 1.0))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.3e-47) {
tmp = x * 1.0;
} else if (y <= 6e-40) {
tmp = t / b;
} else {
tmp = x * 1.0;
}
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, b)
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), intent (in) :: b
real(8) :: tmp
if (y <= (-1.3d-47)) then
tmp = x * 1.0d0
else if (y <= 6d-40) then
tmp = t / b
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.3e-47) {
tmp = x * 1.0;
} else if (y <= 6e-40) {
tmp = t / b;
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.3e-47: tmp = x * 1.0 elif y <= 6e-40: tmp = t / b else: tmp = x * 1.0 return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.3e-47) tmp = Float64(x * 1.0); elseif (y <= 6e-40) tmp = Float64(t / b); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1.3e-47) tmp = x * 1.0; elseif (y <= 6e-40) tmp = t / b; else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.3e-47], N[(x * 1.0), $MachinePrecision], If[LessEqual[y, 6e-40], N[(t / b), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{-47}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-40}:\\
\;\;\;\;\frac{t}{b}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if y < -1.3e-47 or 6.00000000000000039e-40 < y Initial program 66.6%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6436.3
Applied rewrites36.3%
Taylor expanded in z around 0
Applied rewrites25.1%
if -1.3e-47 < y < 6.00000000000000039e-40Initial program 66.6%
Taylor expanded in t around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6425.2
Applied rewrites25.2%
Taylor expanded in y around 0
lower-/.f6419.2
Applied rewrites19.2%
(FPCore (x y z t a b) :precision binary64 (* x 1.0))
double code(double x, double y, double z, double t, double a, double b) {
return x * 1.0;
}
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, b)
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), intent (in) :: b
code = x * 1.0d0
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 1.0;
}
def code(x, y, z, t, a, b): return x * 1.0
function code(x, y, z, t, a, b) return Float64(x * 1.0) end
function tmp = code(x, y, z, t, a, b) tmp = x * 1.0; end
code[x_, y_, z_, t_, a_, b_] := N[(x * 1.0), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 1
\end{array}
Initial program 66.6%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6436.3
Applied rewrites36.3%
Taylor expanded in z around 0
Applied rewrites25.1%
herbie shell --seed 2025131
(FPCore (x y z t a b)
:name "Development.Shake.Progress:decay from shake-0.15.5"
:precision binary64
(/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))