
(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 13 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 (/ (- a t) (- y b)))
(t_3 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_4 (fma z (/ (- t a) t_1) (* x (/ y t_1)))))
(if (<= t_3 (- INFINITY))
t_4
(if (<= t_3 -1e-268)
t_3
(if (<= t_3 0.0)
(+
(-
(/
(-
(- (* x (/ y (- b y))))
(- (/ (* (- t a) y) (* (- y b) (- y b)))))
z))
t_2)
(if (<= t_3 1e+243) t_3 (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 = (a - t) / (y - b);
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)));
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_3 <= -1e-268) {
tmp = t_3;
} else if (t_3 <= 0.0) {
tmp = -((-(x * (y / (b - y))) - -(((t - a) * y) / ((y - b) * (y - b)))) / z) + t_2;
} else if (t_3 <= 1e+243) {
tmp = t_3;
} 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(a - t) / Float64(y - b)) t_3 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_4 = fma(z, Float64(Float64(t - a) / t_1), Float64(x * Float64(y / t_1))) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_4; elseif (t_3 <= -1e-268) tmp = t_3; elseif (t_3 <= 0.0) tmp = Float64(Float64(-Float64(Float64(Float64(-Float64(x * Float64(y / Float64(b - y)))) - Float64(-Float64(Float64(Float64(t - a) * y) / Float64(Float64(y - b) * Float64(y - b))))) / z)) + t_2); elseif (t_3 <= 1e+243) tmp = t_3; 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[(a - t), $MachinePrecision] / N[(y - b), $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[(z * N[(N[(t - a), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(x * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, -1e-268], t$95$3, If[LessEqual[t$95$3, 0.0], N[((-N[(N[((-N[(x * N[(y / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) - (-N[(N[(N[(t - a), $MachinePrecision] * y), $MachinePrecision] / N[(N[(y - b), $MachinePrecision] * N[(y - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision] / z), $MachinePrecision]) + t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 1e+243], t$95$3, 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{a - t}{y - b}\\
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}, x \cdot \frac{y}{t\_1}\right)\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-268}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\left(-\frac{\left(-x \cdot \frac{y}{b - y}\right) - \left(-\frac{\left(t - a\right) \cdot y}{\left(y - b\right) \cdot \left(y - b\right)}\right)}{z}\right) + t\_2\\
\mathbf{elif}\;t\_3 \leq 10^{+243}:\\
\;\;\;\;t\_3\\
\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 1.0000000000000001e243 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 37.1%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites96.1%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -9.99999999999999958e-269 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1.0000000000000001e243Initial program 99.4%
if -9.99999999999999958e-269 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -0.0Initial program 32.9%
Taylor expanded in z around -inf
associate--l+N/A
div-subN/A
lower-+.f64N/A
Applied rewrites82.8%
if +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 0.0%
Taylor expanded in z around inf
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6475.7
Applied rewrites75.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- a t) (- y b)))
(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)))))
(if (<= t_3 (- INFINITY))
t_4
(if (<= t_3 -5e-289)
t_3
(if (<= t_3 0.0)
t_1
(if (<= t_3 1e+243) 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 = (a - t) / (y - b);
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)));
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_3 <= -5e-289) {
tmp = t_3;
} else if (t_3 <= 0.0) {
tmp = t_1;
} else if (t_3 <= 1e+243) {
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(a - t) / Float64(y - b)) 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 = fma(z, Float64(Float64(t - a) / t_2), Float64(x * Float64(y / t_2))) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_4; elseif (t_3 <= -5e-289) tmp = t_3; elseif (t_3 <= 0.0) tmp = t_1; elseif (t_3 <= 1e+243) 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[(a - t), $MachinePrecision] / N[(y - b), $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[(z * N[(N[(t - a), $MachinePrecision] / t$95$2), $MachinePrecision] + N[(x * N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, -5e-289], t$95$3, If[LessEqual[t$95$3, 0.0], t$95$1, If[LessEqual[t$95$3, 1e+243], t$95$3, If[LessEqual[t$95$3, Infinity], t$95$4, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
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}, x \cdot \frac{y}{t\_2}\right)\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-289}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 10^{+243}:\\
\;\;\;\;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 1.0000000000000001e243 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 37.1%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites96.1%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -5.00000000000000029e-289 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1.0000000000000001e243Initial program 99.4%
if -5.00000000000000029e-289 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -0.0 or +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 12.3%
Taylor expanded in z around inf
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.7
Applied rewrites76.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- a t) (- y b)))
(t_2 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_3 (fma z (/ (- t a) (fma (- b y) z y)) x)))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 -5e-289)
t_2
(if (<= t_2 0.0)
t_1
(if (<= t_2 1e+243) t_2 (if (<= t_2 INFINITY) t_3 t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - t) / (y - b);
double t_2 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_3 = fma(z, ((t - a) / fma((b - y), z, y)), x);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= -5e-289) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = t_1;
} else if (t_2 <= 1e+243) {
tmp = t_2;
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - t) / Float64(y - b)) t_2 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_3 = fma(z, Float64(Float64(t - a) / fma(Float64(b - y), z, y)), x) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= -5e-289) tmp = t_2; elseif (t_2 <= 0.0) tmp = t_1; elseif (t_2 <= 1e+243) tmp = t_2; elseif (t_2 <= Inf) tmp = t_3; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - t), $MachinePrecision] / N[(y - b), $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]}, Block[{t$95$3 = N[(z * N[(N[(t - a), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, -5e-289], t$95$2, If[LessEqual[t$95$2, 0.0], t$95$1, If[LessEqual[t$95$2, 1e+243], t$95$2, If[LessEqual[t$95$2, Infinity], t$95$3, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
t_2 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_3 := \mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b - y, z, y\right)}, x\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-289}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+243}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_3\\
\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 1.0000000000000001e243 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 37.1%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites96.1%
Taylor expanded in z around 0
Applied rewrites81.7%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -5.00000000000000029e-289 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1.0000000000000001e243Initial program 99.4%
if -5.00000000000000029e-289 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -0.0 or +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 12.3%
Taylor expanded in z around inf
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.7
Applied rewrites76.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- b y) z y))
(t_2 (+ y (* z (- b y))))
(t_3 (/ (- a t) (- y b))))
(if (<= z -1.12e+82)
t_3
(if (<= z 5e-181)
(* x (+ (/ y t_2) (/ (* z (- t a)) (* x t_2))))
(if (<= z 8.6e+113) (fma z (/ (- t a) t_1) (* x (/ y t_1))) t_3)))))
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 = y + (z * (b - y));
double t_3 = (a - t) / (y - b);
double tmp;
if (z <= -1.12e+82) {
tmp = t_3;
} else if (z <= 5e-181) {
tmp = x * ((y / t_2) + ((z * (t - a)) / (x * t_2)));
} else if (z <= 8.6e+113) {
tmp = fma(z, ((t - a) / t_1), (x * (y / t_1)));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(b - y), z, y) t_2 = Float64(y + Float64(z * Float64(b - y))) t_3 = Float64(Float64(a - t) / Float64(y - b)) tmp = 0.0 if (z <= -1.12e+82) tmp = t_3; elseif (z <= 5e-181) tmp = Float64(x * Float64(Float64(y / t_2) + Float64(Float64(z * Float64(t - a)) / Float64(x * t_2)))); elseif (z <= 8.6e+113) tmp = fma(z, Float64(Float64(t - a) / t_1), Float64(x * Float64(y / t_1))); else tmp = t_3; 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[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.12e+82], t$95$3, If[LessEqual[z, 5e-181], N[(x * N[(N[(y / t$95$2), $MachinePrecision] + N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] / N[(x * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.6e+113], N[(z * N[(N[(t - a), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(x * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b - y, z, y\right)\\
t_2 := y + z \cdot \left(b - y\right)\\
t_3 := \frac{a - t}{y - b}\\
\mathbf{if}\;z \leq -1.12 \cdot 10^{+82}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-181}:\\
\;\;\;\;x \cdot \left(\frac{y}{t\_2} + \frac{z \cdot \left(t - a\right)}{x \cdot t\_2}\right)\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+113}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{t\_1}, x \cdot \frac{y}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if z < -1.11999999999999998e82 or 8.6000000000000007e113 < z Initial program 35.0%
Taylor expanded in z around inf
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6485.5
Applied rewrites85.5%
if -1.11999999999999998e82 < z < 5.0000000000000001e-181Initial program 84.9%
Taylor expanded in z around 0
Applied rewrites44.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lift--.f6487.0
Applied rewrites87.0%
if 5.0000000000000001e-181 < z < 8.6000000000000007e113Initial program 82.0%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites90.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- a t) (- y b))))
(if (<= z -3e-21)
t_1
(if (<= z 55.0) (fma z (/ (- t a) (fma (- b y) z y)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - t) / (y - b);
double tmp;
if (z <= -3e-21) {
tmp = t_1;
} else if (z <= 55.0) {
tmp = fma(z, ((t - a) / fma((b - y), z, y)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - t) / Float64(y - b)) tmp = 0.0 if (z <= -3e-21) tmp = t_1; elseif (z <= 55.0) tmp = fma(z, Float64(Float64(t - a) / fma(Float64(b - y), z, y)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3e-21], t$95$1, If[LessEqual[z, 55.0], N[(z * N[(N[(t - a), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
\mathbf{if}\;z \leq -3 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 55:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b - y, z, y\right)}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.99999999999999991e-21 or 55 < z Initial program 47.2%
Taylor expanded in z around inf
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6478.6
Applied rewrites78.6%
if -2.99999999999999991e-21 < z < 55Initial program 87.6%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites90.9%
Taylor expanded in z around 0
Applied rewrites75.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- a t) (- y b))))
(if (<= z -3.8e-34)
t_1
(if (<= z 62000.0) (* x (/ y (fma (- b y) z y))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - t) / (y - b);
double tmp;
if (z <= -3.8e-34) {
tmp = t_1;
} else if (z <= 62000.0) {
tmp = x * (y / fma((b - y), z, y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - t) / Float64(y - b)) tmp = 0.0 if (z <= -3.8e-34) tmp = t_1; elseif (z <= 62000.0) tmp = Float64(x * Float64(y / 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[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.8e-34], t$95$1, If[LessEqual[z, 62000.0], N[(x * N[(y / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 62000:\\
\;\;\;\;x \cdot \frac{y}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.8000000000000001e-34 or 62000 < z Initial program 47.6%
Taylor expanded in z around inf
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6478.0
Applied rewrites78.0%
if -3.8000000000000001e-34 < z < 62000Initial program 87.7%
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--.f6457.6
Applied rewrites57.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- a t) (- y b))))
(if (<= z -2.9e-34)
t_1
(if (<= z -7.8e-277) x (if (<= z 2.65e-8) (/ (fma x y (* z t)) y) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - t) / (y - b);
double tmp;
if (z <= -2.9e-34) {
tmp = t_1;
} else if (z <= -7.8e-277) {
tmp = x;
} else if (z <= 2.65e-8) {
tmp = fma(x, y, (z * t)) / y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - t) / Float64(y - b)) tmp = 0.0 if (z <= -2.9e-34) tmp = t_1; elseif (z <= -7.8e-277) tmp = x; elseif (z <= 2.65e-8) tmp = Float64(fma(x, y, Float64(z * t)) / y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.9e-34], t$95$1, If[LessEqual[z, -7.8e-277], x, If[LessEqual[z, 2.65e-8], N[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7.8 \cdot 10^{-277}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{-8}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot t\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.9000000000000002e-34 or 2.6499999999999999e-8 < z Initial program 48.3%
Taylor expanded in z around inf
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6477.4
Applied rewrites77.4%
if -2.9000000000000002e-34 < z < -7.79999999999999973e-277Initial program 87.6%
Taylor expanded in z around 0
Applied rewrites48.2%
if -7.79999999999999973e-277 < z < 2.6499999999999999e-8Initial program 87.7%
Taylor expanded in z around 0
Applied rewrites60.8%
Taylor expanded in t around inf
Applied rewrites48.6%
lift-*.f64N/A
lift-+.f64N/A
lower-fma.f6448.6
Applied rewrites48.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- a t) (- y b)))) (if (<= z -2.9e-34) t_1 (if (<= z 2.15e+35) (/ x (- 1.0 z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - t) / (y - b);
double tmp;
if (z <= -2.9e-34) {
tmp = t_1;
} else if (z <= 2.15e+35) {
tmp = x / (1.0 - 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, 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 = (a - t) / (y - b)
if (z <= (-2.9d-34)) then
tmp = t_1
else if (z <= 2.15d+35) then
tmp = x / (1.0d0 - 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 b) {
double t_1 = (a - t) / (y - b);
double tmp;
if (z <= -2.9e-34) {
tmp = t_1;
} else if (z <= 2.15e+35) {
tmp = x / (1.0 - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - t) / (y - b) tmp = 0 if z <= -2.9e-34: tmp = t_1 elif z <= 2.15e+35: tmp = x / (1.0 - z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - t) / Float64(y - b)) tmp = 0.0 if (z <= -2.9e-34) tmp = t_1; elseif (z <= 2.15e+35) tmp = Float64(x / Float64(1.0 - z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a - t) / (y - b); tmp = 0.0; if (z <= -2.9e-34) tmp = t_1; elseif (z <= 2.15e+35) tmp = x / (1.0 - z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.9e-34], t$95$1, If[LessEqual[z, 2.15e+35], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+35}:\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.9000000000000002e-34 or 2.1499999999999999e35 < z Initial program 46.2%
Taylor expanded in z around inf
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6478.6
Applied rewrites78.6%
if -2.9000000000000002e-34 < z < 2.1499999999999999e35Initial program 87.5%
Taylor expanded in y around -inf
associate-*r/N/A
mul-1-negN/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f6447.5
Applied rewrites47.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ x (- 1.0 z)))) (if (<= y -5.4e-146) t_1 (if (<= y 3.4e+99) (/ (- t a) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 - z);
double tmp;
if (y <= -5.4e-146) {
tmp = t_1;
} else if (y <= 3.4e+99) {
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 / (1.0d0 - z)
if (y <= (-5.4d-146)) then
tmp = t_1
else if (y <= 3.4d+99) 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 / (1.0 - z);
double tmp;
if (y <= -5.4e-146) {
tmp = t_1;
} else if (y <= 3.4e+99) {
tmp = (t - a) / b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x / (1.0 - z) tmp = 0 if y <= -5.4e-146: tmp = t_1 elif y <= 3.4e+99: tmp = (t - a) / b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x / Float64(1.0 - z)) tmp = 0.0 if (y <= -5.4e-146) tmp = t_1; elseif (y <= 3.4e+99) 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 / (1.0 - z); tmp = 0.0; if (y <= -5.4e-146) tmp = t_1; elseif (y <= 3.4e+99) 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[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.4e-146], t$95$1, If[LessEqual[y, 3.4e+99], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{1 - z}\\
\mathbf{if}\;y \leq -5.4 \cdot 10^{-146}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+99}:\\
\;\;\;\;\frac{t - a}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.3999999999999999e-146 or 3.39999999999999984e99 < y Initial program 57.2%
Taylor expanded in y around -inf
associate-*r/N/A
mul-1-negN/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f6447.0
Applied rewrites47.0%
if -5.3999999999999999e-146 < y < 3.39999999999999984e99Initial program 78.3%
Taylor expanded in y around 0
lower-/.f64N/A
lift--.f6455.2
Applied rewrites55.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ t (- b y)))) (if (<= z -3.8e-34) t_1 (if (<= z 8e+79) (/ x (- 1.0 z)) 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 <= -3.8e-34) {
tmp = t_1;
} else if (z <= 8e+79) {
tmp = x / (1.0 - 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, 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 <= (-3.8d-34)) then
tmp = t_1
else if (z <= 8d+79) then
tmp = x / (1.0d0 - 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 b) {
double t_1 = t / (b - y);
double tmp;
if (z <= -3.8e-34) {
tmp = t_1;
} else if (z <= 8e+79) {
tmp = x / (1.0 - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = t / (b - y) tmp = 0 if z <= -3.8e-34: tmp = t_1 elif z <= 8e+79: tmp = x / (1.0 - z) 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 <= -3.8e-34) tmp = t_1; elseif (z <= 8e+79) tmp = Float64(x / Float64(1.0 - z)); 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 <= -3.8e-34) tmp = t_1; elseif (z <= 8e+79) tmp = x / (1.0 - z); 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, -3.8e-34], t$95$1, If[LessEqual[z, 8e+79], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{b - y}\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+79}:\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.8000000000000001e-34 or 7.99999999999999974e79 < z Initial program 44.2%
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--.f6428.2
Applied rewrites28.2%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f6442.9
Applied rewrites42.9%
if -3.8000000000000001e-34 < z < 7.99999999999999974e79Initial program 86.3%
Taylor expanded in y around -inf
associate-*r/N/A
mul-1-negN/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f6446.0
Applied rewrites46.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ t (- b y)))) (if (<= z -3.8e-34) t_1 (if (<= z 8.2e-7) x 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 <= -3.8e-34) {
tmp = t_1;
} else if (z <= 8.2e-7) {
tmp = 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 / (b - y)
if (z <= (-3.8d-34)) then
tmp = t_1
else if (z <= 8.2d-7) then
tmp = 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 / (b - y);
double tmp;
if (z <= -3.8e-34) {
tmp = t_1;
} else if (z <= 8.2e-7) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = t / (b - y) tmp = 0 if z <= -3.8e-34: tmp = t_1 elif z <= 8.2e-7: tmp = x 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 <= -3.8e-34) tmp = t_1; elseif (z <= 8.2e-7) tmp = x; 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 <= -3.8e-34) tmp = t_1; elseif (z <= 8.2e-7) tmp = x; 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, -3.8e-34], t$95$1, If[LessEqual[z, 8.2e-7], x, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{b - y}\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-7}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.8000000000000001e-34 or 8.1999999999999998e-7 < z Initial program 48.3%
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--.f6429.0
Applied rewrites29.0%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f6441.8
Applied rewrites41.8%
if -3.8000000000000001e-34 < z < 8.1999999999999998e-7Initial program 87.6%
Taylor expanded in z around 0
Applied rewrites48.6%
(FPCore (x y z t a b) :precision binary64 (if (<= z -3.8e-34) (/ t b) (if (<= z 8.2e-7) x (/ t b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.8e-34) {
tmp = t / b;
} else if (z <= 8.2e-7) {
tmp = x;
} else {
tmp = t / b;
}
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 (z <= (-3.8d-34)) then
tmp = t / b
else if (z <= 8.2d-7) then
tmp = x
else
tmp = t / b
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 (z <= -3.8e-34) {
tmp = t / b;
} else if (z <= 8.2e-7) {
tmp = x;
} else {
tmp = t / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -3.8e-34: tmp = t / b elif z <= 8.2e-7: tmp = x else: tmp = t / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.8e-34) tmp = Float64(t / b); elseif (z <= 8.2e-7) tmp = x; else tmp = Float64(t / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -3.8e-34) tmp = t / b; elseif (z <= 8.2e-7) tmp = x; else tmp = t / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.8e-34], N[(t / b), $MachinePrecision], If[LessEqual[z, 8.2e-7], x, N[(t / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-34}:\\
\;\;\;\;\frac{t}{b}\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-7}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{b}\\
\end{array}
\end{array}
if z < -3.8000000000000001e-34 or 8.1999999999999998e-7 < z Initial program 48.3%
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--.f6429.0
Applied rewrites29.0%
Taylor expanded in y around 0
lower-/.f6426.8
Applied rewrites26.8%
if -3.8000000000000001e-34 < z < 8.1999999999999998e-7Initial program 87.6%
Taylor expanded in z around 0
Applied rewrites48.6%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, 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
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 67.0%
Taylor expanded in z around 0
Applied rewrites25.6%
herbie shell --seed 2025110
(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)))))