
(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));
}
real(8) function code(x, y, z, t, a, b)
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}
Sampling outcomes in binary64 precision:
Herbie found 17 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));
}
real(8) function code(x, y, z, t, a, b)
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 (+ (+ a 1.0) (/ (* y b) t))) (t_2 (/ (+ x (/ (* y z) t)) t_1)))
(if (<= t_2 (- INFINITY))
(* z (* (pow (fma (/ y t) b (+ 1.0 a)) -1.0) (+ (/ y t) (/ x z))))
(if (<= t_2 -1e-314)
t_2
(if (<= t_2 0.0)
(+ (/ z b) (/ (* t (- (/ x b) (/ z (* b b)))) y))
(if (<= t_2 5e+295)
(/ (+ x (pow (/ t (* z y)) -1.0)) t_1)
(/ z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + 1.0) + ((y * b) / t);
double t_2 = (x + ((y * z) / t)) / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = z * (pow(fma((y / t), b, (1.0 + a)), -1.0) * ((y / t) + (x / z)));
} else if (t_2 <= -1e-314) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = (z / b) + ((t * ((x / b) - (z / (b * b)))) / y);
} else if (t_2 <= 5e+295) {
tmp = (x + pow((t / (z * y)), -1.0)) / t_1;
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t)) t_2 = Float64(Float64(x + Float64(Float64(y * z) / t)) / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(z * Float64((fma(Float64(y / t), b, Float64(1.0 + a)) ^ -1.0) * Float64(Float64(y / t) + Float64(x / z)))); elseif (t_2 <= -1e-314) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(Float64(z / b) + Float64(Float64(t * Float64(Float64(x / b) - Float64(z / Float64(b * b)))) / y)); elseif (t_2 <= 5e+295) tmp = Float64(Float64(x + (Float64(t / Float64(z * y)) ^ -1.0)) / t_1); else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(z * N[(N[Power[N[(N[(y / t), $MachinePrecision] * b + N[(1.0 + a), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * N[(N[(y / t), $MachinePrecision] + N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e-314], t$95$2, If[LessEqual[t$95$2, 0.0], N[(N[(z / b), $MachinePrecision] + N[(N[(t * N[(N[(x / b), $MachinePrecision] - N[(z / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+295], N[(N[(x + N[Power[N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(z / b), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + 1\right) + \frac{y \cdot b}{t}\\
t_2 := \frac{x + \frac{y \cdot z}{t}}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;z \cdot \left({\left(\mathsf{fma}\left(\frac{y}{t}, b, 1 + a\right)\right)}^{-1} \cdot \left(\frac{y}{t} + \frac{x}{z}\right)\right)\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-314}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{z}{b} + \frac{t \cdot \left(\frac{x}{b} - \frac{z}{b \cdot b}\right)}{y}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+295}:\\
\;\;\;\;\frac{x + {\left(\frac{t}{z \cdot y}\right)}^{-1}}{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 20.0%
Taylor expanded in z around inf
remove-double-negN/A
mul-1-negN/A
distribute-lft-outN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
Applied rewrites71.0%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -9.9999999996e-315Initial program 99.0%
if -9.9999999996e-315 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -0.0Initial program 54.1%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6440.2
Applied rewrites40.2%
Taylor expanded in y around -inf
Applied rewrites80.4%
if -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 4.99999999999999991e295Initial program 99.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
if 4.99999999999999991e295 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 15.7%
Taylor expanded in y around inf
lower-/.f6486.0
Applied rewrites86.0%
Final simplification93.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ a 1.0) (/ (* y b) t))) (t_2 (/ (+ x (/ (* y z) t)) t_1)))
(if (<= t_2 (- INFINITY))
(* z (/ y (fma (* b y) 1.0 t)))
(if (<= t_2 -1e-314)
t_2
(if (<= t_2 0.0)
(+ (/ z b) (/ (* t (- (/ x b) (/ z (* b b)))) y))
(if (<= t_2 5e+295)
(/ (+ x (pow (/ t (* z y)) -1.0)) t_1)
(/ z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + 1.0) + ((y * b) / t);
double t_2 = (x + ((y * z) / t)) / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = z * (y / fma((b * y), 1.0, t));
} else if (t_2 <= -1e-314) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = (z / b) + ((t * ((x / b) - (z / (b * b)))) / y);
} else if (t_2 <= 5e+295) {
tmp = (x + pow((t / (z * y)), -1.0)) / t_1;
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t)) t_2 = Float64(Float64(x + Float64(Float64(y * z) / t)) / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(z * Float64(y / fma(Float64(b * y), 1.0, t))); elseif (t_2 <= -1e-314) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(Float64(z / b) + Float64(Float64(t * Float64(Float64(x / b) - Float64(z / Float64(b * b)))) / y)); elseif (t_2 <= 5e+295) tmp = Float64(Float64(x + (Float64(t / Float64(z * y)) ^ -1.0)) / t_1); else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(z * N[(y / N[(N[(b * y), $MachinePrecision] * 1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e-314], t$95$2, If[LessEqual[t$95$2, 0.0], N[(N[(z / b), $MachinePrecision] + N[(N[(t * N[(N[(x / b), $MachinePrecision] - N[(z / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+295], N[(N[(x + N[Power[N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(z / b), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + 1\right) + \frac{y \cdot b}{t}\\
t_2 := \frac{x + \frac{y \cdot z}{t}}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;z \cdot \frac{y}{\mathsf{fma}\left(b \cdot y, 1, t\right)}\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-314}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{z}{b} + \frac{t \cdot \left(\frac{x}{b} - \frac{z}{b \cdot b}\right)}{y}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+295}:\\
\;\;\;\;\frac{x + {\left(\frac{t}{z \cdot y}\right)}^{-1}}{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 20.0%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6417.6
Applied rewrites17.6%
Taylor expanded in x around 0
Applied rewrites58.1%
Applied rewrites58.2%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -9.9999999996e-315Initial program 99.0%
if -9.9999999996e-315 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -0.0Initial program 54.1%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6440.2
Applied rewrites40.2%
Taylor expanded in y around -inf
Applied rewrites80.4%
if -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 4.99999999999999991e295Initial program 99.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
if 4.99999999999999991e295 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 15.7%
Taylor expanded in y around inf
lower-/.f6486.0
Applied rewrites86.0%
Final simplification92.7%
(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))
(* z (/ y (fma (* b y) 1.0 t)))
(if (<= t_1 -1e-314)
t_1
(if (<= t_1 0.0)
(+ (/ z b) (/ (* t (- (/ x b) (/ z (* b b)))) y))
(if (<= t_1 5e+295) 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 = z * (y / fma((b * y), 1.0, t));
} else if (t_1 <= -1e-314) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (z / b) + ((t * ((x / b) - (z / (b * b)))) / y);
} else if (t_1 <= 5e+295) {
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 = Float64(z * Float64(y / fma(Float64(b * y), 1.0, t))); elseif (t_1 <= -1e-314) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(Float64(z / b) + Float64(Float64(t * Float64(Float64(x / b) - Float64(z / Float64(b * b)))) / y)); elseif (t_1 <= 5e+295) 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[(z * N[(y / N[(N[(b * y), $MachinePrecision] * 1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e-314], t$95$1, If[LessEqual[t$95$1, 0.0], N[(N[(z / b), $MachinePrecision] + N[(N[(t * N[(N[(x / b), $MachinePrecision] - N[(z / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+295], 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:\\
\;\;\;\;z \cdot \frac{y}{\mathsf{fma}\left(b \cdot y, 1, t\right)}\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-314}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{z}{b} + \frac{t \cdot \left(\frac{x}{b} - \frac{z}{b \cdot b}\right)}{y}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+295}:\\
\;\;\;\;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 20.0%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6417.6
Applied rewrites17.6%
Taylor expanded in x around 0
Applied rewrites58.1%
Applied rewrites58.2%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -9.9999999996e-315 or -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 4.99999999999999991e295Initial program 99.3%
if -9.9999999996e-315 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < -0.0Initial program 54.1%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6440.2
Applied rewrites40.2%
Taylor expanded in y around -inf
Applied rewrites80.4%
if 4.99999999999999991e295 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 15.7%
Taylor expanded in y around inf
lower-/.f6486.0
Applied rewrites86.0%
Final simplification92.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ a 1.0) (/ (* y b) t)))
(t_2 (/ (+ x (/ (* y z) t)) t_1))
(t_3 (/ (fma z (/ y t) x) t_1)))
(if (<= t_2 -5e-306)
t_3
(if (<= t_2 1e-125)
(/ (fma (/ z t) y x) (fma (/ b t) y (+ 1.0 a)))
(if (<= t_2 INFINITY) t_3 (/ z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + 1.0) + ((y * b) / t);
double t_2 = (x + ((y * z) / t)) / t_1;
double t_3 = fma(z, (y / t), x) / t_1;
double tmp;
if (t_2 <= -5e-306) {
tmp = t_3;
} else if (t_2 <= 1e-125) {
tmp = fma((z / t), y, x) / fma((b / t), y, (1.0 + a));
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_3;
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t)) t_2 = Float64(Float64(x + Float64(Float64(y * z) / t)) / t_1) t_3 = Float64(fma(z, Float64(y / t), x) / t_1) tmp = 0.0 if (t_2 <= -5e-306) tmp = t_3; elseif (t_2 <= 1e-125) tmp = Float64(fma(Float64(z / t), y, x) / fma(Float64(b / t), y, Float64(1.0 + a))); elseif (t_2 <= 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[(a + 1.0), $MachinePrecision] + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-306], t$95$3, If[LessEqual[t$95$2, 1e-125], N[(N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision] / N[(N[(b / t), $MachinePrecision] * y + N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], t$95$3, N[(z / b), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + 1\right) + \frac{y \cdot b}{t}\\
t_2 := \frac{x + \frac{y \cdot z}{t}}{t\_1}\\
t_3 := \frac{\mathsf{fma}\left(z, \frac{y}{t}, x\right)}{t\_1}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-306}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{-125}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{\mathsf{fma}\left(\frac{b}{t}, y, 1 + a\right)}\\
\mathbf{elif}\;t\_2 \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))) < -4.99999999999999998e-306 or 1.00000000000000001e-125 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 87.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
if -4.99999999999999998e-306 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 1.00000000000000001e-125Initial program 73.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.5
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6481.4
Applied rewrites81.4%
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 0.0%
Taylor expanded in y around inf
lower-/.f64100.0
Applied rewrites100.0%
(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))
(* z (/ y (fma (* b y) 1.0 t)))
(if (<= t_1 5e+295) 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 = z * (y / fma((b * y), 1.0, t));
} else if (t_1 <= 5e+295) {
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 = Float64(z * Float64(y / fma(Float64(b * y), 1.0, t))); elseif (t_1 <= 5e+295) 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[(z * N[(y / N[(N[(b * y), $MachinePrecision] * 1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+295], 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:\\
\;\;\;\;z \cdot \frac{y}{\mathsf{fma}\left(b \cdot y, 1, t\right)}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+295}:\\
\;\;\;\;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 20.0%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6417.6
Applied rewrites17.6%
Taylor expanded in x around 0
Applied rewrites58.1%
Applied rewrites58.2%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 4.99999999999999991e295Initial program 91.7%
if 4.99999999999999991e295 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 15.7%
Taylor expanded in y around inf
lower-/.f6486.0
Applied rewrites86.0%
(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))
(* z (/ y (fma (* b y) 1.0 t)))
(if (<= t_1 2e+292) (/ x (fma (/ y t) b (+ 1.0 a))) (/ 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 = z * (y / fma((b * y), 1.0, t));
} else if (t_1 <= 2e+292) {
tmp = x / fma((y / t), b, (1.0 + a));
} 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 = Float64(z * Float64(y / fma(Float64(b * y), 1.0, t))); elseif (t_1 <= 2e+292) tmp = Float64(x / fma(Float64(y / t), b, Float64(1.0 + a))); 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[(z * N[(y / N[(N[(b * y), $MachinePrecision] * 1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+292], N[(x / N[(N[(y / t), $MachinePrecision] * b + N[(1.0 + a), $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:\\
\;\;\;\;z \cdot \frac{y}{\mathsf{fma}\left(b \cdot y, 1, t\right)}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+292}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(\frac{y}{t}, b, 1 + a\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 20.0%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6417.6
Applied rewrites17.6%
Taylor expanded in x around 0
Applied rewrites58.1%
Applied rewrites58.2%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) < 2e292Initial program 91.7%
Taylor expanded in x around inf
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f6461.3
Applied rewrites61.3%
if 2e292 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a #s(literal 1 binary64)) (/.f64 (*.f64 y b) t))) Initial program 18.0%
Taylor expanded in y around inf
lower-/.f6483.9
Applied rewrites83.9%
(FPCore (x y z t a b) :precision binary64 (if (<= (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))) INFINITY) (/ (fma (/ z t) y x) (fma (/ b t) y (+ 1.0 a))) (/ z b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))) <= ((double) INFINITY)) {
tmp = fma((z / t), y, x) / fma((b / t), y, (1.0 + a));
} else {
tmp = z / b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t))) <= Inf) tmp = Float64(fma(Float64(z / t), y, x) / fma(Float64(b / t), y, Float64(1.0 + a))); else tmp = Float64(z / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[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], Infinity], N[(N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision] / N[(N[(b / t), $MachinePrecision] * y + N[(1.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq \infty:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{\mathsf{fma}\left(\frac{b}{t}, y, 1 + a\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 83.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6480.6
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6479.8
Applied rewrites79.8%
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 0.0%
Taylor expanded in y around inf
lower-/.f64100.0
Applied rewrites100.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (/ (* y z) t))))
(if (<= a -3.4e-10)
(/ t_1 (+ 1.0 a))
(if (<= a 4.4e-17)
(/ t_1 (fma (/ b t) y 1.0))
(/ (fma (/ y t) z x) (+ 1.0 a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + ((y * z) / t);
double tmp;
if (a <= -3.4e-10) {
tmp = t_1 / (1.0 + a);
} else if (a <= 4.4e-17) {
tmp = t_1 / fma((b / t), y, 1.0);
} else {
tmp = fma((y / t), z, x) / (1.0 + a);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(Float64(y * z) / t)) tmp = 0.0 if (a <= -3.4e-10) tmp = Float64(t_1 / Float64(1.0 + a)); elseif (a <= 4.4e-17) tmp = Float64(t_1 / fma(Float64(b / t), y, 1.0)); else tmp = Float64(fma(Float64(y / t), z, x) / Float64(1.0 + a)); 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]}, If[LessEqual[a, -3.4e-10], N[(t$95$1 / N[(1.0 + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.4e-17], N[(t$95$1 / N[(N[(b / t), $MachinePrecision] * y + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot z}{t}\\
\mathbf{if}\;a \leq -3.4 \cdot 10^{-10}:\\
\;\;\;\;\frac{t\_1}{1 + a}\\
\mathbf{elif}\;a \leq 4.4 \cdot 10^{-17}:\\
\;\;\;\;\frac{t\_1}{\mathsf{fma}\left(\frac{b}{t}, y, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{1 + a}\\
\end{array}
\end{array}
if a < -3.40000000000000015e-10Initial program 87.8%
Taylor expanded in y around 0
lower-+.f6481.8
Applied rewrites81.8%
if -3.40000000000000015e-10 < a < 4.4e-17Initial program 72.9%
Taylor expanded in y around inf
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6474.3
Applied rewrites74.3%
Taylor expanded in y around inf
Applied rewrites74.3%
if 4.4e-17 < a Initial program 76.0%
Taylor expanded in b around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f6466.4
Applied rewrites66.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -3.3e-10)
(/ (+ x (/ (* y z) t)) (+ 1.0 a))
(if (<= a 7e-19)
(/ (fma (/ z t) y x) (fma (/ b t) y 1.0))
(/ (fma (/ y t) z x) (+ 1.0 a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.3e-10) {
tmp = (x + ((y * z) / t)) / (1.0 + a);
} else if (a <= 7e-19) {
tmp = fma((z / t), y, x) / fma((b / t), y, 1.0);
} else {
tmp = fma((y / t), z, x) / (1.0 + a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -3.3e-10) tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(1.0 + a)); elseif (a <= 7e-19) tmp = Float64(fma(Float64(z / t), y, x) / fma(Float64(b / t), y, 1.0)); else tmp = Float64(fma(Float64(y / t), z, x) / Float64(1.0 + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.3e-10], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 7e-19], N[(N[(N[(z / t), $MachinePrecision] * y + x), $MachinePrecision] / N[(N[(b / t), $MachinePrecision] * y + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.3 \cdot 10^{-10}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{1 + a}\\
\mathbf{elif}\;a \leq 7 \cdot 10^{-19}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{\mathsf{fma}\left(\frac{b}{t}, y, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{1 + a}\\
\end{array}
\end{array}
if a < -3.3e-10Initial program 87.8%
Taylor expanded in y around 0
lower-+.f6481.8
Applied rewrites81.8%
if -3.3e-10 < a < 7.00000000000000031e-19Initial program 72.6%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6473.3
Applied rewrites73.3%
Applied rewrites72.8%
Applied rewrites74.2%
if 7.00000000000000031e-19 < a Initial program 76.4%
Taylor expanded in b around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f6465.5
Applied rewrites65.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ x (fma (/ y t) b 1.0))) (t_2 (/ (fma (/ y t) z x) a)))
(if (<= a -1.05)
t_2
(if (<= a -8.2e-184)
t_1
(if (<= a 2.1e-238)
(* z (/ y (fma (* b y) 1.0 t)))
(if (<= a 0.0038) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / fma((y / t), b, 1.0);
double t_2 = fma((y / t), z, x) / a;
double tmp;
if (a <= -1.05) {
tmp = t_2;
} else if (a <= -8.2e-184) {
tmp = t_1;
} else if (a <= 2.1e-238) {
tmp = z * (y / fma((b * y), 1.0, t));
} else if (a <= 0.0038) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x / fma(Float64(y / t), b, 1.0)) t_2 = Float64(fma(Float64(y / t), z, x) / a) tmp = 0.0 if (a <= -1.05) tmp = t_2; elseif (a <= -8.2e-184) tmp = t_1; elseif (a <= 2.1e-238) tmp = Float64(z * Float64(y / fma(Float64(b * y), 1.0, t))); elseif (a <= 0.0038) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x / N[(N[(y / t), $MachinePrecision] * b + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[a, -1.05], t$95$2, If[LessEqual[a, -8.2e-184], t$95$1, If[LessEqual[a, 2.1e-238], N[(z * N[(y / N[(N[(b * y), $MachinePrecision] * 1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 0.0038], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{\mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\\
t_2 := \frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{a}\\
\mathbf{if}\;a \leq -1.05:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq -8.2 \cdot 10^{-184}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{-238}:\\
\;\;\;\;z \cdot \frac{y}{\mathsf{fma}\left(b \cdot y, 1, t\right)}\\
\mathbf{elif}\;a \leq 0.0038:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -1.05000000000000004 or 0.00379999999999999999 < a Initial program 81.2%
Taylor expanded in a around inf
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6471.8
Applied rewrites71.8%
if -1.05000000000000004 < a < -8.2e-184 or 2.1000000000000001e-238 < a < 0.00379999999999999999Initial program 72.8%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6470.8
Applied rewrites70.8%
Taylor expanded in x around inf
Applied rewrites56.9%
if -8.2e-184 < a < 2.1000000000000001e-238Initial program 75.9%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6478.0
Applied rewrites78.0%
Taylor expanded in x around 0
Applied rewrites41.9%
Applied rewrites56.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2e+58) (not (<= y 2.4e+115))) (/ z b) (/ (fma (/ y t) z x) (+ 1.0 a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2e+58) || !(y <= 2.4e+115)) {
tmp = z / b;
} else {
tmp = fma((y / t), z, x) / (1.0 + a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2e+58) || !(y <= 2.4e+115)) tmp = Float64(z / b); else tmp = Float64(fma(Float64(y / t), z, x) / Float64(1.0 + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2e+58], N[Not[LessEqual[y, 2.4e+115]], $MachinePrecision]], N[(z / b), $MachinePrecision], N[(N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision] / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+58} \lor \neg \left(y \leq 2.4 \cdot 10^{+115}\right):\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{1 + a}\\
\end{array}
\end{array}
if y < -1.99999999999999989e58 or 2.4e115 < y Initial program 48.4%
Taylor expanded in y around inf
lower-/.f6465.2
Applied rewrites65.2%
if -1.99999999999999989e58 < y < 2.4e115Initial program 92.0%
Taylor expanded in b around 0
lower-/.f64N/A
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f6478.2
Applied rewrites78.2%
Final simplification73.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (+ a 1.0) -50.0) (not (<= (+ a 1.0) 2.0))) (/ x a) (- x (* x a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a + 1.0) <= -50.0) || !((a + 1.0) <= 2.0)) {
tmp = x / a;
} else {
tmp = x - (x * a);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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 + 1.0d0) <= (-50.0d0)) .or. (.not. ((a + 1.0d0) <= 2.0d0))) then
tmp = x / a
else
tmp = x - (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 + 1.0) <= -50.0) || !((a + 1.0) <= 2.0)) {
tmp = x / a;
} else {
tmp = x - (x * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((a + 1.0) <= -50.0) or not ((a + 1.0) <= 2.0): tmp = x / a else: tmp = x - (x * a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a + 1.0) <= -50.0) || !(Float64(a + 1.0) <= 2.0)) tmp = Float64(x / a); else tmp = Float64(x - Float64(x * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((a + 1.0) <= -50.0) || ~(((a + 1.0) <= 2.0))) tmp = x / a; else tmp = x - (x * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a + 1.0), $MachinePrecision], -50.0], N[Not[LessEqual[N[(a + 1.0), $MachinePrecision], 2.0]], $MachinePrecision]], N[(x / a), $MachinePrecision], N[(x - N[(x * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a + 1 \leq -50 \lor \neg \left(a + 1 \leq 2\right):\\
\;\;\;\;\frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot a\\
\end{array}
\end{array}
if (+.f64 a #s(literal 1 binary64)) < -50 or 2 < (+.f64 a #s(literal 1 binary64)) Initial program 81.2%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6447.7
Applied rewrites47.7%
Taylor expanded in a around inf
Applied rewrites46.4%
if -50 < (+.f64 a #s(literal 1 binary64)) < 2Initial program 73.9%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6435.7
Applied rewrites35.7%
Taylor expanded in a around 0
Applied rewrites35.6%
Final simplification40.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -9e+54) (not (<= y 8.8e-13))) (/ z b) (/ x (+ 1.0 a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -9e+54) || !(y <= 8.8e-13)) {
tmp = z / b;
} else {
tmp = x / (1.0 + a);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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 <= (-9d+54)) .or. (.not. (y <= 8.8d-13))) then
tmp = z / b
else
tmp = x / (1.0d0 + 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 ((y <= -9e+54) || !(y <= 8.8e-13)) {
tmp = z / b;
} else {
tmp = x / (1.0 + a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -9e+54) or not (y <= 8.8e-13): tmp = z / b else: tmp = x / (1.0 + a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -9e+54) || !(y <= 8.8e-13)) tmp = Float64(z / b); else tmp = Float64(x / Float64(1.0 + a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -9e+54) || ~((y <= 8.8e-13))) tmp = z / b; else tmp = x / (1.0 + a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -9e+54], N[Not[LessEqual[y, 8.8e-13]], $MachinePrecision]], N[(z / b), $MachinePrecision], N[(x / N[(1.0 + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+54} \lor \neg \left(y \leq 8.8 \cdot 10^{-13}\right):\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 + a}\\
\end{array}
\end{array}
if y < -8.99999999999999968e54 or 8.79999999999999986e-13 < y Initial program 56.4%
Taylor expanded in y around inf
lower-/.f6458.1
Applied rewrites58.1%
if -8.99999999999999968e54 < y < 8.79999999999999986e-13Initial program 93.9%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6461.0
Applied rewrites61.0%
Final simplification59.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -3.4e+15) (not (<= a 2.4e+200))) (/ x a) (/ z b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -3.4e+15) || !(a <= 2.4e+200)) {
tmp = x / a;
} else {
tmp = z / b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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 <= (-3.4d+15)) .or. (.not. (a <= 2.4d+200))) then
tmp = x / a
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 ((a <= -3.4e+15) || !(a <= 2.4e+200)) {
tmp = x / a;
} else {
tmp = z / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -3.4e+15) or not (a <= 2.4e+200): tmp = x / a else: tmp = z / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -3.4e+15) || !(a <= 2.4e+200)) tmp = Float64(x / a); else tmp = Float64(z / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -3.4e+15) || ~((a <= 2.4e+200))) tmp = x / a; else tmp = z / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -3.4e+15], N[Not[LessEqual[a, 2.4e+200]], $MachinePrecision]], N[(x / a), $MachinePrecision], N[(z / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.4 \cdot 10^{+15} \lor \neg \left(a \leq 2.4 \cdot 10^{+200}\right):\\
\;\;\;\;\frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if a < -3.4e15 or 2.4000000000000001e200 < a Initial program 85.2%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6455.6
Applied rewrites55.6%
Taylor expanded in a around inf
Applied rewrites55.6%
if -3.4e15 < a < 2.4000000000000001e200Initial program 74.0%
Taylor expanded in y around inf
lower-/.f6442.0
Applied rewrites42.0%
Final simplification46.1%
(FPCore (x y z t a b) :precision binary64 (- x (* x a)))
double code(double x, double y, double z, double t, double a, double b) {
return x - (x * a);
}
real(8) function code(x, y, z, t, a, b)
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 - (x * a)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x - (x * a);
}
def code(x, y, z, t, a, b): return x - (x * a)
function code(x, y, z, t, a, b) return Float64(x - Float64(x * a)) end
function tmp = code(x, y, z, t, a, b) tmp = x - (x * a); end
code[x_, y_, z_, t_, a_, b_] := N[(x - N[(x * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - x \cdot a
\end{array}
Initial program 77.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6441.5
Applied rewrites41.5%
Taylor expanded in a around 0
Applied rewrites19.7%
(FPCore (x y z t a b) :precision binary64 (* (- 1.0 a) x))
double code(double x, double y, double z, double t, double a, double b) {
return (1.0 - a) * x;
}
real(8) function code(x, y, z, t, a, b)
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 = (1.0d0 - a) * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (1.0 - a) * x;
}
def code(x, y, z, t, a, b): return (1.0 - a) * x
function code(x, y, z, t, a, b) return Float64(Float64(1.0 - a) * x) end
function tmp = code(x, y, z, t, a, b) tmp = (1.0 - a) * x; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(1.0 - a), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - a\right) \cdot x
\end{array}
Initial program 77.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6441.5
Applied rewrites41.5%
Taylor expanded in a around 0
Applied rewrites19.7%
Taylor expanded in a around 0
Applied rewrites19.7%
(FPCore (x y z t a b) :precision binary64 (* (- a) x))
double code(double x, double y, double z, double t, double a, double b) {
return -a * x;
}
real(8) function code(x, y, z, t, a, b)
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 = -a * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return -a * x;
}
def code(x, y, z, t, a, b): return -a * x
function code(x, y, z, t, a, b) return Float64(Float64(-a) * x) end
function tmp = code(x, y, z, t, a, b) tmp = -a * x; end
code[x_, y_, z_, t_, a_, b_] := N[((-a) * x), $MachinePrecision]
\begin{array}{l}
\\
\left(-a\right) \cdot x
\end{array}
Initial program 77.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6441.5
Applied rewrites41.5%
Taylor expanded in a around 0
Applied rewrites19.7%
Taylor expanded in a around inf
Applied rewrites3.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(* 1.0 (* (+ x (* (/ y t) z)) (/ 1.0 (+ (+ a 1.0) (* (/ y t) b)))))))
(if (< t -1.3659085366310088e-271)
t_1
(if (< t 3.036967103737246e-130) (/ z b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.0 * ((x + ((y / t) * z)) * (1.0 / ((a + 1.0) + ((y / t) * b))));
double tmp;
if (t < -1.3659085366310088e-271) {
tmp = t_1;
} else if (t < 3.036967103737246e-130) {
tmp = z / b;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = 1.0d0 * ((x + ((y / t) * z)) * (1.0d0 / ((a + 1.0d0) + ((y / t) * b))))
if (t < (-1.3659085366310088d-271)) then
tmp = t_1
else if (t < 3.036967103737246d-130) then
tmp = z / b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.0 * ((x + ((y / t) * z)) * (1.0 / ((a + 1.0) + ((y / t) * b))));
double tmp;
if (t < -1.3659085366310088e-271) {
tmp = t_1;
} else if (t < 3.036967103737246e-130) {
tmp = z / b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = 1.0 * ((x + ((y / t) * z)) * (1.0 / ((a + 1.0) + ((y / t) * b)))) tmp = 0 if t < -1.3659085366310088e-271: tmp = t_1 elif t < 3.036967103737246e-130: tmp = z / b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(1.0 * Float64(Float64(x + Float64(Float64(y / t) * z)) * Float64(1.0 / Float64(Float64(a + 1.0) + Float64(Float64(y / t) * b))))) tmp = 0.0 if (t < -1.3659085366310088e-271) tmp = t_1; elseif (t < 3.036967103737246e-130) tmp = Float64(z / b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = 1.0 * ((x + ((y / t) * z)) * (1.0 / ((a + 1.0) + ((y / t) * b)))); tmp = 0.0; if (t < -1.3659085366310088e-271) tmp = t_1; elseif (t < 3.036967103737246e-130) tmp = z / b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(1.0 * N[(N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[(a + 1.0), $MachinePrecision] + N[(N[(y / t), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.3659085366310088e-271], t$95$1, If[Less[t, 3.036967103737246e-130], N[(z / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 \cdot \left(\left(x + \frac{y}{t} \cdot z\right) \cdot \frac{1}{\left(a + 1\right) + \frac{y}{t} \cdot b}\right)\\
\mathbf{if}\;t < -1.3659085366310088 \cdot 10^{-271}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t < 3.036967103737246 \cdot 10^{-130}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024314
(FPCore (x y z t a b)
:name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
:alt
(! :herbie-platform default (if (< t -1707385670788761/12500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1) (* (/ y t) b))))) (if (< t 1518483551868623/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ z b) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1) (* (/ y t) b))))))))
(/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))