
(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 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));
}
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 (/ (+ x (/ (* y z) t)) (+ (/ (* y b) t) (+ a 1.0))))
(t_2 (/ b (/ t y))))
(if (<= t_1 (- INFINITY))
(/ y (/ (* t (+ (+ a 1.0) t_2)) z))
(if (<= t_1 -2e-306)
t_1
(if (<= t_1 0.0)
(/ (+ x (/ y (/ t z))) (+ a (+ 1.0 t_2)))
(if (<= t_1 2e+307) 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)) / (((y * b) / t) + (a + 1.0));
double t_2 = b / (t / y);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = y / ((t * ((a + 1.0) + t_2)) / z);
} else if (t_1 <= -2e-306) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (x + (y / (t / z))) / (a + (1.0 + t_2));
} else if (t_1 <= 2e+307) {
tmp = t_1;
} else {
tmp = z / b;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / (((y * b) / t) + (a + 1.0));
double t_2 = b / (t / y);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = y / ((t * ((a + 1.0) + t_2)) / z);
} else if (t_1 <= -2e-306) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (x + (y / (t / z))) / (a + (1.0 + t_2));
} else if (t_1 <= 2e+307) {
tmp = t_1;
} else {
tmp = z / b;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x + ((y * z) / t)) / (((y * b) / t) + (a + 1.0)) t_2 = b / (t / y) tmp = 0 if t_1 <= -math.inf: tmp = y / ((t * ((a + 1.0) + t_2)) / z) elif t_1 <= -2e-306: tmp = t_1 elif t_1 <= 0.0: tmp = (x + (y / (t / z))) / (a + (1.0 + t_2)) elif t_1 <= 2e+307: 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(Float64(y * b) / t) + Float64(a + 1.0))) t_2 = Float64(b / Float64(t / y)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(y / Float64(Float64(t * Float64(Float64(a + 1.0) + t_2)) / z)); elseif (t_1 <= -2e-306) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(Float64(x + Float64(y / Float64(t / z))) / Float64(a + Float64(1.0 + t_2))); elseif (t_1 <= 2e+307) tmp = t_1; else tmp = Float64(z / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x + ((y * z) / t)) / (((y * b) / t) + (a + 1.0)); t_2 = b / (t / y); tmp = 0.0; if (t_1 <= -Inf) tmp = y / ((t * ((a + 1.0) + t_2)) / z); elseif (t_1 <= -2e-306) tmp = t_1; elseif (t_1 <= 0.0) tmp = (x + (y / (t / z))) / (a + (1.0 + t_2)); elseif (t_1 <= 2e+307) tmp = t_1; else tmp = z / b; end tmp_2 = 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[(N[(y * b), $MachinePrecision] / t), $MachinePrecision] + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b / N[(t / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y / N[(N[(t * N[(N[(a + 1.0), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -2e-306], t$95$1, If[LessEqual[t$95$1, 0.0], N[(N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a + N[(1.0 + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+307], t$95$1, N[(z / b), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\frac{y \cdot b}{t} + \left(a + 1\right)}\\
t_2 := \frac{b}{\frac{t}{y}}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{t \cdot \left(\left(a + 1\right) + t_2\right)}{z}}\\
\mathbf{elif}\;t_1 \leq -2 \cdot 10^{-306}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{x + \frac{y}{\frac{t}{z}}}{a + \left(1 + t_2\right)}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 31.9%
*-commutative31.9%
associate-*l/59.4%
associate-+l+59.4%
associate-*r/59.4%
*-commutative59.4%
Simplified59.4%
Taylor expanded in x around 0 59.0%
associate-/l*92.8%
associate-+r+92.8%
associate-/l*71.6%
Simplified71.6%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -2.00000000000000006e-306 or -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 1.99999999999999997e307Initial program 99.8%
if -2.00000000000000006e-306 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -0.0Initial program 56.9%
associate-/l*57.9%
associate-*l/78.8%
*-commutative78.8%
cancel-sign-sub78.8%
*-commutative78.8%
associate-*l/57.9%
associate-+r-57.9%
associate-*l/78.8%
*-commutative78.8%
cancel-sign-sub78.8%
*-commutative78.8%
associate-*l/57.9%
*-commutative57.9%
associate-/l*78.8%
Simplified78.8%
if 1.99999999999999997e307 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) Initial program 7.1%
*-commutative7.1%
associate-*l/17.3%
associate-+l+17.3%
associate-*r/22.4%
*-commutative22.4%
Simplified22.4%
Taylor expanded in t around 0 82.1%
Final simplification92.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (/ (* y b) t) (+ a 1.0))))
(t_2 (+ a (fma b (/ y t) 1.0))))
(if (<= t_1 -5e-94)
(/ (+ x (* z (/ y t))) t_2)
(if (<= t_1 0.0)
(/ (fma y (/ z t) x) t_2)
(if (<= t_1 2e+307)
t_1
(if (<= t_1 INFINITY)
(/ y (/ (* t (+ (+ a 1.0) (/ b (/ t y)))) z))
(fma
t
(+ (/ (/ x b) y) (* (/ z (pow b 2.0)) (/ (- -1.0 a) y)))
(/ z b))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / (((y * b) / t) + (a + 1.0));
double t_2 = a + fma(b, (y / t), 1.0);
double tmp;
if (t_1 <= -5e-94) {
tmp = (x + (z * (y / t))) / t_2;
} else if (t_1 <= 0.0) {
tmp = fma(y, (z / t), x) / t_2;
} else if (t_1 <= 2e+307) {
tmp = t_1;
} else if (t_1 <= ((double) INFINITY)) {
tmp = y / ((t * ((a + 1.0) + (b / (t / y)))) / z);
} else {
tmp = fma(t, (((x / b) / y) + ((z / pow(b, 2.0)) * ((-1.0 - a) / y))), (z / b));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(Float64(y * b) / t) + Float64(a + 1.0))) t_2 = Float64(a + fma(b, Float64(y / t), 1.0)) tmp = 0.0 if (t_1 <= -5e-94) tmp = Float64(Float64(x + Float64(z * Float64(y / t))) / t_2); elseif (t_1 <= 0.0) tmp = Float64(fma(y, Float64(z / t), x) / t_2); elseif (t_1 <= 2e+307) tmp = t_1; elseif (t_1 <= Inf) tmp = Float64(y / Float64(Float64(t * Float64(Float64(a + 1.0) + Float64(b / Float64(t / y)))) / z)); else tmp = fma(t, Float64(Float64(Float64(x / b) / y) + Float64(Float64(z / (b ^ 2.0)) * Float64(Float64(-1.0 - a) / y))), 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[(N[(y * b), $MachinePrecision] / t), $MachinePrecision] + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a + N[(b * N[(y / t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-94], N[(N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 2e+307], t$95$1, If[LessEqual[t$95$1, Infinity], N[(y / N[(N[(t * N[(N[(a + 1.0), $MachinePrecision] + N[(b / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(N[(x / b), $MachinePrecision] / y), $MachinePrecision] + N[(N[(z / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(-1.0 - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z / b), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\frac{y \cdot b}{t} + \left(a + 1\right)}\\
t_2 := a + \mathsf{fma}\left(b, \frac{y}{t}, 1\right)\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-94}:\\
\;\;\;\;\frac{x + z \cdot \frac{y}{t}}{t_2}\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{t_2}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{y}{\frac{t \cdot \left(\left(a + 1\right) + \frac{b}{\frac{t}{y}}\right)}{z}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{\frac{x}{b}}{y} + \frac{z}{{b}^{2}} \cdot \frac{-1 - a}{y}, \frac{z}{b}\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -4.9999999999999995e-94Initial program 84.4%
+-commutative84.4%
associate-*r/81.5%
fma-def81.5%
associate-+l+81.5%
+-commutative81.5%
*-commutative81.5%
associate-*r/78.2%
fma-def78.2%
Simplified78.2%
fma-udef78.2%
clear-num78.2%
div-inv80.4%
associate-/r/87.3%
Applied egg-rr87.3%
if -4.9999999999999995e-94 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -0.0Initial program 74.3%
+-commutative74.3%
associate-*r/74.9%
fma-def74.9%
associate-+l+74.9%
+-commutative74.9%
*-commutative74.9%
associate-*r/87.3%
fma-def87.3%
Simplified87.3%
if -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 1.99999999999999997e307Initial program 99.8%
if 1.99999999999999997e307 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < +inf.0Initial program 21.8%
*-commutative21.8%
associate-*l/52.9%
associate-+l+52.9%
associate-*r/52.3%
*-commutative52.3%
Simplified52.3%
Taylor expanded in x around 0 60.4%
associate-/l*84.3%
associate-+r+84.3%
associate-/l*73.6%
Simplified73.6%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) Initial program 0.0%
*-commutative0.0%
associate-*l/0.2%
associate-+l+0.2%
associate-*r/8.0%
*-commutative8.0%
Simplified8.0%
Taylor expanded in t around 0 72.5%
fma-def72.5%
associate-/r*76.1%
times-frac100.0%
Simplified100.0%
Final simplification91.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (/ (* y b) t) (+ a 1.0))))
(t_2 (+ a (fma b (/ y t) 1.0))))
(if (<= t_1 -5e-94)
(/ (+ x (* z (/ y t))) t_2)
(if (<= t_1 0.0)
(/ (fma y (/ z t) x) t_2)
(if (<= t_1 2e+307) 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)) / (((y * b) / t) + (a + 1.0));
double t_2 = a + fma(b, (y / t), 1.0);
double tmp;
if (t_1 <= -5e-94) {
tmp = (x + (z * (y / t))) / t_2;
} else if (t_1 <= 0.0) {
tmp = fma(y, (z / t), x) / t_2;
} else if (t_1 <= 2e+307) {
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(Float64(y * b) / t) + Float64(a + 1.0))) t_2 = Float64(a + fma(b, Float64(y / t), 1.0)) tmp = 0.0 if (t_1 <= -5e-94) tmp = Float64(Float64(x + Float64(z * Float64(y / t))) / t_2); elseif (t_1 <= 0.0) tmp = Float64(fma(y, Float64(z / t), x) / t_2); elseif (t_1 <= 2e+307) 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[(N[(y * b), $MachinePrecision] / t), $MachinePrecision] + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a + N[(b * N[(y / t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-94], N[(N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 2e+307], t$95$1, N[(z / b), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\frac{y \cdot b}{t} + \left(a + 1\right)}\\
t_2 := a + \mathsf{fma}\left(b, \frac{y}{t}, 1\right)\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-94}:\\
\;\;\;\;\frac{x + z \cdot \frac{y}{t}}{t_2}\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \frac{z}{t}, x\right)}{t_2}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -4.9999999999999995e-94Initial program 84.4%
+-commutative84.4%
associate-*r/81.5%
fma-def81.5%
associate-+l+81.5%
+-commutative81.5%
*-commutative81.5%
associate-*r/78.2%
fma-def78.2%
Simplified78.2%
fma-udef78.2%
clear-num78.2%
div-inv80.4%
associate-/r/87.3%
Applied egg-rr87.3%
if -4.9999999999999995e-94 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -0.0Initial program 74.3%
+-commutative74.3%
associate-*r/74.9%
fma-def74.9%
associate-+l+74.9%
+-commutative74.9%
*-commutative74.9%
associate-*r/87.3%
fma-def87.3%
Simplified87.3%
if -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 1.99999999999999997e307Initial program 99.8%
if 1.99999999999999997e307 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) Initial program 7.1%
*-commutative7.1%
associate-*l/17.3%
associate-+l+17.3%
associate-*r/22.4%
*-commutative22.4%
Simplified22.4%
Taylor expanded in t around 0 82.1%
Final simplification90.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ x (/ (* y z) t)) (+ (/ (* y b) t) (+ a 1.0)))))
(if (<= t_1 -5e-94)
(/ (+ x (* z (/ y t))) (+ a (fma b (/ y t) 1.0)))
(if (<= t_1 0.0)
(/ (+ x (/ y (/ t z))) (+ a (+ 1.0 (/ b (/ t y)))))
(if (<= t_1 2e+307) 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)) / (((y * b) / t) + (a + 1.0));
double tmp;
if (t_1 <= -5e-94) {
tmp = (x + (z * (y / t))) / (a + fma(b, (y / t), 1.0));
} else if (t_1 <= 0.0) {
tmp = (x + (y / (t / z))) / (a + (1.0 + (b / (t / y))));
} else if (t_1 <= 2e+307) {
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(Float64(y * b) / t) + Float64(a + 1.0))) tmp = 0.0 if (t_1 <= -5e-94) tmp = Float64(Float64(x + Float64(z * Float64(y / t))) / Float64(a + fma(b, Float64(y / t), 1.0))); elseif (t_1 <= 0.0) tmp = Float64(Float64(x + Float64(y / Float64(t / z))) / Float64(a + Float64(1.0 + Float64(b / Float64(t / y))))); elseif (t_1 <= 2e+307) 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[(N[(y * b), $MachinePrecision] / t), $MachinePrecision] + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-94], N[(N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a + N[(b * N[(y / t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a + N[(1.0 + N[(b / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+307], t$95$1, N[(z / b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\frac{y \cdot b}{t} + \left(a + 1\right)}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-94}:\\
\;\;\;\;\frac{x + z \cdot \frac{y}{t}}{a + \mathsf{fma}\left(b, \frac{y}{t}, 1\right)}\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{x + \frac{y}{\frac{t}{z}}}{a + \left(1 + \frac{b}{\frac{t}{y}}\right)}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -4.9999999999999995e-94Initial program 84.4%
+-commutative84.4%
associate-*r/81.5%
fma-def81.5%
associate-+l+81.5%
+-commutative81.5%
*-commutative81.5%
associate-*r/78.2%
fma-def78.2%
Simplified78.2%
fma-udef78.2%
clear-num78.2%
div-inv80.4%
associate-/r/87.3%
Applied egg-rr87.3%
if -4.9999999999999995e-94 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -0.0Initial program 74.3%
associate-/l*74.9%
associate-*l/87.3%
*-commutative87.3%
cancel-sign-sub87.3%
*-commutative87.3%
associate-*l/74.9%
associate-+r-74.9%
associate-*l/87.3%
*-commutative87.3%
cancel-sign-sub87.3%
*-commutative87.3%
associate-*l/74.9%
*-commutative74.9%
associate-/l*87.2%
Simplified87.2%
if -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 1.99999999999999997e307Initial program 99.8%
if 1.99999999999999997e307 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) Initial program 7.1%
*-commutative7.1%
associate-*l/17.3%
associate-+l+17.3%
associate-*r/22.4%
*-commutative22.4%
Simplified22.4%
Taylor expanded in t around 0 82.1%
Final simplification90.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.1e-28) (not (<= t 1.65e-173))) (/ (+ x (* y (/ z t))) (+ a (+ 1.0 (* y (/ b t))))) (+ (/ z b) (/ (* x t) (* y b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.1e-28) || !(t <= 1.65e-173)) {
tmp = (x + (y * (z / t))) / (a + (1.0 + (y * (b / t))));
} else {
tmp = (z / b) + ((x * t) / (y * 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 ((t <= (-1.1d-28)) .or. (.not. (t <= 1.65d-173))) then
tmp = (x + (y * (z / t))) / (a + (1.0d0 + (y * (b / t))))
else
tmp = (z / b) + ((x * t) / (y * 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 ((t <= -1.1e-28) || !(t <= 1.65e-173)) {
tmp = (x + (y * (z / t))) / (a + (1.0 + (y * (b / t))));
} else {
tmp = (z / b) + ((x * t) / (y * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.1e-28) or not (t <= 1.65e-173): tmp = (x + (y * (z / t))) / (a + (1.0 + (y * (b / t)))) else: tmp = (z / b) + ((x * t) / (y * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.1e-28) || !(t <= 1.65e-173)) tmp = Float64(Float64(x + Float64(y * Float64(z / t))) / Float64(a + Float64(1.0 + Float64(y * Float64(b / t))))); else tmp = Float64(Float64(z / b) + Float64(Float64(x * t) / Float64(y * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.1e-28) || ~((t <= 1.65e-173))) tmp = (x + (y * (z / t))) / (a + (1.0 + (y * (b / t)))); else tmp = (z / b) + ((x * t) / (y * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.1e-28], N[Not[LessEqual[t, 1.65e-173]], $MachinePrecision]], N[(N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a + N[(1.0 + N[(y * N[(b / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / b), $MachinePrecision] + N[(N[(x * t), $MachinePrecision] / N[(y * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-28} \lor \neg \left(t \leq 1.65 \cdot 10^{-173}\right):\\
\;\;\;\;\frac{x + y \cdot \frac{z}{t}}{a + \left(1 + y \cdot \frac{b}{t}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b} + \frac{x \cdot t}{y \cdot b}\\
\end{array}
\end{array}
if t < -1.09999999999999998e-28 or 1.6500000000000001e-173 < t Initial program 83.0%
*-commutative83.0%
associate-*l/86.1%
associate-+l+86.1%
associate-*r/91.6%
*-commutative91.6%
Simplified91.6%
if -1.09999999999999998e-28 < t < 1.6500000000000001e-173Initial program 55.6%
*-commutative55.6%
associate-*l/49.7%
associate-+l+49.7%
associate-*r/41.1%
*-commutative41.1%
Simplified41.1%
Taylor expanded in b around inf 42.4%
Taylor expanded in t around 0 76.8%
Final simplification87.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.1e-28) (not (<= t 4.6e-172))) (/ (+ x (* y (/ z t))) (+ a (+ 1.0 (/ y (/ t b))))) (+ (/ z b) (/ (* x t) (* y b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.1e-28) || !(t <= 4.6e-172)) {
tmp = (x + (y * (z / t))) / (a + (1.0 + (y / (t / b))));
} else {
tmp = (z / b) + ((x * t) / (y * 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 ((t <= (-1.1d-28)) .or. (.not. (t <= 4.6d-172))) then
tmp = (x + (y * (z / t))) / (a + (1.0d0 + (y / (t / b))))
else
tmp = (z / b) + ((x * t) / (y * 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 ((t <= -1.1e-28) || !(t <= 4.6e-172)) {
tmp = (x + (y * (z / t))) / (a + (1.0 + (y / (t / b))));
} else {
tmp = (z / b) + ((x * t) / (y * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.1e-28) or not (t <= 4.6e-172): tmp = (x + (y * (z / t))) / (a + (1.0 + (y / (t / b)))) else: tmp = (z / b) + ((x * t) / (y * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.1e-28) || !(t <= 4.6e-172)) tmp = Float64(Float64(x + Float64(y * Float64(z / t))) / Float64(a + Float64(1.0 + Float64(y / Float64(t / b))))); else tmp = Float64(Float64(z / b) + Float64(Float64(x * t) / Float64(y * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.1e-28) || ~((t <= 4.6e-172))) tmp = (x + (y * (z / t))) / (a + (1.0 + (y / (t / b)))); else tmp = (z / b) + ((x * t) / (y * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.1e-28], N[Not[LessEqual[t, 4.6e-172]], $MachinePrecision]], N[(N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a + N[(1.0 + N[(y / N[(t / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / b), $MachinePrecision] + N[(N[(x * t), $MachinePrecision] / N[(y * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-28} \lor \neg \left(t \leq 4.6 \cdot 10^{-172}\right):\\
\;\;\;\;\frac{x + y \cdot \frac{z}{t}}{a + \left(1 + \frac{y}{\frac{t}{b}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b} + \frac{x \cdot t}{y \cdot b}\\
\end{array}
\end{array}
if t < -1.09999999999999998e-28 or 4.5999999999999999e-172 < t Initial program 83.0%
*-commutative83.0%
associate-*l/86.1%
associate-+l+86.1%
associate-*r/91.6%
*-commutative91.6%
Simplified91.6%
associate-*l/86.1%
*-commutative86.1%
associate-/l*92.1%
Applied egg-rr92.1%
if -1.09999999999999998e-28 < t < 4.5999999999999999e-172Initial program 55.6%
*-commutative55.6%
associate-*l/49.7%
associate-+l+49.7%
associate-*r/41.1%
*-commutative41.1%
Simplified41.1%
Taylor expanded in b around inf 42.4%
Taylor expanded in t around 0 76.8%
Final simplification87.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.3e-39) (not (<= y 3e+95))) (+ (/ z b) (/ (* x t) (* y b))) (/ x (+ a 1.0))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.3e-39) || !(y <= 3e+95)) {
tmp = (z / b) + ((x * t) / (y * b));
} else {
tmp = x / (a + 1.0);
}
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 <= (-2.3d-39)) .or. (.not. (y <= 3d+95))) then
tmp = (z / b) + ((x * t) / (y * b))
else
tmp = x / (a + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.3e-39) || !(y <= 3e+95)) {
tmp = (z / b) + ((x * t) / (y * b));
} else {
tmp = x / (a + 1.0);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.3e-39) or not (y <= 3e+95): tmp = (z / b) + ((x * t) / (y * b)) else: tmp = x / (a + 1.0) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.3e-39) || !(y <= 3e+95)) tmp = Float64(Float64(z / b) + Float64(Float64(x * t) / Float64(y * b))); else tmp = Float64(x / Float64(a + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -2.3e-39) || ~((y <= 3e+95))) tmp = (z / b) + ((x * t) / (y * b)); else tmp = x / (a + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.3e-39], N[Not[LessEqual[y, 3e+95]], $MachinePrecision]], N[(N[(z / b), $MachinePrecision] + N[(N[(x * t), $MachinePrecision] / N[(y * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(a + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{-39} \lor \neg \left(y \leq 3 \cdot 10^{+95}\right):\\
\;\;\;\;\frac{z}{b} + \frac{x \cdot t}{y \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a + 1}\\
\end{array}
\end{array}
if y < -2.30000000000000008e-39 or 2.99999999999999991e95 < y Initial program 56.5%
*-commutative56.5%
associate-*l/59.6%
associate-+l+59.6%
associate-*r/67.6%
*-commutative67.6%
Simplified67.6%
Taylor expanded in b around inf 30.2%
Taylor expanded in t around 0 57.5%
if -2.30000000000000008e-39 < y < 2.99999999999999991e95Initial program 93.5%
*-commutative93.5%
associate-*l/91.7%
associate-+l+91.7%
associate-*r/86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in t around inf 67.9%
Final simplification62.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.8e-7) (not (<= t 1.15e-171))) (/ x (+ a (+ 1.0 (* y (/ b t))))) (+ (/ z b) (/ (* x t) (* y b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.8e-7) || !(t <= 1.15e-171)) {
tmp = x / (a + (1.0 + (y * (b / t))));
} else {
tmp = (z / b) + ((x * t) / (y * 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 ((t <= (-1.8d-7)) .or. (.not. (t <= 1.15d-171))) then
tmp = x / (a + (1.0d0 + (y * (b / t))))
else
tmp = (z / b) + ((x * t) / (y * 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 ((t <= -1.8e-7) || !(t <= 1.15e-171)) {
tmp = x / (a + (1.0 + (y * (b / t))));
} else {
tmp = (z / b) + ((x * t) / (y * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.8e-7) or not (t <= 1.15e-171): tmp = x / (a + (1.0 + (y * (b / t)))) else: tmp = (z / b) + ((x * t) / (y * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.8e-7) || !(t <= 1.15e-171)) tmp = Float64(x / Float64(a + Float64(1.0 + Float64(y * Float64(b / t))))); else tmp = Float64(Float64(z / b) + Float64(Float64(x * t) / Float64(y * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.8e-7) || ~((t <= 1.15e-171))) tmp = x / (a + (1.0 + (y * (b / t)))); else tmp = (z / b) + ((x * t) / (y * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.8e-7], N[Not[LessEqual[t, 1.15e-171]], $MachinePrecision]], N[(x / N[(a + N[(1.0 + N[(y * N[(b / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / b), $MachinePrecision] + N[(N[(x * t), $MachinePrecision] / N[(y * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{-7} \lor \neg \left(t \leq 1.15 \cdot 10^{-171}\right):\\
\;\;\;\;\frac{x}{a + \left(1 + y \cdot \frac{b}{t}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b} + \frac{x \cdot t}{y \cdot b}\\
\end{array}
\end{array}
if t < -1.79999999999999997e-7 or 1.14999999999999989e-171 < t Initial program 83.1%
*-commutative83.1%
associate-*l/86.3%
associate-+l+86.3%
associate-*r/91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in x around inf 65.1%
if -1.79999999999999997e-7 < t < 1.14999999999999989e-171Initial program 57.3%
*-commutative57.3%
associate-*l/51.7%
associate-+l+51.7%
associate-*r/43.7%
*-commutative43.7%
Simplified43.7%
Taylor expanded in b around inf 42.3%
Taylor expanded in t around 0 75.7%
Final simplification68.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.2e-7) (not (<= t 4.7e-113))) (/ (+ x (/ (* y z) t)) (+ a 1.0)) (+ (/ z b) (/ (* x t) (* y b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.2e-7) || !(t <= 4.7e-113)) {
tmp = (x + ((y * z) / t)) / (a + 1.0);
} else {
tmp = (z / b) + ((x * t) / (y * 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 ((t <= (-1.2d-7)) .or. (.not. (t <= 4.7d-113))) then
tmp = (x + ((y * z) / t)) / (a + 1.0d0)
else
tmp = (z / b) + ((x * t) / (y * 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 ((t <= -1.2e-7) || !(t <= 4.7e-113)) {
tmp = (x + ((y * z) / t)) / (a + 1.0);
} else {
tmp = (z / b) + ((x * t) / (y * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.2e-7) or not (t <= 4.7e-113): tmp = (x + ((y * z) / t)) / (a + 1.0) else: tmp = (z / b) + ((x * t) / (y * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.2e-7) || !(t <= 4.7e-113)) tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(a + 1.0)); else tmp = Float64(Float64(z / b) + Float64(Float64(x * t) / Float64(y * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.2e-7) || ~((t <= 4.7e-113))) tmp = (x + ((y * z) / t)) / (a + 1.0); else tmp = (z / b) + ((x * t) / (y * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.2e-7], N[Not[LessEqual[t, 4.7e-113]], $MachinePrecision]], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(a + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(z / b), $MachinePrecision] + N[(N[(x * t), $MachinePrecision] / N[(y * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{-7} \lor \neg \left(t \leq 4.7 \cdot 10^{-113}\right):\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{a + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b} + \frac{x \cdot t}{y \cdot b}\\
\end{array}
\end{array}
if t < -1.19999999999999989e-7 or 4.7000000000000002e-113 < t Initial program 83.4%
*-commutative83.4%
associate-*l/86.9%
associate-+l+86.9%
associate-*r/93.0%
*-commutative93.0%
Simplified93.0%
Taylor expanded in b around 0 70.7%
if -1.19999999999999989e-7 < t < 4.7000000000000002e-113Initial program 60.3%
*-commutative60.3%
associate-*l/55.5%
associate-+l+55.5%
associate-*r/48.7%
*-commutative48.7%
Simplified48.7%
Taylor expanded in b around inf 41.6%
Taylor expanded in t around 0 72.4%
Final simplification71.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -6.2e-9)
(/ x (+ a (+ 1.0 (* y (/ b t)))))
(if (<= t 1.15e-171)
(+ (/ z b) (/ (* x t) (* y b)))
(/ x (+ (+ a 1.0) (* b (/ y t)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -6.2e-9) {
tmp = x / (a + (1.0 + (y * (b / t))));
} else if (t <= 1.15e-171) {
tmp = (z / b) + ((x * t) / (y * b));
} else {
tmp = x / ((a + 1.0) + (b * (y / t)));
}
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 (t <= (-6.2d-9)) then
tmp = x / (a + (1.0d0 + (y * (b / t))))
else if (t <= 1.15d-171) then
tmp = (z / b) + ((x * t) / (y * b))
else
tmp = x / ((a + 1.0d0) + (b * (y / t)))
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 (t <= -6.2e-9) {
tmp = x / (a + (1.0 + (y * (b / t))));
} else if (t <= 1.15e-171) {
tmp = (z / b) + ((x * t) / (y * b));
} else {
tmp = x / ((a + 1.0) + (b * (y / t)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -6.2e-9: tmp = x / (a + (1.0 + (y * (b / t)))) elif t <= 1.15e-171: tmp = (z / b) + ((x * t) / (y * b)) else: tmp = x / ((a + 1.0) + (b * (y / t))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -6.2e-9) tmp = Float64(x / Float64(a + Float64(1.0 + Float64(y * Float64(b / t))))); elseif (t <= 1.15e-171) tmp = Float64(Float64(z / b) + Float64(Float64(x * t) / Float64(y * b))); else tmp = Float64(x / Float64(Float64(a + 1.0) + Float64(b * Float64(y / t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -6.2e-9) tmp = x / (a + (1.0 + (y * (b / t)))); elseif (t <= 1.15e-171) tmp = (z / b) + ((x * t) / (y * b)); else tmp = x / ((a + 1.0) + (b * (y / t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -6.2e-9], N[(x / N[(a + N[(1.0 + N[(y * N[(b / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.15e-171], N[(N[(z / b), $MachinePrecision] + N[(N[(x * t), $MachinePrecision] / N[(y * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(a + 1.0), $MachinePrecision] + N[(b * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{a + \left(1 + y \cdot \frac{b}{t}\right)}\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-171}:\\
\;\;\;\;\frac{z}{b} + \frac{x \cdot t}{y \cdot b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(a + 1\right) + b \cdot \frac{y}{t}}\\
\end{array}
\end{array}
if t < -6.2000000000000001e-9Initial program 79.0%
*-commutative79.0%
associate-*l/85.4%
associate-+l+85.4%
associate-*r/93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in x around inf 66.3%
if -6.2000000000000001e-9 < t < 1.14999999999999989e-171Initial program 57.3%
*-commutative57.3%
associate-*l/51.7%
associate-+l+51.7%
associate-*r/43.7%
*-commutative43.7%
Simplified43.7%
Taylor expanded in b around inf 42.3%
Taylor expanded in t around 0 75.7%
if 1.14999999999999989e-171 < t Initial program 85.9%
*-commutative85.9%
associate-*l/86.9%
associate-+l+86.9%
associate-*r/90.8%
*-commutative90.8%
Simplified90.8%
associate-*l/86.9%
*-commutative86.9%
associate-/l*91.7%
Applied egg-rr91.7%
Taylor expanded in x around inf 65.2%
associate-+r+65.2%
associate-*r/65.3%
Simplified65.3%
Final simplification68.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -6.8e+14) (not (<= y 2.2e+96))) (/ z b) (/ x (+ a 1.0))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -6.8e+14) || !(y <= 2.2e+96)) {
tmp = z / b;
} else {
tmp = x / (a + 1.0);
}
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 <= (-6.8d+14)) .or. (.not. (y <= 2.2d+96))) then
tmp = z / b
else
tmp = x / (a + 1.0d0)
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 <= -6.8e+14) || !(y <= 2.2e+96)) {
tmp = z / b;
} else {
tmp = x / (a + 1.0);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -6.8e+14) or not (y <= 2.2e+96): tmp = z / b else: tmp = x / (a + 1.0) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -6.8e+14) || !(y <= 2.2e+96)) tmp = Float64(z / b); else tmp = Float64(x / Float64(a + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -6.8e+14) || ~((y <= 2.2e+96))) tmp = z / b; else tmp = x / (a + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -6.8e+14], N[Not[LessEqual[y, 2.2e+96]], $MachinePrecision]], N[(z / b), $MachinePrecision], N[(x / N[(a + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+14} \lor \neg \left(y \leq 2.2 \cdot 10^{+96}\right):\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a + 1}\\
\end{array}
\end{array}
if y < -6.8e14 or 2.1999999999999999e96 < y Initial program 51.9%
*-commutative51.9%
associate-*l/56.2%
associate-+l+56.2%
associate-*r/66.0%
*-commutative66.0%
Simplified66.0%
Taylor expanded in t around 0 58.5%
if -6.8e14 < y < 2.1999999999999999e96Initial program 93.5%
*-commutative93.5%
associate-*l/91.2%
associate-+l+91.2%
associate-*r/86.3%
*-commutative86.3%
Simplified86.3%
Taylor expanded in t around inf 65.0%
Final simplification62.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -0.48) (not (<= a 2.4e+16))) (/ x a) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -0.48) || !(a <= 2.4e+16)) {
tmp = x / a;
} else {
tmp = x;
}
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 <= (-0.48d0)) .or. (.not. (a <= 2.4d+16))) then
tmp = x / a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -0.48) || !(a <= 2.4e+16)) {
tmp = x / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -0.48) or not (a <= 2.4e+16): tmp = x / a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -0.48) || !(a <= 2.4e+16)) tmp = Float64(x / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -0.48) || ~((a <= 2.4e+16))) tmp = x / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -0.48], N[Not[LessEqual[a, 2.4e+16]], $MachinePrecision]], N[(x / a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.48 \lor \neg \left(a \leq 2.4 \cdot 10^{+16}\right):\\
\;\;\;\;\frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -0.47999999999999998 or 2.4e16 < a Initial program 77.5%
*-commutative77.5%
associate-*l/76.4%
associate-+l+76.4%
associate-*r/78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in t around inf 56.1%
Taylor expanded in a around inf 55.7%
if -0.47999999999999998 < a < 2.4e16Initial program 73.0%
*-commutative73.0%
associate-*l/75.3%
associate-+l+75.3%
associate-*r/76.8%
*-commutative76.8%
Simplified76.8%
Taylor expanded in t around inf 33.7%
Taylor expanded in a around 0 33.7%
Final simplification44.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.3e-40) (not (<= y 2.6e+92))) (/ z b) (/ x a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4.3e-40) || !(y <= 2.6e+92)) {
tmp = z / b;
} else {
tmp = 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 ((y <= (-4.3d-40)) .or. (.not. (y <= 2.6d+92))) 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 ((y <= -4.3e-40) || !(y <= 2.6e+92)) {
tmp = z / b;
} else {
tmp = x / a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4.3e-40) or not (y <= 2.6e+92): tmp = z / b else: tmp = x / a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -4.3e-40) || !(y <= 2.6e+92)) 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 ((y <= -4.3e-40) || ~((y <= 2.6e+92))) tmp = z / b; else tmp = x / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -4.3e-40], N[Not[LessEqual[y, 2.6e+92]], $MachinePrecision]], N[(z / b), $MachinePrecision], N[(x / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.3 \cdot 10^{-40} \lor \neg \left(y \leq 2.6 \cdot 10^{+92}\right):\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a}\\
\end{array}
\end{array}
if y < -4.3000000000000003e-40 or 2.5999999999999999e92 < y Initial program 56.5%
*-commutative56.5%
associate-*l/59.6%
associate-+l+59.6%
associate-*r/67.6%
*-commutative67.6%
Simplified67.6%
Taylor expanded in t around 0 54.8%
if -4.3000000000000003e-40 < y < 2.5999999999999999e92Initial program 93.5%
*-commutative93.5%
associate-*l/91.7%
associate-+l+91.7%
associate-*r/86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in t around inf 67.9%
Taylor expanded in a around inf 44.9%
Final simplification49.8%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 75.3%
*-commutative75.3%
associate-*l/75.9%
associate-+l+75.9%
associate-*r/77.4%
*-commutative77.4%
Simplified77.4%
Taylor expanded in t around inf 45.1%
Taylor expanded in a around 0 18.4%
Final simplification18.4%
(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 2023311
(FPCore (x y z t a b)
:name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
:herbie-target
(if (< t -1.3659085366310088e-271) (* 1.0 (* (+ x (* (/ y t) z)) (/ 1.0 (+ (+ a 1.0) (* (/ y t) b))))) (if (< t 3.036967103737246e-130) (/ z b) (* 1.0 (* (+ x (* (/ y t) z)) (/ 1.0 (+ (+ a 1.0) (* (/ y t) b)))))))
(/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))