
(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}
Sampling outcomes in binary64 precision:
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 (/ (- 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 y (/ x t_2) (* (- t a) (/ z t_2)))))
(if (<= t_3 (- INFINITY))
t_4
(if (<= t_3 -1e-229)
t_3
(if (<= t_3 0.0)
t_1
(if (<= t_3 1e+250) 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(y, (x / t_2), ((t - a) * (z / t_2)));
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_3 <= -1e-229) {
tmp = t_3;
} else if (t_3 <= 0.0) {
tmp = t_1;
} else if (t_3 <= 1e+250) {
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 = fma(y, Float64(x / t_2), Float64(Float64(t - a) * Float64(z / t_2))) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_4; elseif (t_3 <= -1e-229) tmp = t_3; elseif (t_3 <= 0.0) tmp = t_1; elseif (t_3 <= 1e+250) 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[(y * N[(x / t$95$2), $MachinePrecision] + N[(N[(t - a), $MachinePrecision] * N[(z / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, -1e-229], t$95$3, If[LessEqual[t$95$3, 0.0], t$95$1, If[LessEqual[t$95$3, 1e+250], 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(y, \frac{x}{t\_2}, \left(t - a\right) \cdot \frac{z}{t\_2}\right)\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-229}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 10^{+250}:\\
\;\;\;\;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 9.9999999999999992e249 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 26.5%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.5
lift-+.f64N/A
Applied rewrites99.5%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000000000007e-229 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.9999999999999992e249Initial program 99.5%
if -1.00000000000000007e-229 < (/.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 9.4%
Taylor expanded in z around inf
Applied rewrites76.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (- b y)))
(t_2
(-
(/ (fma (/ x z) y (- t a)) (- b y))
(* (/ y (pow (- b y) 2.0)) (/ (- t a) z))))
(t_3 (/ (+ (* x y) (* z (- t a))) (+ y t_1)))
(t_4 (fma (- b y) z y))
(t_5 (/ (- t a) t_4))
(t_6 (<= t_3 INFINITY)))
(if (<= t_3 (- INFINITY))
(fma z t_5 (* y (/ x (+ t_1 y))))
(if (<= t_3 -1e-229)
t_3
(if (<= t_3 0.0)
t_2
(if t_6 t_3 (if t_6 (fma z t_5 (* y (/ x t_4))) t_2)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * (b - y);
double t_2 = (fma((x / z), y, (t - a)) / (b - y)) - ((y / pow((b - y), 2.0)) * ((t - a) / z));
double t_3 = ((x * y) + (z * (t - a))) / (y + t_1);
double t_4 = fma((b - y), z, y);
double t_5 = (t - a) / t_4;
int t_6 = t_3 <= ((double) INFINITY);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = fma(z, t_5, (y * (x / (t_1 + y))));
} else if (t_3 <= -1e-229) {
tmp = t_3;
} else if (t_3 <= 0.0) {
tmp = t_2;
} else if (t_6) {
tmp = t_3;
} else if (t_6) {
tmp = fma(z, t_5, (y * (x / t_4)));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(b - y)) t_2 = Float64(Float64(fma(Float64(x / z), y, Float64(t - a)) / Float64(b - y)) - Float64(Float64(y / (Float64(b - y) ^ 2.0)) * Float64(Float64(t - a) / z))) t_3 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + t_1)) t_4 = fma(Float64(b - y), z, y) t_5 = Float64(Float64(t - a) / t_4) t_6 = t_3 <= Inf tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = fma(z, t_5, Float64(y * Float64(x / Float64(t_1 + y)))); elseif (t_3 <= -1e-229) tmp = t_3; elseif (t_3 <= 0.0) tmp = t_2; elseif (t_6) tmp = t_3; elseif (t_6) tmp = fma(z, t_5, Float64(y * Float64(x / t_4))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(x / z), $MachinePrecision] * y + N[(t - a), $MachinePrecision]), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision] - N[(N[(y / N[Power[N[(b - y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(t - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$5 = N[(N[(t - a), $MachinePrecision] / t$95$4), $MachinePrecision]}, Block[{t$95$6 = LessEqual[t$95$3, Infinity]}, If[LessEqual[t$95$3, (-Infinity)], N[(z * t$95$5 + N[(y * N[(x / N[(t$95$1 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -1e-229], t$95$3, If[LessEqual[t$95$3, 0.0], t$95$2, If[t$95$6, t$95$3, If[t$95$6, N[(z * t$95$5 + N[(y * N[(x / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(b - y\right)\\
t_2 := \frac{\mathsf{fma}\left(\frac{x}{z}, y, t - a\right)}{b - y} - \frac{y}{{\left(b - y\right)}^{2}} \cdot \frac{t - a}{z}\\
t_3 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + t\_1}\\
t_4 := \mathsf{fma}\left(b - y, z, y\right)\\
t_5 := \frac{t - a}{t\_4}\\
t_6 := t\_3 \leq \infty\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(z, t\_5, y \cdot \frac{x}{t\_1 + y}\right)\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-229}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_6:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_6:\\
\;\;\;\;\mathsf{fma}\left(z, t\_5, y \cdot \frac{x}{t\_4}\right)\\
\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.0Initial program 18.3%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.5
lift-+.f64N/A
Applied rewrites99.5%
lift-fma.f64N/A
*-commutativeN/A
lift--.f64N/A
lower-+.f64N/A
lift--.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000000000007e-229 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 87.8%
if -1.00000000000000007e-229 < (/.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 9.4%
Taylor expanded in z around inf
Applied rewrites95.2%
if +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 60.7%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6470.9
lift-+.f64N/A
Applied rewrites70.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (- b y)))
(t_2 (/ (+ (* x y) (* z (- t a))) (+ y t_1)))
(t_3 (<= t_2 INFINITY))
(t_4 (fma (- b y) z y))
(t_5 (/ (- t a) t_4)))
(if (<= t_2 (- INFINITY))
(fma z t_5 (* y (/ x (+ t_1 y))))
(if (<= t_2 -1e-229)
t_2
(if (<= t_2 0.0)
(-
(/
(+
(/
(* (/ (fma (- x) y (/ (* (- t a) y) (- b y))) (- b y)) y)
(* z z))
(fma (/ y z) x t))
(- b y))
(/ (+ (/ (* y (/ (- t a) z)) (- b y)) a) (- b y)))
(if t_3
t_2
(if t_3 (fma z t_5 (* y (/ x t_4))) (/ (- t a) (- b y)))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * (b - y);
double t_2 = ((x * y) + (z * (t - a))) / (y + t_1);
int t_3 = t_2 <= ((double) INFINITY);
double t_4 = fma((b - y), z, y);
double t_5 = (t - a) / t_4;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(z, t_5, (y * (x / (t_1 + y))));
} else if (t_2 <= -1e-229) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = (((((fma(-x, y, (((t - a) * y) / (b - y))) / (b - y)) * y) / (z * z)) + fma((y / z), x, t)) / (b - y)) - ((((y * ((t - a) / z)) / (b - y)) + a) / (b - y));
} else if (t_3) {
tmp = t_2;
} else if (t_3) {
tmp = fma(z, t_5, (y * (x / t_4)));
} else {
tmp = (t - a) / (b - y);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(b - y)) t_2 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + t_1)) t_3 = t_2 <= Inf t_4 = fma(Float64(b - y), z, y) t_5 = Float64(Float64(t - a) / t_4) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(z, t_5, Float64(y * Float64(x / Float64(t_1 + y)))); elseif (t_2 <= -1e-229) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(Float64(Float64(Float64(Float64(Float64(fma(Float64(-x), y, Float64(Float64(Float64(t - a) * y) / Float64(b - y))) / Float64(b - y)) * y) / Float64(z * z)) + fma(Float64(y / z), x, t)) / Float64(b - y)) - Float64(Float64(Float64(Float64(y * Float64(Float64(t - a) / z)) / Float64(b - y)) + a) / Float64(b - y))); elseif (t_3) tmp = t_2; elseif (t_3) tmp = fma(z, t_5, Float64(y * Float64(x / t_4))); else tmp = Float64(Float64(t - a) / Float64(b - y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * 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 + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = LessEqual[t$95$2, Infinity]}, Block[{t$95$4 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$5 = N[(N[(t - a), $MachinePrecision] / t$95$4), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(z * t$95$5 + N[(y * N[(x / N[(t$95$1 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e-229], t$95$2, If[LessEqual[t$95$2, 0.0], N[(N[(N[(N[(N[(N[(N[((-x) * y + N[(N[(N[(t - a), $MachinePrecision] * y), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(N[(y / z), $MachinePrecision] * x + t), $MachinePrecision]), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(y * N[(N[(t - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[t$95$3, t$95$2, If[t$95$3, N[(z * t$95$5 + N[(y * N[(x / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(b - y\right)\\
t_2 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + t\_1}\\
t_3 := t\_2 \leq \infty\\
t_4 := \mathsf{fma}\left(b - y, z, y\right)\\
t_5 := \frac{t - a}{t\_4}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(z, t\_5, y \cdot \frac{x}{t\_1 + y}\right)\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-229}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(-x, y, \frac{\left(t - a\right) \cdot y}{b - y}\right)}{b - y} \cdot y}{z \cdot z} + \mathsf{fma}\left(\frac{y}{z}, x, t\right)}{b - y} - \frac{\frac{y \cdot \frac{t - a}{z}}{b - y} + a}{b - y}\\
\mathbf{elif}\;t\_3:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3:\\
\;\;\;\;\mathsf{fma}\left(z, t\_5, y \cdot \frac{x}{t\_4}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t - a}{b - y}\\
\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 18.3%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.5
lift-+.f64N/A
Applied rewrites99.5%
lift-fma.f64N/A
*-commutativeN/A
lift--.f64N/A
lower-+.f64N/A
lift--.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000000000007e-229 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 87.8%
if -1.00000000000000007e-229 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0Initial program 33.2%
Taylor expanded in z around inf
Applied rewrites94.6%
if +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 60.7%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6470.9
lift-+.f64N/A
Applied rewrites70.9%
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
Applied rewrites73.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (- b y)))
(t_2 (/ (- t a) (- b y)))
(t_3 (/ (+ (* x y) (* z (- t a))) (+ y t_1)))
(t_4 (<= t_3 INFINITY))
(t_5 (fma (- b y) z y))
(t_6 (/ (- t a) t_5)))
(if (<= t_3 (- INFINITY))
(fma z t_6 (* y (/ x (+ t_1 y))))
(if (<= t_3 -1e-229)
t_3
(if (<= t_3 0.0)
t_2
(if t_4 t_3 (if t_4 (fma z t_6 (* y (/ x t_5))) t_2)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * (b - y);
double t_2 = (t - a) / (b - y);
double t_3 = ((x * y) + (z * (t - a))) / (y + t_1);
int t_4 = t_3 <= ((double) INFINITY);
double t_5 = fma((b - y), z, y);
double t_6 = (t - a) / t_5;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = fma(z, t_6, (y * (x / (t_1 + y))));
} else if (t_3 <= -1e-229) {
tmp = t_3;
} else if (t_3 <= 0.0) {
tmp = t_2;
} else if (t_4) {
tmp = t_3;
} else if (t_4) {
tmp = fma(z, t_6, (y * (x / t_5)));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(b - y)) t_2 = Float64(Float64(t - a) / Float64(b - y)) t_3 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + t_1)) t_4 = t_3 <= Inf t_5 = fma(Float64(b - y), z, y) t_6 = Float64(Float64(t - a) / t_5) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = fma(z, t_6, Float64(y * Float64(x / Float64(t_1 + y)))); elseif (t_3 <= -1e-229) tmp = t_3; elseif (t_3 <= 0.0) tmp = t_2; elseif (t_4) tmp = t_3; elseif (t_4) tmp = fma(z, t_6, Float64(y * Float64(x / t_5))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(b - y), $MachinePrecision]), $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 + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = LessEqual[t$95$3, Infinity]}, Block[{t$95$5 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$6 = N[(N[(t - a), $MachinePrecision] / t$95$5), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(z * t$95$6 + N[(y * N[(x / N[(t$95$1 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -1e-229], t$95$3, If[LessEqual[t$95$3, 0.0], t$95$2, If[t$95$4, t$95$3, If[t$95$4, N[(z * t$95$6 + N[(y * N[(x / t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(b - y\right)\\
t_2 := \frac{t - a}{b - y}\\
t_3 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + t\_1}\\
t_4 := t\_3 \leq \infty\\
t_5 := \mathsf{fma}\left(b - y, z, y\right)\\
t_6 := \frac{t - a}{t\_5}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(z, t\_6, y \cdot \frac{x}{t\_1 + y}\right)\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-229}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4:\\
\;\;\;\;\mathsf{fma}\left(z, t\_6, y \cdot \frac{x}{t\_5}\right)\\
\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.0Initial program 18.3%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.5
lift-+.f64N/A
Applied rewrites99.5%
lift-fma.f64N/A
*-commutativeN/A
lift--.f64N/A
lower-+.f64N/A
lift--.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000000000007e-229 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 87.8%
if -1.00000000000000007e-229 < (/.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 9.4%
Taylor expanded in z around inf
Applied rewrites76.3%
if +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 60.7%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6470.9
lift-+.f64N/A
Applied rewrites70.9%
(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 (<= t_3 INFINITY))
(t_5 (fma z (/ (- t a) t_2) (* y (/ x t_2)))))
(if (<= t_3 (- INFINITY))
t_5
(if (<= t_3 -1e-229)
t_3
(if (<= t_3 0.0) t_1 (if t_4 t_3 (if t_4 t_5 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)));
int t_4 = t_3 <= ((double) INFINITY);
double t_5 = fma(z, ((t - a) / t_2), (y * (x / t_2)));
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_5;
} else if (t_3 <= -1e-229) {
tmp = t_3;
} else if (t_3 <= 0.0) {
tmp = t_1;
} else if (t_4) {
tmp = t_3;
} else if (t_4) {
tmp = t_5;
} 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 = t_3 <= Inf t_5 = fma(z, Float64(Float64(t - a) / t_2), Float64(y * Float64(x / t_2))) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_5; elseif (t_3 <= -1e-229) tmp = t_3; elseif (t_3 <= 0.0) tmp = t_1; elseif (t_4) tmp = t_3; elseif (t_4) tmp = t_5; 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 = LessEqual[t$95$3, Infinity]}, Block[{t$95$5 = N[(z * N[(N[(t - a), $MachinePrecision] / t$95$2), $MachinePrecision] + N[(y * N[(x / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$5, If[LessEqual[t$95$3, -1e-229], t$95$3, If[LessEqual[t$95$3, 0.0], t$95$1, If[t$95$4, t$95$3, If[t$95$4, t$95$5, 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 := t\_3 \leq \infty\\
t_5 := \mathsf{fma}\left(z, \frac{t - a}{t\_2}, y \cdot \frac{x}{t\_2}\right)\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-229}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4:\\
\;\;\;\;t\_5\\
\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 +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 18.3%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.5
lift-+.f64N/A
Applied rewrites99.5%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000000000007e-229 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 87.8%
if -1.00000000000000007e-229 < (/.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 9.4%
Taylor expanded in z around inf
Applied rewrites76.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (* z (- b y))))
(t_2 (/ (- t a) (- b y)))
(t_3 (fma z (/ (- t a) (fma (- b y) z y)) x))
(t_4 (/ (+ (* x y) (* z (- t a))) t_1))
(t_5 (<= t_4 INFINITY)))
(if (<= t_4 -4e+281)
t_3
(if (<= t_4 -1e-229)
(/ (+ (* x y) (* (- z (/ (* a z) t)) t)) t_1)
(if (<= t_4 0.0) t_2 (if t_5 t_4 (if t_5 t_3 t_2)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (z * (b - y));
double t_2 = (t - a) / (b - y);
double t_3 = fma(z, ((t - a) / fma((b - y), z, y)), x);
double t_4 = ((x * y) + (z * (t - a))) / t_1;
int t_5 = t_4 <= ((double) INFINITY);
double tmp;
if (t_4 <= -4e+281) {
tmp = t_3;
} else if (t_4 <= -1e-229) {
tmp = ((x * y) + ((z - ((a * z) / t)) * t)) / t_1;
} else if (t_4 <= 0.0) {
tmp = t_2;
} else if (t_5) {
tmp = t_4;
} else if (t_5) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(z * Float64(b - y))) t_2 = Float64(Float64(t - a) / Float64(b - y)) t_3 = fma(z, Float64(Float64(t - a) / fma(Float64(b - y), z, y)), x) t_4 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / t_1) t_5 = t_4 <= Inf tmp = 0.0 if (t_4 <= -4e+281) tmp = t_3; elseif (t_4 <= -1e-229) tmp = Float64(Float64(Float64(x * y) + Float64(Float64(z - Float64(Float64(a * z) / t)) * t)) / t_1); elseif (t_4 <= 0.0) tmp = t_2; elseif (t_5) tmp = t_4; elseif (t_5) tmp = t_3; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(z * N[(N[(t - a), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$5 = LessEqual[t$95$4, Infinity]}, If[LessEqual[t$95$4, -4e+281], t$95$3, If[LessEqual[t$95$4, -1e-229], N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z - N[(N[(a * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$4, 0.0], t$95$2, If[t$95$5, t$95$4, If[t$95$5, t$95$3, t$95$2]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + z \cdot \left(b - y\right)\\
t_2 := \frac{t - a}{b - y}\\
t_3 := \mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b - y, z, y\right)}, x\right)\\
t_4 := \frac{x \cdot y + z \cdot \left(t - a\right)}{t\_1}\\
t_5 := t\_4 \leq \infty\\
\mathbf{if}\;t\_4 \leq -4 \cdot 10^{+281}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq -1 \cdot 10^{-229}:\\
\;\;\;\;\frac{x \cdot y + \left(z - \frac{a \cdot z}{t}\right) \cdot t}{t\_1}\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_5:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_5:\\
\;\;\;\;t\_3\\
\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)))) < -4.0000000000000001e281 or +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 23.1%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6496.9
lift-+.f64N/A
Applied rewrites96.8%
Taylor expanded in z around 0
Applied rewrites88.4%
if -4.0000000000000001e281 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000000000007e-229Initial program 99.5%
Taylor expanded in t around inf
Applied rewrites99.5%
if -1.00000000000000007e-229 < (/.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 9.4%
Taylor expanded in z around inf
Applied rewrites76.3%
if 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 81.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y)))
(t_2 (fma z (/ (- t a) (fma (- b y) z y)) x))
(t_3 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_4 (<= t_3 INFINITY)))
(if (<= t_3 -4e+281)
t_2
(if (<= t_3 -1e-229)
t_3
(if (<= t_3 0.0) t_1 (if t_4 t_3 (if t_4 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(z, ((t - a) / fma((b - y), z, y)), x);
double t_3 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
int t_4 = t_3 <= ((double) INFINITY);
double tmp;
if (t_3 <= -4e+281) {
tmp = t_2;
} else if (t_3 <= -1e-229) {
tmp = t_3;
} else if (t_3 <= 0.0) {
tmp = t_1;
} else if (t_4) {
tmp = t_3;
} else if (t_4) {
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 = fma(z, Float64(Float64(t - a) / fma(Float64(b - y), z, y)), x) t_3 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_4 = t_3 <= Inf tmp = 0.0 if (t_3 <= -4e+281) tmp = t_2; elseif (t_3 <= -1e-229) tmp = t_3; elseif (t_3 <= 0.0) tmp = t_1; elseif (t_4) tmp = t_3; elseif (t_4) 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[(z * N[(N[(t - a), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] + x), $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 = LessEqual[t$95$3, Infinity]}, If[LessEqual[t$95$3, -4e+281], t$95$2, If[LessEqual[t$95$3, -1e-229], t$95$3, If[LessEqual[t$95$3, 0.0], t$95$1, If[t$95$4, t$95$3, If[t$95$4, t$95$2, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
t_2 := \mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b - y, z, y\right)}, x\right)\\
t_3 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_4 := t\_3 \leq \infty\\
\mathbf{if}\;t\_3 \leq -4 \cdot 10^{+281}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-229}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4:\\
\;\;\;\;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)))) < -4.0000000000000001e281 or +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 23.1%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6496.9
lift-+.f64N/A
Applied rewrites96.8%
Taylor expanded in z around 0
Applied rewrites88.4%
if -4.0000000000000001e281 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000000000007e-229 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 87.6%
if -1.00000000000000007e-229 < (/.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 9.4%
Taylor expanded in z around inf
Applied rewrites76.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- b y) z y)) (t_2 (/ (- t a) (- b y))))
(if (<= z -1.35e-24)
t_2
(if (<= z -1.12e-175)
(/ (fma t z (* y x)) t_1)
(if (<= z 15500000000.0) (fma z (/ (- t a) t_1) x) 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 tmp;
if (z <= -1.35e-24) {
tmp = t_2;
} else if (z <= -1.12e-175) {
tmp = fma(t, z, (y * x)) / t_1;
} else if (z <= 15500000000.0) {
tmp = fma(z, ((t - a) / t_1), x);
} 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)) tmp = 0.0 if (z <= -1.35e-24) tmp = t_2; elseif (z <= -1.12e-175) tmp = Float64(fma(t, z, Float64(y * x)) / t_1); elseif (z <= 15500000000.0) tmp = fma(z, Float64(Float64(t - a) / t_1), x); 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]}, If[LessEqual[z, -1.35e-24], t$95$2, If[LessEqual[z, -1.12e-175], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[z, 15500000000.0], N[(z * N[(N[(t - a), $MachinePrecision] / t$95$1), $MachinePrecision] + x), $MachinePrecision], 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}\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{-24}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -1.12 \cdot 10^{-175}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{t\_1}\\
\mathbf{elif}\;z \leq 15500000000:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{t\_1}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -1.35000000000000003e-24 or 1.55e10 < z Initial program 38.9%
Taylor expanded in z around inf
Applied rewrites80.6%
if -1.35000000000000003e-24 < z < -1.1200000000000001e-175Initial program 89.0%
Taylor expanded in a around 0
Applied rewrites72.0%
if -1.1200000000000001e-175 < z < 1.55e10Initial program 80.0%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6483.6
lift-+.f64N/A
Applied rewrites83.6%
Taylor expanded in z around 0
Applied rewrites82.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- b y) z y)) (t_2 (/ (- t a) (- b y))))
(if (<= z -3.3e+15)
t_2
(if (<= z -1.65e-183)
(* (- t a) (/ z t_1))
(if (<= z 9.2e-5) (* (/ y t_1) x) 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 tmp;
if (z <= -3.3e+15) {
tmp = t_2;
} else if (z <= -1.65e-183) {
tmp = (t - a) * (z / t_1);
} else if (z <= 9.2e-5) {
tmp = (y / t_1) * x;
} 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)) tmp = 0.0 if (z <= -3.3e+15) tmp = t_2; elseif (z <= -1.65e-183) tmp = Float64(Float64(t - a) * Float64(z / t_1)); elseif (z <= 9.2e-5) tmp = Float64(Float64(y / t_1) * x); 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]}, If[LessEqual[z, -3.3e+15], t$95$2, If[LessEqual[z, -1.65e-183], N[(N[(t - a), $MachinePrecision] * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.2e-5], N[(N[(y / t$95$1), $MachinePrecision] * x), $MachinePrecision], 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}\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+15}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{-183}:\\
\;\;\;\;\left(t - a\right) \cdot \frac{z}{t\_1}\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-5}:\\
\;\;\;\;\frac{y}{t\_1} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -3.3e15 or 9.20000000000000001e-5 < z Initial program 38.1%
Taylor expanded in z around inf
Applied rewrites80.8%
if -3.3e15 < z < -1.65e-183Initial program 88.7%
Taylor expanded in x around 0
Applied rewrites61.5%
if -1.65e-183 < z < 9.20000000000000001e-5Initial program 79.1%
Taylor expanded in x around inf
Applied rewrites64.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -7.2e-26) (not (<= z 15500000000.0))) (/ (- t a) (- b y)) (fma z (/ (- t a) (fma (- b y) z y)) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -7.2e-26) || !(z <= 15500000000.0)) {
tmp = (t - a) / (b - y);
} else {
tmp = fma(z, ((t - a) / fma((b - y), z, y)), x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -7.2e-26) || !(z <= 15500000000.0)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = fma(z, Float64(Float64(t - a) / fma(Float64(b - y), z, y)), x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -7.2e-26], N[Not[LessEqual[z, 15500000000.0]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(t - a), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-26} \lor \neg \left(z \leq 15500000000\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b - y, z, y\right)}, x\right)\\
\end{array}
\end{array}
if z < -7.2000000000000003e-26 or 1.55e10 < z Initial program 39.3%
Taylor expanded in z around inf
Applied rewrites80.0%
if -7.2000000000000003e-26 < z < 1.55e10Initial program 81.8%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6484.7
lift-+.f64N/A
Applied rewrites84.7%
Taylor expanded in z around 0
Applied rewrites77.6%
Final simplification78.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -6.8e-68) (not (<= z 9.2e-5))) (/ (- t a) (- b y)) (* (/ y (fma (- b y) z y)) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -6.8e-68) || !(z <= 9.2e-5)) {
tmp = (t - a) / (b - y);
} else {
tmp = (y / fma((b - y), z, y)) * x;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -6.8e-68) || !(z <= 9.2e-5)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(Float64(y / fma(Float64(b - y), z, y)) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -6.8e-68], N[Not[LessEqual[z, 9.2e-5]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{-68} \lor \neg \left(z \leq 9.2 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(b - y, z, y\right)} \cdot x\\
\end{array}
\end{array}
if z < -6.80000000000000037e-68 or 9.20000000000000001e-5 < z Initial program 43.4%
Taylor expanded in z around inf
Applied rewrites78.5%
if -6.80000000000000037e-68 < z < 9.20000000000000001e-5Initial program 81.0%
Taylor expanded in x around inf
Applied rewrites60.9%
Final simplification70.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -9.5e-137) (not (<= z 2.8e-59))) (/ (- t a) (- b y)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -9.5e-137) || !(z <= 2.8e-59)) {
tmp = (t - a) / (b - y);
} else {
tmp = x;
}
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 <= (-9.5d-137)) .or. (.not. (z <= 2.8d-59))) then
tmp = (t - a) / (b - y)
else
tmp = x
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 <= -9.5e-137) || !(z <= 2.8e-59)) {
tmp = (t - a) / (b - y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -9.5e-137) or not (z <= 2.8e-59): tmp = (t - a) / (b - y) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -9.5e-137) || !(z <= 2.8e-59)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -9.5e-137) || ~((z <= 2.8e-59))) tmp = (t - a) / (b - y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -9.5e-137], N[Not[LessEqual[z, 2.8e-59]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-137} \lor \neg \left(z \leq 2.8 \cdot 10^{-59}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.5000000000000007e-137 or 2.79999999999999981e-59 < z Initial program 48.2%
Taylor expanded in z around inf
Applied rewrites73.0%
if -9.5000000000000007e-137 < z < 2.79999999999999981e-59Initial program 81.5%
Taylor expanded in z around 0
Applied rewrites61.1%
Final simplification68.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -0.00019) (not (<= y 1.75e+31))) (/ x (- 1.0 z)) (/ (- t a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -0.00019) || !(y <= 1.75e+31)) {
tmp = x / (1.0 - z);
} else {
tmp = (t - a) / 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 ((y <= (-0.00019d0)) .or. (.not. (y <= 1.75d+31))) then
tmp = x / (1.0d0 - z)
else
tmp = (t - a) / 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 ((y <= -0.00019) || !(y <= 1.75e+31)) {
tmp = x / (1.0 - z);
} else {
tmp = (t - a) / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -0.00019) or not (y <= 1.75e+31): tmp = x / (1.0 - z) else: tmp = (t - a) / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -0.00019) || !(y <= 1.75e+31)) tmp = Float64(x / Float64(1.0 - z)); else tmp = Float64(Float64(t - a) / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -0.00019) || ~((y <= 1.75e+31))) tmp = x / (1.0 - z); else tmp = (t - a) / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -0.00019], N[Not[LessEqual[y, 1.75e+31]], $MachinePrecision]], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00019 \lor \neg \left(y \leq 1.75 \cdot 10^{+31}\right):\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t - a}{b}\\
\end{array}
\end{array}
if y < -1.9000000000000001e-4 or 1.75e31 < y Initial program 44.8%
Taylor expanded in y around inf
Applied rewrites56.6%
if -1.9000000000000001e-4 < y < 1.75e31Initial program 75.7%
Taylor expanded in y around 0
Applied rewrites58.3%
Final simplification57.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -3.2e-7) (not (<= y 4.2e-131))) (/ x (- 1.0 z)) (/ t b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -3.2e-7) || !(y <= 4.2e-131)) {
tmp = x / (1.0 - z);
} 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 ((y <= (-3.2d-7)) .or. (.not. (y <= 4.2d-131))) then
tmp = x / (1.0d0 - z)
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 ((y <= -3.2e-7) || !(y <= 4.2e-131)) {
tmp = x / (1.0 - z);
} else {
tmp = t / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -3.2e-7) or not (y <= 4.2e-131): tmp = x / (1.0 - z) else: tmp = t / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -3.2e-7) || !(y <= 4.2e-131)) tmp = Float64(x / Float64(1.0 - z)); else tmp = Float64(t / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -3.2e-7) || ~((y <= 4.2e-131))) tmp = x / (1.0 - z); else tmp = t / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -3.2e-7], N[Not[LessEqual[y, 4.2e-131]], $MachinePrecision]], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(t / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-7} \lor \neg \left(y \leq 4.2 \cdot 10^{-131}\right):\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{b}\\
\end{array}
\end{array}
if y < -3.2000000000000001e-7 or 4.19999999999999994e-131 < y Initial program 49.7%
Taylor expanded in y around inf
Applied rewrites48.7%
if -3.2000000000000001e-7 < y < 4.19999999999999994e-131Initial program 78.7%
Taylor expanded in b around inf
Applied rewrites59.3%
Taylor expanded in t around inf
Applied rewrites40.5%
Final simplification45.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -6.5e-133) (not (<= z 2.8e-9))) (/ t b) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -6.5e-133) || !(z <= 2.8e-9)) {
tmp = t / b;
} else {
tmp = x;
}
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 <= (-6.5d-133)) .or. (.not. (z <= 2.8d-9))) then
tmp = t / b
else
tmp = x
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 <= -6.5e-133) || !(z <= 2.8e-9)) {
tmp = t / b;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -6.5e-133) or not (z <= 2.8e-9): tmp = t / b else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -6.5e-133) || !(z <= 2.8e-9)) tmp = Float64(t / b); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -6.5e-133) || ~((z <= 2.8e-9))) tmp = t / b; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -6.5e-133], N[Not[LessEqual[z, 2.8e-9]], $MachinePrecision]], N[(t / b), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{-133} \lor \neg \left(z \leq 2.8 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{t}{b}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.5000000000000002e-133 or 2.79999999999999984e-9 < z Initial program 46.7%
Taylor expanded in b around inf
Applied rewrites35.6%
Taylor expanded in t around inf
Applied rewrites29.3%
if -6.5000000000000002e-133 < z < 2.79999999999999984e-9Initial program 80.6%
Taylor expanded in z around 0
Applied rewrites58.2%
Final simplification41.3%
(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 60.7%
Taylor expanded in z around 0
Applied rewrites27.0%
(FPCore (x y z t a b) :precision binary64 (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z)))))
double code(double x, double y, double z, double t, double a, double b) {
return (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, 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 = (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)));
}
def code(x, y, z, t, a, b): return (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(z * t) + Float64(y * x)) / Float64(y + Float64(z * Float64(b - y)))) - Float64(a / Float64(Float64(b - y) + Float64(y / z)))) end
function tmp = code(x, y, z, t, a, b) tmp = (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(z * t), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[(N[(b - y), $MachinePrecision] + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{z \cdot t + y \cdot x}{y + z \cdot \left(b - y\right)} - \frac{a}{\left(b - y\right) + \frac{y}{z}}
\end{array}
herbie shell --seed 2025019
(FPCore (x y z t a b)
:name "Development.Shake.Progress:decay from shake-0.15.5"
:precision binary64
:alt
(! :herbie-platform default (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z)))))
(/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))