
(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 (fma (- b y) z y))
(t_2 (+ y (* z (- b y))))
(t_3 (/ (fma y x (* (- t a) z)) t_2))
(t_4 (/ (- t a) (- b y)))
(t_5 (/ (+ (* x y) (* z (- t a))) t_2))
(t_6 (* x (/ y t_1))))
(if (<= t_5 (- INFINITY))
(fma z (/ (- t a) (fma b z (* y (- 1.0 z)))) t_6)
(if (<= t_5 -1e-313)
t_3
(if (<= t_5 0.0)
(fma
(/ (- (* x (/ y (- b y))) (/ (* (- t a) y) (pow (- b y) 2.0))) (- z))
-1.0
t_4)
(if (<= t_5 2e+290)
t_3
(if (<= t_5 INFINITY) (fma z (/ (- t a) t_1) t_6) t_4)))))))
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 = fma(y, x, ((t - a) * z)) / t_2;
double t_4 = (t - a) / (b - y);
double t_5 = ((x * y) + (z * (t - a))) / t_2;
double t_6 = x * (y / t_1);
double tmp;
if (t_5 <= -((double) INFINITY)) {
tmp = fma(z, ((t - a) / fma(b, z, (y * (1.0 - z)))), t_6);
} else if (t_5 <= -1e-313) {
tmp = t_3;
} else if (t_5 <= 0.0) {
tmp = fma((((x * (y / (b - y))) - (((t - a) * y) / pow((b - y), 2.0))) / -z), -1.0, t_4);
} else if (t_5 <= 2e+290) {
tmp = t_3;
} else if (t_5 <= ((double) INFINITY)) {
tmp = fma(z, ((t - a) / t_1), t_6);
} else {
tmp = t_4;
}
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(fma(y, x, Float64(Float64(t - a) * z)) / t_2) t_4 = Float64(Float64(t - a) / Float64(b - y)) t_5 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / t_2) t_6 = Float64(x * Float64(y / t_1)) tmp = 0.0 if (t_5 <= Float64(-Inf)) tmp = fma(z, Float64(Float64(t - a) / fma(b, z, Float64(y * Float64(1.0 - z)))), t_6); elseif (t_5 <= -1e-313) tmp = t_3; elseif (t_5 <= 0.0) tmp = fma(Float64(Float64(Float64(x * Float64(y / Float64(b - y))) - Float64(Float64(Float64(t - a) * y) / (Float64(b - y) ^ 2.0))) / Float64(-z)), -1.0, t_4); elseif (t_5 <= 2e+290) tmp = t_3; elseif (t_5 <= Inf) tmp = fma(z, Float64(Float64(t - a) / t_1), t_6); else tmp = t_4; 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[(y * x + N[(N[(t - a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$6 = N[(x * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, (-Infinity)], N[(z * N[(N[(t - a), $MachinePrecision] / N[(b * z + N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$6), $MachinePrecision], If[LessEqual[t$95$5, -1e-313], t$95$3, If[LessEqual[t$95$5, 0.0], N[(N[(N[(N[(x * N[(y / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(t - a), $MachinePrecision] * y), $MachinePrecision] / N[Power[N[(b - y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-z)), $MachinePrecision] * -1.0 + t$95$4), $MachinePrecision], If[LessEqual[t$95$5, 2e+290], t$95$3, If[LessEqual[t$95$5, Infinity], N[(z * N[(N[(t - a), $MachinePrecision] / t$95$1), $MachinePrecision] + t$95$6), $MachinePrecision], t$95$4]]]]]]]]]]]
\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{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{t\_2}\\
t_4 := \frac{t - a}{b - y}\\
t_5 := \frac{x \cdot y + z \cdot \left(t - a\right)}{t\_2}\\
t_6 := x \cdot \frac{y}{t\_1}\\
\mathbf{if}\;t\_5 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b, z, y \cdot \left(1 - z\right)\right)}, t\_6\right)\\
\mathbf{elif}\;t\_5 \leq -1 \cdot 10^{-313}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_5 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{x \cdot \frac{y}{b - y} - \frac{\left(t - a\right) \cdot y}{{\left(b - y\right)}^{2}}}{-z}, -1, t\_4\right)\\
\mathbf{elif}\;t\_5 \leq 2 \cdot 10^{+290}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{t\_1}, t\_6\right)\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\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 20.9%
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000001e-313 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 2.00000000000000012e290Initial program 99.5%
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6499.5
Applied rewrites99.5%
if -1.00000000001e-313 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -0.0Initial program 21.5%
Taylor expanded in z around -inf
associate--l+N/A
*-commutativeN/A
div-subN/A
lower-fma.f64N/A
Applied rewrites95.7%
if 2.00000000000000012e290 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 29.6%
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64100.0
Applied rewrites100.0%
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
lower-/.f64N/A
lower--.f64N/A
lower--.f6474.7
Applied rewrites74.7%
Final simplification96.3%
(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 (/ (fma y x (* (- t a) z)) t_2))
(t_4 (/ (+ (* x y) (* z (- t a))) t_2))
(t_5 (/ (- t a) (- b y)))
(t_6 (* x (/ y t_1))))
(if (<= t_4 (- INFINITY))
(fma z (/ (- t a) (fma b z (* y (- 1.0 z)))) t_6)
(if (<= t_4 -1e-313)
t_3
(if (<= t_4 0.0)
t_5
(if (<= t_4 2e+290)
t_3
(if (<= t_4 INFINITY) (fma z (/ (- t a) t_1) t_6) t_5)))))))
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 = fma(y, x, ((t - a) * z)) / t_2;
double t_4 = ((x * y) + (z * (t - a))) / t_2;
double t_5 = (t - a) / (b - y);
double t_6 = x * (y / t_1);
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = fma(z, ((t - a) / fma(b, z, (y * (1.0 - z)))), t_6);
} else if (t_4 <= -1e-313) {
tmp = t_3;
} else if (t_4 <= 0.0) {
tmp = t_5;
} else if (t_4 <= 2e+290) {
tmp = t_3;
} else if (t_4 <= ((double) INFINITY)) {
tmp = fma(z, ((t - a) / t_1), t_6);
} else {
tmp = t_5;
}
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(fma(y, x, Float64(Float64(t - a) * z)) / t_2) t_4 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / t_2) t_5 = Float64(Float64(t - a) / Float64(b - y)) t_6 = Float64(x * Float64(y / t_1)) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = fma(z, Float64(Float64(t - a) / fma(b, z, Float64(y * Float64(1.0 - z)))), t_6); elseif (t_4 <= -1e-313) tmp = t_3; elseif (t_4 <= 0.0) tmp = t_5; elseif (t_4 <= 2e+290) tmp = t_3; elseif (t_4 <= Inf) tmp = fma(z, Float64(Float64(t - a) / t_1), t_6); else tmp = t_5; 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[(y * x + N[(N[(t - a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$5 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(x * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(z * N[(N[(t - a), $MachinePrecision] / N[(b * z + N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$6), $MachinePrecision], If[LessEqual[t$95$4, -1e-313], t$95$3, If[LessEqual[t$95$4, 0.0], t$95$5, If[LessEqual[t$95$4, 2e+290], t$95$3, If[LessEqual[t$95$4, Infinity], N[(z * N[(N[(t - a), $MachinePrecision] / t$95$1), $MachinePrecision] + t$95$6), $MachinePrecision], t$95$5]]]]]]]]]]]
\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{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{t\_2}\\
t_4 := \frac{x \cdot y + z \cdot \left(t - a\right)}{t\_2}\\
t_5 := \frac{t - a}{b - y}\\
t_6 := x \cdot \frac{y}{t\_1}\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b, z, y \cdot \left(1 - z\right)\right)}, t\_6\right)\\
\mathbf{elif}\;t\_4 \leq -1 \cdot 10^{-313}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+290}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{t\_1}, t\_6\right)\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\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 20.9%
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000001e-313 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 2.00000000000000012e290Initial program 99.5%
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6499.5
Applied rewrites99.5%
if -1.00000000001e-313 < (/.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 8.7%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6475.9
Applied rewrites75.9%
if 2.00000000000000012e290 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 29.6%
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Final simplification94.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (* z (- b y))))
(t_2 (/ (fma y x (* (- t a) z)) t_1))
(t_3 (/ (- t a) (- b y)))
(t_4 (fma (- b y) z y))
(t_5 (/ (+ (* x y) (* z (- t a))) t_1))
(t_6 (fma z (/ (- t a) t_4) (* x (/ y t_4)))))
(if (<= t_5 (- INFINITY))
t_6
(if (<= t_5 -1e-313)
t_2
(if (<= t_5 0.0)
t_3
(if (<= t_5 2e+290) t_2 (if (<= t_5 INFINITY) t_6 t_3)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (z * (b - y));
double t_2 = fma(y, x, ((t - a) * z)) / t_1;
double t_3 = (t - a) / (b - y);
double t_4 = fma((b - y), z, y);
double t_5 = ((x * y) + (z * (t - a))) / t_1;
double t_6 = fma(z, ((t - a) / t_4), (x * (y / t_4)));
double tmp;
if (t_5 <= -((double) INFINITY)) {
tmp = t_6;
} else if (t_5 <= -1e-313) {
tmp = t_2;
} else if (t_5 <= 0.0) {
tmp = t_3;
} else if (t_5 <= 2e+290) {
tmp = t_2;
} else if (t_5 <= ((double) INFINITY)) {
tmp = t_6;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(z * Float64(b - y))) t_2 = Float64(fma(y, x, Float64(Float64(t - a) * z)) / t_1) t_3 = Float64(Float64(t - a) / Float64(b - y)) t_4 = fma(Float64(b - y), z, y) t_5 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / t_1) t_6 = fma(z, Float64(Float64(t - a) / t_4), Float64(x * Float64(y / t_4))) tmp = 0.0 if (t_5 <= Float64(-Inf)) tmp = t_6; elseif (t_5 <= -1e-313) tmp = t_2; elseif (t_5 <= 0.0) tmp = t_3; elseif (t_5 <= 2e+290) tmp = t_2; elseif (t_5 <= Inf) tmp = t_6; else tmp = t_3; 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[(y * x + N[(N[(t - a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$6 = N[(z * N[(N[(t - a), $MachinePrecision] / t$95$4), $MachinePrecision] + N[(x * N[(y / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, (-Infinity)], t$95$6, If[LessEqual[t$95$5, -1e-313], t$95$2, If[LessEqual[t$95$5, 0.0], t$95$3, If[LessEqual[t$95$5, 2e+290], t$95$2, If[LessEqual[t$95$5, Infinity], t$95$6, t$95$3]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + z \cdot \left(b - y\right)\\
t_2 := \frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{t\_1}\\
t_3 := \frac{t - a}{b - y}\\
t_4 := \mathsf{fma}\left(b - y, z, y\right)\\
t_5 := \frac{x \cdot y + z \cdot \left(t - a\right)}{t\_1}\\
t_6 := \mathsf{fma}\left(z, \frac{t - a}{t\_4}, x \cdot \frac{y}{t\_4}\right)\\
\mathbf{if}\;t\_5 \leq -\infty:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 \leq -1 \cdot 10^{-313}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_5 \leq 0:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_5 \leq 2 \cdot 10^{+290}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;t\_6\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\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 2.00000000000000012e290 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 24.9%
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.8
Applied rewrites99.8%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000001e-313 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 2.00000000000000012e290Initial program 99.5%
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6499.5
Applied rewrites99.5%
if -1.00000000001e-313 < (/.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 8.7%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6475.9
Applied rewrites75.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (* z (- b y))))
(t_2 (/ (fma y x (* (- t a) z)) t_1))
(t_3 (/ (- t a) (- b y)))
(t_4 (/ (+ (* x y) (* z (- t a))) t_1))
(t_5 (fma z (/ (- t a) (fma (- b y) z y)) (* x (/ y (fma b z y))))))
(if (<= t_4 (- INFINITY))
t_5
(if (<= t_4 -1e-313)
t_2
(if (<= t_4 0.0)
t_3
(if (<= t_4 2e+290) t_2 (if (<= t_4 INFINITY) t_5 t_3)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (z * (b - y));
double t_2 = fma(y, x, ((t - a) * z)) / t_1;
double t_3 = (t - a) / (b - y);
double t_4 = ((x * y) + (z * (t - a))) / t_1;
double t_5 = fma(z, ((t - a) / fma((b - y), z, y)), (x * (y / fma(b, z, y))));
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = t_5;
} else if (t_4 <= -1e-313) {
tmp = t_2;
} else if (t_4 <= 0.0) {
tmp = t_3;
} else if (t_4 <= 2e+290) {
tmp = t_2;
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_5;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(z * Float64(b - y))) t_2 = Float64(fma(y, x, Float64(Float64(t - a) * z)) / t_1) t_3 = Float64(Float64(t - a) / Float64(b - y)) t_4 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / t_1) t_5 = fma(z, Float64(Float64(t - a) / fma(Float64(b - y), z, y)), Float64(x * Float64(y / fma(b, z, y)))) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = t_5; elseif (t_4 <= -1e-313) tmp = t_2; elseif (t_4 <= 0.0) tmp = t_3; elseif (t_4 <= 2e+290) tmp = t_2; elseif (t_4 <= Inf) tmp = t_5; else tmp = t_3; 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[(y * x + N[(N[(t - a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $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 = N[(z * N[(N[(t - a), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] + N[(x * N[(y / N[(b * z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], t$95$5, If[LessEqual[t$95$4, -1e-313], t$95$2, If[LessEqual[t$95$4, 0.0], t$95$3, If[LessEqual[t$95$4, 2e+290], t$95$2, If[LessEqual[t$95$4, Infinity], t$95$5, t$95$3]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + z \cdot \left(b - y\right)\\
t_2 := \frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{t\_1}\\
t_3 := \frac{t - a}{b - y}\\
t_4 := \frac{x \cdot y + z \cdot \left(t - a\right)}{t\_1}\\
t_5 := \mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b - y, z, y\right)}, x \cdot \frac{y}{\mathsf{fma}\left(b, z, y\right)}\right)\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq -1 \cdot 10^{-313}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+290}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_5\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\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 2.00000000000000012e290 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 24.9%
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites94.3%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000001e-313 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 2.00000000000000012e290Initial program 99.5%
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6499.5
Applied rewrites99.5%
if -1.00000000001e-313 < (/.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 8.7%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6475.9
Applied rewrites75.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (* z (- b y))))
(t_2 (/ (fma y x (* (- t a) z)) t_1))
(t_3 (/ (+ (* x y) (* z (- t a))) t_1))
(t_4 (/ (- t a) (- b y))))
(if (<= t_3 (- INFINITY))
(fma z (/ (- t a) (fma b z (* y (- 1.0 z)))) (* x 1.0))
(if (<= t_3 -1e-313)
t_2
(if (<= t_3 0.0)
t_4
(if (<= t_3 2e+290)
t_2
(if (<= t_3 INFINITY)
(fma z (/ (- t a) (fma (- b y) z y)) x)
t_4)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (z * (b - y));
double t_2 = fma(y, x, ((t - a) * z)) / t_1;
double t_3 = ((x * y) + (z * (t - a))) / t_1;
double t_4 = (t - a) / (b - y);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = fma(z, ((t - a) / fma(b, z, (y * (1.0 - z)))), (x * 1.0));
} else if (t_3 <= -1e-313) {
tmp = t_2;
} else if (t_3 <= 0.0) {
tmp = t_4;
} else if (t_3 <= 2e+290) {
tmp = t_2;
} else if (t_3 <= ((double) INFINITY)) {
tmp = fma(z, ((t - a) / fma((b - y), z, y)), x);
} else {
tmp = t_4;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(z * Float64(b - y))) t_2 = Float64(fma(y, x, Float64(Float64(t - a) * z)) / t_1) t_3 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / t_1) t_4 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = fma(z, Float64(Float64(t - a) / fma(b, z, Float64(y * Float64(1.0 - z)))), Float64(x * 1.0)); elseif (t_3 <= -1e-313) tmp = t_2; elseif (t_3 <= 0.0) tmp = t_4; elseif (t_3 <= 2e+290) tmp = t_2; elseif (t_3 <= Inf) tmp = fma(z, Float64(Float64(t - a) / fma(Float64(b - y), z, y)), x); else tmp = t_4; 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[(y * x + N[(N[(t - a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(z * N[(N[(t - a), $MachinePrecision] / N[(b * z + N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -1e-313], t$95$2, If[LessEqual[t$95$3, 0.0], t$95$4, If[LessEqual[t$95$3, 2e+290], t$95$2, If[LessEqual[t$95$3, Infinity], N[(z * N[(N[(t - a), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$4]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + z \cdot \left(b - y\right)\\
t_2 := \frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{t\_1}\\
t_3 := \frac{x \cdot y + z \cdot \left(t - a\right)}{t\_1}\\
t_4 := \frac{t - a}{b - y}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b, z, y \cdot \left(1 - z\right)\right)}, x \cdot 1\right)\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-313}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+290}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b - y, z, y\right)}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\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 20.9%
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in z around 0
Applied rewrites79.7%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000001e-313 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 2.00000000000000012e290Initial program 99.5%
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6499.5
Applied rewrites99.5%
if -1.00000000001e-313 < (/.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 8.7%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6475.9
Applied rewrites75.9%
if 2.00000000000000012e290 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 29.6%
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites92.7%
Final simplification91.0%
(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 y x (* (- t a) z)) t_1))
(t_4 (/ (+ (* x y) (* z (- t a))) t_1))
(t_5 (fma z (/ (- t a) (fma (- b y) z y)) x)))
(if (<= t_4 (- INFINITY))
t_5
(if (<= t_4 -1e-313)
t_3
(if (<= t_4 0.0)
t_2
(if (<= t_4 2e+290) t_3 (if (<= t_4 INFINITY) t_5 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(y, x, ((t - a) * z)) / t_1;
double t_4 = ((x * y) + (z * (t - a))) / t_1;
double t_5 = fma(z, ((t - a) / fma((b - y), z, y)), x);
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = t_5;
} else if (t_4 <= -1e-313) {
tmp = t_3;
} else if (t_4 <= 0.0) {
tmp = t_2;
} else if (t_4 <= 2e+290) {
tmp = t_3;
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_5;
} 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 = Float64(fma(y, x, Float64(Float64(t - a) * z)) / t_1) t_4 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / t_1) t_5 = fma(z, Float64(Float64(t - a) / fma(Float64(b - y), z, y)), x) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = t_5; elseif (t_4 <= -1e-313) tmp = t_3; elseif (t_4 <= 0.0) tmp = t_2; elseif (t_4 <= 2e+290) tmp = t_3; elseif (t_4 <= Inf) tmp = t_5; 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[(N[(y * x + N[(N[(t - a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $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 = N[(z * N[(N[(t - a), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], t$95$5, If[LessEqual[t$95$4, -1e-313], t$95$3, If[LessEqual[t$95$4, 0.0], t$95$2, If[LessEqual[t$95$4, 2e+290], t$95$3, If[LessEqual[t$95$4, Infinity], t$95$5, 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 := \frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{t\_1}\\
t_4 := \frac{x \cdot y + z \cdot \left(t - a\right)}{t\_1}\\
t_5 := \mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b - y, z, y\right)}, x\right)\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq -1 \cdot 10^{-313}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+290}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_5\\
\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 2.00000000000000012e290 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 24.9%
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6499.8
Applied rewrites99.8%
Taylor expanded in z around 0
Applied rewrites85.7%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.00000000001e-313 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 2.00000000000000012e290Initial program 99.5%
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6499.5
Applied rewrites99.5%
if -1.00000000001e-313 < (/.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 8.7%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6475.9
Applied rewrites75.9%
(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 -2.7)
t_2
(if (<= z 9.2e-160)
(fma z (/ (- t a) t_1) x)
(if (<= z 1.1e-33) (/ (fma t z (* y x)) t_1) 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 <= -2.7) {
tmp = t_2;
} else if (z <= 9.2e-160) {
tmp = fma(z, ((t - a) / t_1), x);
} else if (z <= 1.1e-33) {
tmp = fma(t, z, (y * x)) / t_1;
} 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 <= -2.7) tmp = t_2; elseif (z <= 9.2e-160) tmp = fma(z, Float64(Float64(t - a) / t_1), x); elseif (z <= 1.1e-33) tmp = Float64(fma(t, z, Float64(y * x)) / t_1); 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, -2.7], t$95$2, If[LessEqual[z, 9.2e-160], N[(z * N[(N[(t - a), $MachinePrecision] / t$95$1), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.1e-33], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / t$95$1), $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 -2.7:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-160}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{t\_1}, x\right)\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-33}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -2.7000000000000002 or 1.10000000000000003e-33 < z Initial program 47.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6481.2
Applied rewrites81.2%
if -2.7000000000000002 < z < 9.19999999999999939e-160Initial program 76.1%
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6488.9
Applied rewrites88.9%
Taylor expanded in z around 0
Applied rewrites85.0%
if 9.19999999999999939e-160 < z < 1.10000000000000003e-33Initial program 87.4%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6483.2
Applied rewrites83.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.7) (not (<= z 5.2e-42))) (/ (- 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 <= -2.7) || !(z <= 5.2e-42)) {
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 <= -2.7) || !(z <= 5.2e-42)) 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, -2.7], N[Not[LessEqual[z, 5.2e-42]], $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 -2.7 \lor \neg \left(z \leq 5.2 \cdot 10^{-42}\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 < -2.7000000000000002 or 5.2e-42 < z Initial program 48.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6480.3
Applied rewrites80.3%
if -2.7000000000000002 < z < 5.2e-42Initial program 77.8%
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6487.3
Applied rewrites87.3%
Taylor expanded in z around 0
Applied rewrites80.6%
Final simplification80.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -0.0017) (not (<= z 5.2e-42))) (/ (- t a) (- b y)) (fma z (/ (- t a) (fma b z y)) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -0.0017) || !(z <= 5.2e-42)) {
tmp = (t - a) / (b - y);
} else {
tmp = fma(z, ((t - a) / fma(b, z, y)), x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -0.0017) || !(z <= 5.2e-42)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = fma(z, Float64(Float64(t - a) / fma(b, z, y)), x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -0.0017], N[Not[LessEqual[z, 5.2e-42]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(t - a), $MachinePrecision] / N[(b * z + y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0017 \lor \neg \left(z \leq 5.2 \cdot 10^{-42}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b, z, y\right)}, x\right)\\
\end{array}
\end{array}
if z < -0.00169999999999999991 or 5.2e-42 < z Initial program 48.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6480.3
Applied rewrites80.3%
if -0.00169999999999999991 < z < 5.2e-42Initial program 77.8%
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6487.3
Applied rewrites87.3%
Taylor expanded in z around 0
Applied rewrites80.6%
Taylor expanded in y around 0
Applied rewrites80.1%
Final simplification80.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.7e-43) (not (<= z 3.3e-34))) (/ (- t a) (- b y)) (* x (/ y (fma (- b y) z y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.7e-43) || !(z <= 3.3e-34)) {
tmp = (t - a) / (b - y);
} else {
tmp = x * (y / fma((b - y), z, y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.7e-43) || !(z <= 3.3e-34)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(x * Float64(y / fma(Float64(b - y), z, y))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.7e-43], N[Not[LessEqual[z, 3.3e-34]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-43} \lor \neg \left(z \leq 3.3 \cdot 10^{-34}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{\mathsf{fma}\left(b - y, z, y\right)}\\
\end{array}
\end{array}
if z < -2.69999999999999991e-43 or 3.29999999999999983e-34 < z Initial program 51.1%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6478.3
Applied rewrites78.3%
if -2.69999999999999991e-43 < z < 3.29999999999999983e-34Initial program 76.4%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6463.9
Applied rewrites63.9%
Final simplification72.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.4e-64) (not (<= z 3.5e-47))) (/ (- t a) (- b y)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.4e-64) || !(z <= 3.5e-47)) {
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 <= (-2.4d-64)) .or. (.not. (z <= 3.5d-47))) 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 <= -2.4e-64) || !(z <= 3.5e-47)) {
tmp = (t - a) / (b - y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -2.4e-64) or not (z <= 3.5e-47): tmp = (t - a) / (b - y) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.4e-64) || !(z <= 3.5e-47)) 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 <= -2.4e-64) || ~((z <= 3.5e-47))) tmp = (t - a) / (b - y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.4e-64], N[Not[LessEqual[z, 3.5e-47]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-64} \lor \neg \left(z \leq 3.5 \cdot 10^{-47}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.39999999999999998e-64 or 3.4999999999999998e-47 < z Initial program 52.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.9
Applied rewrites76.9%
if -2.39999999999999998e-64 < z < 3.4999999999999998e-47Initial program 75.1%
Taylor expanded in z around 0
Applied rewrites59.2%
Final simplification70.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.1e+20) (not (<= y 2.05e+107))) (/ (- x) (- z 1.0)) (/ (- t a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.1e+20) || !(y <= 2.05e+107)) {
tmp = -x / (z - 1.0);
} 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 <= (-2.1d+20)) .or. (.not. (y <= 2.05d+107))) then
tmp = -x / (z - 1.0d0)
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 <= -2.1e+20) || !(y <= 2.05e+107)) {
tmp = -x / (z - 1.0);
} else {
tmp = (t - a) / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.1e+20) or not (y <= 2.05e+107): tmp = -x / (z - 1.0) else: tmp = (t - a) / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.1e+20) || !(y <= 2.05e+107)) tmp = Float64(Float64(-x) / Float64(z - 1.0)); 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 <= -2.1e+20) || ~((y <= 2.05e+107))) tmp = -x / (z - 1.0); else tmp = (t - a) / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.1e+20], N[Not[LessEqual[y, 2.05e+107]], $MachinePrecision]], N[((-x) / N[(z - 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{+20} \lor \neg \left(y \leq 2.05 \cdot 10^{+107}\right):\\
\;\;\;\;\frac{-x}{z - 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t - a}{b}\\
\end{array}
\end{array}
if y < -2.1e20 or 2.05e107 < y Initial program 41.7%
Taylor expanded in y around -inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f6459.5
Applied rewrites59.5%
if -2.1e20 < y < 2.05e107Initial program 73.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6460.5
Applied rewrites60.5%
Final simplification60.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1e-47) (not (<= z 3.5e-47))) (/ (- t a) b) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1e-47) || !(z <= 3.5e-47)) {
tmp = (t - a) / 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 <= (-1d-47)) .or. (.not. (z <= 3.5d-47))) then
tmp = (t - a) / 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 <= -1e-47) || !(z <= 3.5e-47)) {
tmp = (t - a) / b;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1e-47) or not (z <= 3.5e-47): tmp = (t - a) / b else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1e-47) || !(z <= 3.5e-47)) tmp = Float64(Float64(t - a) / b); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -1e-47) || ~((z <= 3.5e-47))) tmp = (t - a) / b; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1e-47], N[Not[LessEqual[z, 3.5e-47]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-47} \lor \neg \left(z \leq 3.5 \cdot 10^{-47}\right):\\
\;\;\;\;\frac{t - a}{b}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.9999999999999997e-48 or 3.4999999999999998e-47 < z Initial program 52.3%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6454.2
Applied rewrites54.2%
if -9.9999999999999997e-48 < z < 3.4999999999999998e-47Initial program 75.4%
Taylor expanded in z around 0
Applied rewrites58.6%
Final simplification55.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.4e-44) (not (<= z 1.95e-22))) (/ t (- b y)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.4e-44) || !(z <= 1.95e-22)) {
tmp = t / (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 <= (-1.4d-44)) .or. (.not. (z <= 1.95d-22))) then
tmp = t / (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 <= -1.4e-44) || !(z <= 1.95e-22)) {
tmp = t / (b - y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.4e-44) or not (z <= 1.95e-22): tmp = t / (b - y) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.4e-44) || !(z <= 1.95e-22)) tmp = Float64(t / 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 <= -1.4e-44) || ~((z <= 1.95e-22))) tmp = t / (b - y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.4e-44], N[Not[LessEqual[z, 1.95e-22]], $MachinePrecision]], N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-44} \lor \neg \left(z \leq 1.95 \cdot 10^{-22}\right):\\
\;\;\;\;\frac{t}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.4e-44 or 1.94999999999999999e-22 < z Initial program 50.7%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6433.3
Applied rewrites33.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f6440.9
Applied rewrites40.9%
if -1.4e-44 < z < 1.94999999999999999e-22Initial program 76.1%
Taylor expanded in z around 0
Applied rewrites56.8%
Final simplification47.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.65e-59) (not (<= z 1.45e-22))) (/ t b) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.65e-59) || !(z <= 1.45e-22)) {
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 <= (-1.65d-59)) .or. (.not. (z <= 1.45d-22))) 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 <= -1.65e-59) || !(z <= 1.45e-22)) {
tmp = t / b;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.65e-59) or not (z <= 1.45e-22): tmp = t / b else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.65e-59) || !(z <= 1.45e-22)) 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 <= -1.65e-59) || ~((z <= 1.45e-22))) tmp = t / b; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.65e-59], N[Not[LessEqual[z, 1.45e-22]], $MachinePrecision]], N[(t / b), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{-59} \lor \neg \left(z \leq 1.45 \cdot 10^{-22}\right):\\
\;\;\;\;\frac{t}{b}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.64999999999999991e-59 or 1.4500000000000001e-22 < z Initial program 51.1%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6433.1
Applied rewrites33.1%
Taylor expanded in y around 0
lower-/.f6430.0
Applied rewrites30.0%
if -1.64999999999999991e-59 < z < 1.4500000000000001e-22Initial program 75.9%
Taylor expanded in z around 0
Applied rewrites57.3%
Final simplification40.9%
(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.9%
Taylor expanded in z around 0
Applied rewrites25.3%
(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 2025044
(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)))))