
(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 10 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)))))
(if (<= t_1 (- INFINITY))
(* (/ y t) (/ z (+ 1.0 (+ a (/ y (/ t b))))))
(if (<= t_1 2e+301) t_1 (/ z b)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + ((y * z) / t)) / (((y * b) / t) + (a + 1.0));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (y / t) * (z / (1.0 + (a + (y / (t / b)))));
} else if (t_1 <= 2e+301) {
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 tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (y / t) * (z / (1.0 + (a + (y / (t / b)))));
} else if (t_1 <= 2e+301) {
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)) tmp = 0 if t_1 <= -math.inf: tmp = (y / t) * (z / (1.0 + (a + (y / (t / b))))) elif t_1 <= 2e+301: tmp = t_1 else: tmp = z / b return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(Float64(y * b) / t) + Float64(a + 1.0))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(y / t) * Float64(z / Float64(1.0 + Float64(a + Float64(y / Float64(t / b)))))); elseif (t_1 <= 2e+301) 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)); tmp = 0.0; if (t_1 <= -Inf) tmp = (y / t) * (z / (1.0 + (a + (y / (t / b))))); elseif (t_1 <= 2e+301) 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]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y / t), $MachinePrecision] * N[(z / N[(1.0 + N[(a + N[(y / N[(t / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+301], t$95$1, N[(z / b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z}{t}}{\frac{y \cdot b}{t} + \left(a + 1\right)}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{y}{t} \cdot \frac{z}{1 + \left(a + \frac{y}{\frac{t}{b}}\right)}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+301}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -inf.0Initial program 31.7%
*-commutative31.7%
associate-/l*52.1%
associate-*l/45.0%
Simplified45.0%
Taylor expanded in z around 0 24.6%
associate-*l/45.1%
*-commutative45.1%
Simplified45.1%
Taylor expanded in x around 0 44.8%
times-frac96.7%
associate-*l/89.5%
+-commutative89.5%
associate-*l/96.7%
associate-/l*96.7%
Simplified96.7%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 2.00000000000000011e301Initial program 93.6%
if 2.00000000000000011e301 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) Initial program 11.3%
*-commutative11.3%
associate-/l*18.4%
associate-*l/18.0%
Simplified18.0%
Taylor expanded in t around 0 84.0%
Final simplification92.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.1e+86) (not (<= y 1.02e+145))) (/ (+ z (/ t (/ y x))) b) (/ (+ x (* z (/ y t))) (+ (* b (/ y t)) (+ a 1.0)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.1e+86) || !(y <= 1.02e+145)) {
tmp = (z + (t / (y / x))) / b;
} else {
tmp = (x + (z * (y / t))) / ((b * (y / t)) + (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 <= (-1.1d+86)) .or. (.not. (y <= 1.02d+145))) then
tmp = (z + (t / (y / x))) / b
else
tmp = (x + (z * (y / t))) / ((b * (y / t)) + (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 <= -1.1e+86) || !(y <= 1.02e+145)) {
tmp = (z + (t / (y / x))) / b;
} else {
tmp = (x + (z * (y / t))) / ((b * (y / t)) + (a + 1.0));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.1e+86) or not (y <= 1.02e+145): tmp = (z + (t / (y / x))) / b else: tmp = (x + (z * (y / t))) / ((b * (y / t)) + (a + 1.0)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.1e+86) || !(y <= 1.02e+145)) tmp = Float64(Float64(z + Float64(t / Float64(y / x))) / b); else tmp = Float64(Float64(x + Float64(z * Float64(y / t))) / Float64(Float64(b * Float64(y / t)) + Float64(a + 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.1e+86) || ~((y <= 1.02e+145))) tmp = (z + (t / (y / x))) / b; else tmp = (x + (z * (y / t))) / ((b * (y / t)) + (a + 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.1e+86], N[Not[LessEqual[y, 1.02e+145]], $MachinePrecision]], N[(N[(z + N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], N[(N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(b * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[(a + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+86} \lor \neg \left(y \leq 1.02 \cdot 10^{+145}\right):\\
\;\;\;\;\frac{z + \frac{t}{\frac{y}{x}}}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + z \cdot \frac{y}{t}}{b \cdot \frac{y}{t} + \left(a + 1\right)}\\
\end{array}
\end{array}
if y < -1.10000000000000002e86 or 1.02e145 < y Initial program 46.2%
*-commutative46.2%
associate-/l*45.5%
associate-*l/45.8%
Simplified45.8%
Taylor expanded in y around inf 50.4%
associate--l+50.4%
times-frac54.1%
associate-*r*56.7%
unpow256.7%
Simplified56.7%
Taylor expanded in b around inf 70.0%
+-commutative70.0%
associate-/l*71.3%
Simplified71.3%
if -1.10000000000000002e86 < y < 1.02e145Initial program 90.0%
*-commutative90.0%
associate-/l*89.6%
associate-*l/90.6%
Simplified90.6%
Taylor expanded in z around 0 90.1%
associate-*l/90.7%
*-commutative90.7%
Simplified90.7%
Final simplification84.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2.4e-66) (not (<= t 2.25e-8))) (/ (+ x (* z (/ y t))) (+ a 1.0)) (/ (+ z (/ t (/ y x))) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2.4e-66) || !(t <= 2.25e-8)) {
tmp = (x + (z * (y / t))) / (a + 1.0);
} else {
tmp = (z + (t / (y / x))) / 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 <= (-2.4d-66)) .or. (.not. (t <= 2.25d-8))) then
tmp = (x + (z * (y / t))) / (a + 1.0d0)
else
tmp = (z + (t / (y / x))) / 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 <= -2.4e-66) || !(t <= 2.25e-8)) {
tmp = (x + (z * (y / t))) / (a + 1.0);
} else {
tmp = (z + (t / (y / x))) / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -2.4e-66) or not (t <= 2.25e-8): tmp = (x + (z * (y / t))) / (a + 1.0) else: tmp = (z + (t / (y / x))) / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -2.4e-66) || !(t <= 2.25e-8)) tmp = Float64(Float64(x + Float64(z * Float64(y / t))) / Float64(a + 1.0)); else tmp = Float64(Float64(z + Float64(t / Float64(y / x))) / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -2.4e-66) || ~((t <= 2.25e-8))) tmp = (x + (z * (y / t))) / (a + 1.0); else tmp = (z + (t / (y / x))) / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2.4e-66], N[Not[LessEqual[t, 2.25e-8]], $MachinePrecision]], N[(N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(z + N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{-66} \lor \neg \left(t \leq 2.25 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{x + z \cdot \frac{y}{t}}{a + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{z + \frac{t}{\frac{y}{x}}}{b}\\
\end{array}
\end{array}
if t < -2.40000000000000026e-66 or 2.24999999999999996e-8 < t Initial program 82.7%
*-commutative82.7%
associate-/l*85.9%
associate-*l/89.8%
Simplified89.8%
Taylor expanded in z around 0 85.3%
associate-*l/89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in y around 0 83.4%
if -2.40000000000000026e-66 < t < 2.24999999999999996e-8Initial program 68.1%
*-commutative68.1%
associate-/l*62.0%
associate-*l/58.5%
Simplified58.5%
Taylor expanded in y around inf 63.3%
associate--l+63.3%
times-frac63.3%
associate-*r*65.2%
unpow265.2%
Simplified65.2%
Taylor expanded in b around inf 74.3%
+-commutative74.3%
associate-/l*73.4%
Simplified73.4%
Final simplification79.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -7.2e-65)
(/ (+ x (* z (/ y t))) (+ a 1.0))
(if (<= t 2.4e-8)
(/ (+ z (/ t (/ y x))) b)
(/ (+ x (/ z (/ t y))) (+ a 1.0)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -7.2e-65) {
tmp = (x + (z * (y / t))) / (a + 1.0);
} else if (t <= 2.4e-8) {
tmp = (z + (t / (y / x))) / b;
} else {
tmp = (x + (z / (t / y))) / (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 (t <= (-7.2d-65)) then
tmp = (x + (z * (y / t))) / (a + 1.0d0)
else if (t <= 2.4d-8) then
tmp = (z + (t / (y / x))) / b
else
tmp = (x + (z / (t / y))) / (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 (t <= -7.2e-65) {
tmp = (x + (z * (y / t))) / (a + 1.0);
} else if (t <= 2.4e-8) {
tmp = (z + (t / (y / x))) / b;
} else {
tmp = (x + (z / (t / y))) / (a + 1.0);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -7.2e-65: tmp = (x + (z * (y / t))) / (a + 1.0) elif t <= 2.4e-8: tmp = (z + (t / (y / x))) / b else: tmp = (x + (z / (t / y))) / (a + 1.0) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -7.2e-65) tmp = Float64(Float64(x + Float64(z * Float64(y / t))) / Float64(a + 1.0)); elseif (t <= 2.4e-8) tmp = Float64(Float64(z + Float64(t / Float64(y / x))) / b); else tmp = Float64(Float64(x + Float64(z / Float64(t / y))) / Float64(a + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -7.2e-65) tmp = (x + (z * (y / t))) / (a + 1.0); elseif (t <= 2.4e-8) tmp = (z + (t / (y / x))) / b; else tmp = (x + (z / (t / y))) / (a + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -7.2e-65], N[(N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.4e-8], N[(N[(z + N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], N[(N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \cdot 10^{-65}:\\
\;\;\;\;\frac{x + z \cdot \frac{y}{t}}{a + 1}\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{-8}:\\
\;\;\;\;\frac{z + \frac{t}{\frac{y}{x}}}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{z}{\frac{t}{y}}}{a + 1}\\
\end{array}
\end{array}
if t < -7.1999999999999996e-65Initial program 86.4%
*-commutative86.4%
associate-/l*87.5%
associate-*l/90.9%
Simplified90.9%
Taylor expanded in z around 0 88.7%
associate-*l/90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in y around 0 84.4%
if -7.1999999999999996e-65 < t < 2.39999999999999998e-8Initial program 68.1%
*-commutative68.1%
associate-/l*62.0%
associate-*l/58.5%
Simplified58.5%
Taylor expanded in y around inf 63.3%
associate--l+63.3%
times-frac63.3%
associate-*r*65.2%
unpow265.2%
Simplified65.2%
Taylor expanded in b around inf 74.3%
+-commutative74.3%
associate-/l*73.4%
Simplified73.4%
if 2.39999999999999998e-8 < t Initial program 77.7%
*-commutative77.7%
associate-/l*83.8%
associate-*l/88.3%
Simplified88.3%
Taylor expanded in y around 0 82.0%
Final simplification79.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -3.35e-77) (not (<= t 1.16e+23))) (/ x (+ a 1.0)) (/ (+ z (/ t (/ y x))) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -3.35e-77) || !(t <= 1.16e+23)) {
tmp = x / (a + 1.0);
} else {
tmp = (z + (t / (y / x))) / 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 <= (-3.35d-77)) .or. (.not. (t <= 1.16d+23))) then
tmp = x / (a + 1.0d0)
else
tmp = (z + (t / (y / x))) / 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 <= -3.35e-77) || !(t <= 1.16e+23)) {
tmp = x / (a + 1.0);
} else {
tmp = (z + (t / (y / x))) / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -3.35e-77) or not (t <= 1.16e+23): tmp = x / (a + 1.0) else: tmp = (z + (t / (y / x))) / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -3.35e-77) || !(t <= 1.16e+23)) tmp = Float64(x / Float64(a + 1.0)); else tmp = Float64(Float64(z + Float64(t / Float64(y / x))) / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -3.35e-77) || ~((t <= 1.16e+23))) tmp = x / (a + 1.0); else tmp = (z + (t / (y / x))) / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -3.35e-77], N[Not[LessEqual[t, 1.16e+23]], $MachinePrecision]], N[(x / N[(a + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(z + N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.35 \cdot 10^{-77} \lor \neg \left(t \leq 1.16 \cdot 10^{+23}\right):\\
\;\;\;\;\frac{x}{a + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{z + \frac{t}{\frac{y}{x}}}{b}\\
\end{array}
\end{array}
if t < -3.3499999999999999e-77 or 1.16e23 < t Initial program 83.9%
*-commutative83.9%
associate-/l*86.6%
associate-*l/90.6%
Simplified90.6%
Taylor expanded in t around inf 68.4%
if -3.3499999999999999e-77 < t < 1.16e23Initial program 67.3%
*-commutative67.3%
associate-/l*62.4%
associate-*l/59.1%
Simplified59.1%
Taylor expanded in y around inf 60.0%
associate--l+60.0%
times-frac60.9%
associate-*r*62.7%
unpow262.7%
Simplified62.7%
Taylor expanded in b around inf 72.3%
+-commutative72.3%
associate-/l*71.4%
Simplified71.4%
Final simplification69.7%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.35e-77) (/ x (+ 1.0 (+ a (/ (* y b) t)))) (if (<= t 6.6e+25) (/ (+ z (/ t (/ y x))) b) (/ x (+ a 1.0)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.35e-77) {
tmp = x / (1.0 + (a + ((y * b) / t)));
} else if (t <= 6.6e+25) {
tmp = (z + (t / (y / x))) / 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 (t <= (-1.35d-77)) then
tmp = x / (1.0d0 + (a + ((y * b) / t)))
else if (t <= 6.6d+25) then
tmp = (z + (t / (y / x))) / 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 (t <= -1.35e-77) {
tmp = x / (1.0 + (a + ((y * b) / t)));
} else if (t <= 6.6e+25) {
tmp = (z + (t / (y / x))) / b;
} else {
tmp = x / (a + 1.0);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.35e-77: tmp = x / (1.0 + (a + ((y * b) / t))) elif t <= 6.6e+25: tmp = (z + (t / (y / x))) / b else: tmp = x / (a + 1.0) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.35e-77) tmp = Float64(x / Float64(1.0 + Float64(a + Float64(Float64(y * b) / t)))); elseif (t <= 6.6e+25) tmp = Float64(Float64(z + Float64(t / Float64(y / x))) / 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 (t <= -1.35e-77) tmp = x / (1.0 + (a + ((y * b) / t))); elseif (t <= 6.6e+25) tmp = (z + (t / (y / x))) / b; else tmp = x / (a + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.35e-77], N[(x / N[(1.0 + N[(a + N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.6e+25], N[(N[(z + N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], N[(x / N[(a + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{-77}:\\
\;\;\;\;\frac{x}{1 + \left(a + \frac{y \cdot b}{t}\right)}\\
\mathbf{elif}\;t \leq 6.6 \cdot 10^{+25}:\\
\;\;\;\;\frac{z + \frac{t}{\frac{y}{x}}}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a + 1}\\
\end{array}
\end{array}
if t < -1.35e-77Initial program 86.9%
*-commutative86.9%
associate-/l*86.8%
associate-*l/90.1%
Simplified90.1%
Taylor expanded in x around inf 71.2%
if -1.35e-77 < t < 6.6000000000000002e25Initial program 67.3%
*-commutative67.3%
associate-/l*62.4%
associate-*l/59.1%
Simplified59.1%
Taylor expanded in y around inf 60.0%
associate--l+60.0%
times-frac60.9%
associate-*r*62.7%
unpow262.7%
Simplified62.7%
Taylor expanded in b around inf 72.3%
+-commutative72.3%
associate-/l*71.4%
Simplified71.4%
if 6.6000000000000002e25 < t Initial program 79.2%
*-commutative79.2%
associate-/l*86.2%
associate-*l/91.4%
Simplified91.4%
Taylor expanded in t around inf 70.6%
Final simplification71.2%
(FPCore (x y z t a b) :precision binary64 (if (<= t -2.3e-64) (/ x a) (if (<= t 9.5e+94) (/ z b) (if (<= t 1.55e+141) (/ x a) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.3e-64) {
tmp = x / a;
} else if (t <= 9.5e+94) {
tmp = z / b;
} else if (t <= 1.55e+141) {
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 (t <= (-2.3d-64)) then
tmp = x / a
else if (t <= 9.5d+94) then
tmp = z / b
else if (t <= 1.55d+141) 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 (t <= -2.3e-64) {
tmp = x / a;
} else if (t <= 9.5e+94) {
tmp = z / b;
} else if (t <= 1.55e+141) {
tmp = x / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -2.3e-64: tmp = x / a elif t <= 9.5e+94: tmp = z / b elif t <= 1.55e+141: tmp = x / a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.3e-64) tmp = Float64(x / a); elseif (t <= 9.5e+94) tmp = Float64(z / b); elseif (t <= 1.55e+141) 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 (t <= -2.3e-64) tmp = x / a; elseif (t <= 9.5e+94) tmp = z / b; elseif (t <= 1.55e+141) tmp = x / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.3e-64], N[(x / a), $MachinePrecision], If[LessEqual[t, 9.5e+94], N[(z / b), $MachinePrecision], If[LessEqual[t, 1.55e+141], N[(x / a), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{-64}:\\
\;\;\;\;\frac{x}{a}\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{+94}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{+141}:\\
\;\;\;\;\frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.3000000000000001e-64 or 9.4999999999999998e94 < t < 1.55000000000000002e141Initial program 85.8%
*-commutative85.8%
associate-/l*87.9%
associate-*l/90.9%
Simplified90.9%
Taylor expanded in x around inf 70.3%
Taylor expanded in a around inf 47.1%
if -2.3000000000000001e-64 < t < 9.4999999999999998e94Initial program 68.3%
*-commutative68.3%
associate-/l*63.5%
associate-*l/61.4%
Simplified61.4%
Taylor expanded in t around 0 58.7%
if 1.55000000000000002e141 < t Initial program 83.7%
*-commutative83.7%
associate-/l*93.4%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in t around inf 77.8%
Taylor expanded in a around 0 54.6%
Final simplification53.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.8e-66) (not (<= t 1.2e+15))) (/ x (+ a 1.0)) (/ z b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.8e-66) || !(t <= 1.2e+15)) {
tmp = x / (a + 1.0);
} 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 ((t <= (-1.8d-66)) .or. (.not. (t <= 1.2d+15))) then
tmp = x / (a + 1.0d0)
else
tmp = z / b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.8e-66) || !(t <= 1.2e+15)) {
tmp = x / (a + 1.0);
} else {
tmp = z / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.8e-66) or not (t <= 1.2e+15): tmp = x / (a + 1.0) else: tmp = z / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.8e-66) || !(t <= 1.2e+15)) tmp = Float64(x / Float64(a + 1.0)); else tmp = Float64(z / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.8e-66) || ~((t <= 1.2e+15))) tmp = x / (a + 1.0); else tmp = z / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.8e-66], N[Not[LessEqual[t, 1.2e+15]], $MachinePrecision]], N[(x / N[(a + 1.0), $MachinePrecision]), $MachinePrecision], N[(z / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{-66} \lor \neg \left(t \leq 1.2 \cdot 10^{+15}\right):\\
\;\;\;\;\frac{x}{a + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\
\end{array}
\end{array}
if t < -1.80000000000000006e-66 or 1.2e15 < t Initial program 83.6%
*-commutative83.6%
associate-/l*87.0%
associate-*l/91.1%
Simplified91.1%
Taylor expanded in t around inf 68.4%
if -1.80000000000000006e-66 < t < 1.2e15Initial program 68.1%
*-commutative68.1%
associate-/l*62.5%
associate-*l/59.3%
Simplified59.3%
Taylor expanded in t around 0 62.2%
Final simplification65.6%
(FPCore (x y z t a b) :precision binary64 (if (<= a -1.0) (/ x a) (if (<= a 1.0) x (/ x a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -1.0) {
tmp = x / a;
} else if (a <= 1.0) {
tmp = x;
} 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 (a <= (-1.0d0)) then
tmp = x / a
else if (a <= 1.0d0) then
tmp = x
else
tmp = x / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -1.0) {
tmp = x / a;
} else if (a <= 1.0) {
tmp = x;
} else {
tmp = x / a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -1.0: tmp = x / a elif a <= 1.0: tmp = x else: tmp = x / a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -1.0) tmp = Float64(x / a); elseif (a <= 1.0) tmp = x; else tmp = Float64(x / a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -1.0) tmp = x / a; elseif (a <= 1.0) tmp = x; else tmp = x / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1.0], N[(x / a), $MachinePrecision], If[LessEqual[a, 1.0], x, N[(x / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1:\\
\;\;\;\;\frac{x}{a}\\
\mathbf{elif}\;a \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a}\\
\end{array}
\end{array}
if a < -1 or 1 < a Initial program 74.3%
*-commutative74.3%
associate-/l*75.8%
associate-*l/77.2%
Simplified77.2%
Taylor expanded in x around inf 58.2%
Taylor expanded in a around inf 51.6%
if -1 < a < 1Initial program 79.3%
*-commutative79.3%
associate-/l*76.4%
associate-*l/76.7%
Simplified76.7%
Taylor expanded in t around inf 41.9%
Taylor expanded in a around 0 41.2%
Final simplification46.6%
(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 76.7%
*-commutative76.7%
associate-/l*76.1%
associate-*l/77.0%
Simplified77.0%
Taylor expanded in t around inf 46.9%
Taylor expanded in a around 0 21.9%
Final simplification21.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 2023185
(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))))