
(FPCore (x y z t a b) :precision binary64 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
double code(double x, double y, double z, double t, double a, double b) {
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, 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 + 1.0d0) + ((y * b) / t))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
}
def code(x, y, z, t, a, b): return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))
function code(x, y, z, t, a, b) return Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) end
function tmp = code(x, y, z, t, a, b) tmp = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
double code(double x, double y, double z, double t, double a, double b) {
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, 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 + 1.0d0) + ((y * b) / t))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
}
def code(x, y, z, t, a, b): return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))
function code(x, y, z, t, a, b) return Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) end
function tmp = code(x, y, z, t, a, b) tmp = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ 1.0 (+ a (/ (* b y) t))))
(t_2 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
(t_3 (fma (/ b t) y (- a -1.0))))
(if (<= t_2 (- INFINITY))
(fma y (/ (/ z t) t_3) (/ x t_3))
(if (<= t_2 -1e-244)
t_2
(if (<= t_2 5e-269)
(/
(/ (fma (/ z t) y x) (fma y (/ (/ b t) (- a -1.0)) 1.0))
(- a -1.0))
(if (<= t_2 2e+301)
t_2
(if (<= t_2 INFINITY)
(* z (+ (/ x (* z t_1)) (/ y (* t t_1))))
(/ z b))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.0 + (a + ((b * y) / t));
double t_2 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
double t_3 = fma((b / t), y, (a - -1.0));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(y, ((z / t) / t_3), (x / t_3));
} else if (t_2 <= -1e-244) {
tmp = t_2;
} else if (t_2 <= 5e-269) {
tmp = (fma((z / t), y, x) / fma(y, ((b / t) / (a - -1.0)), 1.0)) / (a - -1.0);
} else if (t_2 <= 2e+301) {
tmp = t_2;
} else if (t_2 <= ((double) INFINITY)) {
tmp = z * ((x / (z * t_1)) + (y / (t * t_1)));
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(1.0 + Float64(a + Float64(Float64(b * y) / t))) t_2 = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) t_3 = fma(Float64(b / t), y, Float64(a - -1.0)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(y, Float64(Float64(z / t) / t_3), Float64(x / t_3)); elseif (t_2 <= -1e-244) tmp = t_2; elseif (t_2 <= 5e-269) tmp = Float64(Float64(fma(Float64(z / t), y, x) / fma(y, Float64(Float64(b / t) / Float64(a - -1.0)), 1.0)) / Float64(a - -1.0)); elseif (t_2 <= 2e+301) tmp = t_2; elseif (t_2 <= Inf) tmp = Float64(z * Float64(Float64(x / Float64(z * t_1)) + Float64(y / Float64(t * t_1)))); else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(1.0 + N[(a + N[(N[(b * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(b / t), $MachinePrecision] * y + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(y * N[(N[(z / t), $MachinePrecision] / t$95$3), $MachinePrecision] + N[(x / t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e-244], t$95$2, If[LessEqual[t$95$2, 5e-269], N[(N[(N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision] / N[(y * N[(N[(b / t), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+301], t$95$2, If[LessEqual[t$95$2, Infinity], N[(z * N[(N[(x / N[(z * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(y / N[(t * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 + \left(a + \frac{b \cdot y}{t}\right)\\
t_2 := \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
t_3 := \mathsf{fma}\left(\frac{b}{t}, y, a - -1\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{\frac{z}{t}}{t\_3}, \frac{x}{t\_3}\right)\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-244}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-269}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{\mathsf{fma}\left(y, \frac{\frac{b}{t}}{a - -1}, 1\right)}}{a - -1}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+301}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;z \cdot \left(\frac{x}{z \cdot t\_1} + \frac{y}{t \cdot t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 75.8%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites76.9%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -9.9999999999999993e-245 or 4.99999999999999979e-269 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 2.00000000000000011e301Initial program 75.8%
if -9.9999999999999993e-245 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 4.99999999999999979e-269Initial program 75.8%
lift-/.f64N/A
lift-+.f64N/A
sum-to-multN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites76.9%
if 2.00000000000000011e301 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 75.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
Applied rewrites72.0%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.8%
Taylor expanded in y around inf
lower-/.f6433.5
Applied rewrites33.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
(t_2 (fma (/ b t) y (- a -1.0)))
(t_3 (fma y (/ (/ z t) t_2) (/ x t_2))))
(if (<= t_1 (- INFINITY))
t_3
(if (<= t_1 -1e-244)
t_1
(if (<= t_1 5e-269)
(/
(/ (fma (/ z t) y x) (fma y (/ (/ b t) (- a -1.0)) 1.0))
(- a -1.0))
(if (<= t_1 1e+247) t_1 (if (<= t_1 INFINITY) t_3 (/ z b))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
double t_2 = fma((b / t), y, (a - -1.0));
double t_3 = fma(y, ((z / t) / t_2), (x / t_2));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_1 <= -1e-244) {
tmp = t_1;
} else if (t_1 <= 5e-269) {
tmp = (fma((z / t), y, x) / fma(y, ((b / t) / (a - -1.0)), 1.0)) / (a - -1.0);
} else if (t_1 <= 1e+247) {
tmp = t_1;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_3;
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) t_2 = fma(Float64(b / t), y, Float64(a - -1.0)) t_3 = fma(y, Float64(Float64(z / t) / t_2), Float64(x / t_2)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_3; elseif (t_1 <= -1e-244) tmp = t_1; elseif (t_1 <= 5e-269) tmp = Float64(Float64(fma(Float64(z / t), y, x) / fma(y, Float64(Float64(b / t) / Float64(a - -1.0)), 1.0)) / Float64(a - -1.0)); elseif (t_1 <= 1e+247) tmp = t_1; elseif (t_1 <= Inf) tmp = t_3; else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b / t), $MachinePrecision] * y + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y * N[(N[(z / t), $MachinePrecision] / t$95$2), $MachinePrecision] + N[(x / t$95$2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$3, If[LessEqual[t$95$1, -1e-244], t$95$1, If[LessEqual[t$95$1, 5e-269], N[(N[(N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision] / N[(y * N[(N[(b / t), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+247], t$95$1, If[LessEqual[t$95$1, Infinity], t$95$3, N[(z / b), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
t_2 := \mathsf{fma}\left(\frac{b}{t}, y, a - -1\right)\\
t_3 := \mathsf{fma}\left(y, \frac{\frac{z}{t}}{t\_2}, \frac{x}{t\_2}\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-244}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-269}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{\mathsf{fma}\left(y, \frac{\frac{b}{t}}{a - -1}, 1\right)}}{a - -1}\\
\mathbf{elif}\;t\_1 \leq 10^{+247}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0 or 9.99999999999999952e246 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 75.8%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites76.9%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -9.9999999999999993e-245 or 4.99999999999999979e-269 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 9.99999999999999952e246Initial program 75.8%
if -9.9999999999999993e-245 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 4.99999999999999979e-269Initial program 75.8%
lift-/.f64N/A
lift-+.f64N/A
sum-to-multN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites76.9%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.8%
Taylor expanded in y around inf
lower-/.f6433.5
Applied rewrites33.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))))
(if (<= t_1 (- INFINITY))
(fma y (/ (/ z t) (- a -1.0)) (/ x (- a -1.0)))
(if (<= t_1 -1e-244)
t_1
(if (<= t_1 5e-269)
(/
(/ (fma (/ z t) y x) (fma y (/ (/ b t) (- a -1.0)) 1.0))
(- a -1.0))
(if (<= t_1 2e+301) t_1 (/ z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(y, ((z / t) / (a - -1.0)), (x / (a - -1.0)));
} else if (t_1 <= -1e-244) {
tmp = t_1;
} else if (t_1 <= 5e-269) {
tmp = (fma((z / t), y, x) / fma(y, ((b / t) / (a - -1.0)), 1.0)) / (a - -1.0);
} else if (t_1 <= 2e+301) {
tmp = t_1;
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(y, Float64(Float64(z / t) / Float64(a - -1.0)), Float64(x / Float64(a - -1.0))); elseif (t_1 <= -1e-244) tmp = t_1; elseif (t_1 <= 5e-269) tmp = Float64(Float64(fma(Float64(z / t), y, x) / fma(y, Float64(Float64(b / t) / Float64(a - -1.0)), 1.0)) / Float64(a - -1.0)); elseif (t_1 <= 2e+301) tmp = t_1; else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(N[(z / t), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e-244], t$95$1, If[LessEqual[t$95$1, 5e-269], N[(N[(N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision] / N[(y * N[(N[(b / t), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+301], t$95$1, N[(z / b), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{\frac{z}{t}}{a - -1}, \frac{x}{a - -1}\right)\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-244}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-269}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{\mathsf{fma}\left(y, \frac{\frac{b}{t}}{a - -1}, 1\right)}}{a - -1}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+301}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 75.8%
Taylor expanded in y around 0
lower-+.f6457.2
Applied rewrites57.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites57.4%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -9.9999999999999993e-245 or 4.99999999999999979e-269 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 2.00000000000000011e301Initial program 75.8%
if -9.9999999999999993e-245 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 4.99999999999999979e-269Initial program 75.8%
lift-/.f64N/A
lift-+.f64N/A
sum-to-multN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites76.9%
if 2.00000000000000011e301 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.8%
Taylor expanded in y around inf
lower-/.f6433.5
Applied rewrites33.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))))
(if (<= t_1 (- INFINITY))
(fma y (/ (/ z t) (- a -1.0)) (/ x (- a -1.0)))
(if (<= t_1 2e+301) t_1 (/ z b)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(y, ((z / t) / (a - -1.0)), (x / (a - -1.0)));
} else if (t_1 <= 2e+301) {
tmp = t_1;
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(y, Float64(Float64(z / t) / Float64(a - -1.0)), Float64(x / Float64(a - -1.0))); elseif (t_1 <= 2e+301) tmp = t_1; else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(N[(z / t), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+301], t$95$1, N[(z / b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{\frac{z}{t}}{a - -1}, \frac{x}{a - -1}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+301}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 75.8%
Taylor expanded in y around 0
lower-+.f6457.2
Applied rewrites57.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites57.4%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 2.00000000000000011e301Initial program 75.8%
if 2.00000000000000011e301 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.8%
Taylor expanded in y around inf
lower-/.f6433.5
Applied rewrites33.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (/ (* y z) t))) (t_2 (/ t_1 (+ (+ a 1.0) (/ (* y b) t)))))
(if (<= t_2 (- INFINITY))
(fma y (/ (/ z t) (- a -1.0)) (/ x (- a -1.0)))
(if (<= t_2 2e+301) (/ t_1 (fma b (/ y t) (- a -1.0))) (/ z b)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + ((y * z) / t);
double t_2 = t_1 / ((a + 1.0) + ((y * b) / t));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(y, ((z / t) / (a - -1.0)), (x / (a - -1.0)));
} else if (t_2 <= 2e+301) {
tmp = t_1 / fma(b, (y / t), (a - -1.0));
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(Float64(y * z) / t)) t_2 = Float64(t_1 / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(y, Float64(Float64(z / t) / Float64(a - -1.0)), Float64(x / Float64(a - -1.0))); elseif (t_2 <= 2e+301) tmp = Float64(t_1 / fma(b, Float64(y / t), Float64(a - -1.0))); else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(y * N[(N[(z / t), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+301], N[(t$95$1 / N[(b * N[(y / t), $MachinePrecision] + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot z}{t}\\
t_2 := \frac{t\_1}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{\frac{z}{t}}{a - -1}, \frac{x}{a - -1}\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+301}:\\
\;\;\;\;\frac{t\_1}{\mathsf{fma}\left(b, \frac{y}{t}, a - -1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 75.8%
Taylor expanded in y around 0
lower-+.f6457.2
Applied rewrites57.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites57.4%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 2.00000000000000011e301Initial program 75.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6475.6
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval75.6
Applied rewrites75.6%
if 2.00000000000000011e301 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.8%
Taylor expanded in y around inf
lower-/.f6433.5
Applied rewrites33.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))))
(if (<= t_1 (- INFINITY))
(fma y (/ (/ z t) (- a -1.0)) (/ x (- a -1.0)))
(if (<= t_1 2e+301)
(/ (fma (/ z t) y x) (fma (/ b t) y (- a -1.0)))
(/ z b)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(y, ((z / t) / (a - -1.0)), (x / (a - -1.0)));
} else if (t_1 <= 2e+301) {
tmp = fma((z / t), y, x) / fma((b / t), y, (a - -1.0));
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(y, Float64(Float64(z / t) / Float64(a - -1.0)), Float64(x / Float64(a - -1.0))); elseif (t_1 <= 2e+301) tmp = Float64(fma(Float64(z / t), y, x) / fma(Float64(b / t), y, Float64(a - -1.0))); else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(N[(z / t), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+301], N[(N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision] / N[(N[(b / t), $MachinePrecision] * y + N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{\frac{z}{t}}{a - -1}, \frac{x}{a - -1}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+301}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{\mathsf{fma}\left(\frac{b}{t}, y, a - -1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 75.8%
Taylor expanded in y around 0
lower-+.f6457.2
Applied rewrites57.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites57.4%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 2.00000000000000011e301Initial program 75.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6474.9
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.7
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval75.7
Applied rewrites75.7%
if 2.00000000000000011e301 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 75.8%
Taylor expanded in y around inf
lower-/.f6433.5
Applied rewrites33.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma y (/ (/ z t) (- a -1.0)) (/ x (- a -1.0)))))
(if (<= (+ a 1.0) -2.0)
t_1
(if (<= (+ a 1.0) 2.0)
(/ (+ x (/ (* y z) t)) (+ 1.0 (/ (* y b) t)))
t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(y, ((z / t) / (a - -1.0)), (x / (a - -1.0)));
double tmp;
if ((a + 1.0) <= -2.0) {
tmp = t_1;
} else if ((a + 1.0) <= 2.0) {
tmp = (x + ((y * z) / t)) / (1.0 + ((y * b) / t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(y, Float64(Float64(z / t) / Float64(a - -1.0)), Float64(x / Float64(a - -1.0))) tmp = 0.0 if (Float64(a + 1.0) <= -2.0) tmp = t_1; elseif (Float64(a + 1.0) <= 2.0) tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(1.0 + Float64(Float64(y * b) / t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y * N[(N[(z / t), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a + 1.0), $MachinePrecision], -2.0], t$95$1, If[LessEqual[N[(a + 1.0), $MachinePrecision], 2.0], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{\frac{z}{t}}{a - -1}, \frac{x}{a - -1}\right)\\
\mathbf{if}\;a + 1 \leq -2:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a + 1 \leq 2:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{1 + \frac{y \cdot b}{t}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 a #s(literal 1 binary64)) < -2 or 2 < (+.f64 a #s(literal 1 binary64)) Initial program 75.8%
Taylor expanded in y around 0
lower-+.f6457.2
Applied rewrites57.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites57.4%
if -2 < (+.f64 a #s(literal 1 binary64)) < 2Initial program 75.8%
Taylor expanded in a around 0
Applied rewrites46.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma y (/ (/ z t) (- a -1.0)) (/ x (- a -1.0)))))
(if (<= t -2.1e-43)
t_1
(if (<= t 3.25e-141) (/ (+ z (/ (* t x) y)) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(y, ((z / t) / (a - -1.0)), (x / (a - -1.0)));
double tmp;
if (t <= -2.1e-43) {
tmp = t_1;
} else if (t <= 3.25e-141) {
tmp = (z + ((t * x) / y)) / b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(y, Float64(Float64(z / t) / Float64(a - -1.0)), Float64(x / Float64(a - -1.0))) tmp = 0.0 if (t <= -2.1e-43) tmp = t_1; elseif (t <= 3.25e-141) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y * N[(N[(z / t), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.1e-43], t$95$1, If[LessEqual[t, 3.25e-141], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{\frac{z}{t}}{a - -1}, \frac{x}{a - -1}\right)\\
\mathbf{if}\;t \leq -2.1 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.25 \cdot 10^{-141}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.1000000000000001e-43 or 3.2499999999999998e-141 < t Initial program 75.8%
Taylor expanded in y around 0
lower-+.f6457.2
Applied rewrites57.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites57.4%
if -2.1000000000000001e-43 < t < 3.2499999999999998e-141Initial program 75.8%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites76.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6439.5
Applied rewrites39.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (fma y (/ z t) x) (- a -1.0)))) (if (<= t -3e-18) t_1 (if (<= t 2.75e-136) (/ (+ z (/ (* t x) y)) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(y, (z / t), x) / (a - -1.0);
double tmp;
if (t <= -3e-18) {
tmp = t_1;
} else if (t <= 2.75e-136) {
tmp = (z + ((t * x) / y)) / b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(y, Float64(z / t), x) / Float64(a - -1.0)) tmp = 0.0 if (t <= -3e-18) tmp = t_1; elseif (t <= 2.75e-136) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / N[(a - -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3e-18], t$95$1, If[LessEqual[t, 2.75e-136], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{a - -1}\\
\mathbf{if}\;t \leq -3 \cdot 10^{-18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.75 \cdot 10^{-136}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.99999999999999983e-18 or 2.75e-136 < t Initial program 75.8%
Taylor expanded in y around 0
lower-+.f6457.2
Applied rewrites57.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lower-fma.f6457.4
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6457.4
Applied rewrites57.4%
if -2.99999999999999983e-18 < t < 2.75e-136Initial program 75.8%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites76.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6439.5
Applied rewrites39.5%
(FPCore (x y z t a b)
:precision binary64
(if (<= (+ a 1.0) -5e+97)
(/ (fma z (/ y t) x) a)
(if (<= (+ a 1.0) 1e+18)
(/ (+ z (/ (* t x) y)) b)
(/ (+ x (/ y (/ t z))) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a + 1.0) <= -5e+97) {
tmp = fma(z, (y / t), x) / a;
} else if ((a + 1.0) <= 1e+18) {
tmp = (z + ((t * x) / y)) / b;
} else {
tmp = (x + (y / (t / z))) / a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a + 1.0) <= -5e+97) tmp = Float64(fma(z, Float64(y / t), x) / a); elseif (Float64(a + 1.0) <= 1e+18) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); else tmp = Float64(Float64(x + Float64(y / Float64(t / z))) / a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a + 1.0), $MachinePrecision], -5e+97], N[(N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(a + 1.0), $MachinePrecision], 1e+18], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], N[(N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a + 1 \leq -5 \cdot 10^{+97}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, \frac{y}{t}, x\right)}{a}\\
\mathbf{elif}\;a + 1 \leq 10^{+18}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{\frac{t}{z}}}{a}\\
\end{array}
\end{array}
if (+.f64 a #s(literal 1 binary64)) < -4.99999999999999999e97Initial program 75.8%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6434.2
Applied rewrites34.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6435.1
Applied rewrites35.1%
if -4.99999999999999999e97 < (+.f64 a #s(literal 1 binary64)) < 1e18Initial program 75.8%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites76.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6439.5
Applied rewrites39.5%
if 1e18 < (+.f64 a #s(literal 1 binary64)) Initial program 75.8%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6434.2
Applied rewrites34.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lower-/.f6434.3
Applied rewrites34.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= (+ a 1.0) -5e+97)
(/ (fma z (/ y t) x) a)
(if (<= (+ a 1.0) 1e+18)
(/ (+ z (/ (* t x) y)) b)
(/ (fma (/ z t) y x) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a + 1.0) <= -5e+97) {
tmp = fma(z, (y / t), x) / a;
} else if ((a + 1.0) <= 1e+18) {
tmp = (z + ((t * x) / y)) / b;
} else {
tmp = fma((z / t), y, x) / a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a + 1.0) <= -5e+97) tmp = Float64(fma(z, Float64(y / t), x) / a); elseif (Float64(a + 1.0) <= 1e+18) tmp = Float64(Float64(z + Float64(Float64(t * x) / y)) / b); else tmp = Float64(fma(Float64(z / t), y, x) / a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a + 1.0), $MachinePrecision], -5e+97], N[(N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(a + 1.0), $MachinePrecision], 1e+18], N[(N[(z + N[(N[(t * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], N[(N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a + 1 \leq -5 \cdot 10^{+97}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, \frac{y}{t}, x\right)}{a}\\
\mathbf{elif}\;a + 1 \leq 10^{+18}:\\
\;\;\;\;\frac{z + \frac{t \cdot x}{y}}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{a}\\
\end{array}
\end{array}
if (+.f64 a #s(literal 1 binary64)) < -4.99999999999999999e97Initial program 75.8%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6434.2
Applied rewrites34.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6435.1
Applied rewrites35.1%
if -4.99999999999999999e97 < (+.f64 a #s(literal 1 binary64)) < 1e18Initial program 75.8%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites76.9%
Taylor expanded in b around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6439.5
Applied rewrites39.5%
if 1e18 < (+.f64 a #s(literal 1 binary64)) Initial program 75.8%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6434.2
Applied rewrites34.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l/N/A
lift-/.f64N/A
lower-fma.f6434.2
Applied rewrites34.2%
(FPCore (x y z t a b) :precision binary64 (if (<= y -9.2e+20) (/ z b) (if (<= y 1.8e+114) (/ x (- a -1.0)) (/ z b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -9.2e+20) {
tmp = z / b;
} else if (y <= 1.8e+114) {
tmp = x / (a - -1.0);
} else {
tmp = z / 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 <= (-9.2d+20)) then
tmp = z / b
else if (y <= 1.8d+114) then
tmp = x / (a - (-1.0d0))
else
tmp = z / 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 <= -9.2e+20) {
tmp = z / b;
} else if (y <= 1.8e+114) {
tmp = x / (a - -1.0);
} else {
tmp = z / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -9.2e+20: tmp = z / b elif y <= 1.8e+114: tmp = x / (a - -1.0) else: tmp = z / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -9.2e+20) tmp = Float64(z / b); elseif (y <= 1.8e+114) tmp = Float64(x / Float64(a - -1.0)); else tmp = Float64(z / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -9.2e+20) tmp = z / b; elseif (y <= 1.8e+114) tmp = x / (a - -1.0); else tmp = z / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -9.2e+20], N[(z / b), $MachinePrecision], If[LessEqual[y, 1.8e+114], N[(x / N[(a - -1.0), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.2 \cdot 10^{+20}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+114}:\\
\;\;\;\;\frac{x}{a - -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if y < -9.2e20 or 1.8e114 < y Initial program 75.8%
Taylor expanded in y around inf
lower-/.f6433.5
Applied rewrites33.5%
if -9.2e20 < y < 1.8e114Initial program 75.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6442.4
Applied rewrites42.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6442.4
Applied rewrites42.4%
(FPCore (x y z t a b) :precision binary64 (if (<= a -8.2e+177) (/ x a) (if (<= a 1.02e+18) (/ z b) (/ x a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -8.2e+177) {
tmp = x / a;
} else if (a <= 1.02e+18) {
tmp = z / b;
} else {
tmp = x / a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, 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 (a <= (-8.2d+177)) then
tmp = x / a
else if (a <= 1.02d+18) then
tmp = z / b
else
tmp = x / a
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 (a <= -8.2e+177) {
tmp = x / a;
} else if (a <= 1.02e+18) {
tmp = z / b;
} else {
tmp = x / a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -8.2e+177: tmp = x / a elif a <= 1.02e+18: tmp = z / b else: tmp = x / a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -8.2e+177) tmp = Float64(x / a); elseif (a <= 1.02e+18) tmp = Float64(z / b); else tmp = Float64(x / a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -8.2e+177) tmp = x / a; elseif (a <= 1.02e+18) tmp = z / b; else tmp = x / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -8.2e+177], N[(x / a), $MachinePrecision], If[LessEqual[a, 1.02e+18], N[(z / b), $MachinePrecision], N[(x / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.2 \cdot 10^{+177}:\\
\;\;\;\;\frac{x}{a}\\
\mathbf{elif}\;a \leq 1.02 \cdot 10^{+18}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a}\\
\end{array}
\end{array}
if a < -8.20000000000000029e177 or 1.02e18 < a Initial program 75.8%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6434.2
Applied rewrites34.2%
Taylor expanded in x around inf
lower-/.f6425.6
Applied rewrites25.6%
if -8.20000000000000029e177 < a < 1.02e18Initial program 75.8%
Taylor expanded in y around inf
lower-/.f6433.5
Applied rewrites33.5%
(FPCore (x y z t a b) :precision binary64 (/ x a))
double code(double x, double y, double z, double t, double a, double b) {
return x / a;
}
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 / a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x / a;
}
def code(x, y, z, t, a, b): return x / a
function code(x, y, z, t, a, b) return Float64(x / a) end
function tmp = code(x, y, z, t, a, b) tmp = x / a; end
code[x_, y_, z_, t_, a_, b_] := N[(x / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{a}
\end{array}
Initial program 75.8%
Taylor expanded in a around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6434.2
Applied rewrites34.2%
Taylor expanded in x around inf
lower-/.f6425.6
Applied rewrites25.6%
herbie shell --seed 2025150
(FPCore (x y z t a b)
:name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
(/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))