
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
real(8) function code(x, y, z, t, a)
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
code = (x - (y * z)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
real(8) function code(x, y, z, t, a)
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
code = (x - (y * z)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* z a))) (t_2 (/ (- x (* y z)) t_1)))
(if (<= t_2 (- INFINITY))
(* y (+ (/ z (- (* z a) t)) (/ x (* y t_1))))
(if (<= t_2 -1e-313)
t_2
(if (<= t_2 0.0)
(/ -1.0 (* z (/ (- (/ t z) a) (- (* y z) x))))
(if (<= t_2 2e+297) t_2 (/ y (- a (/ t z)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double t_2 = (x - (y * z)) / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = y * ((z / ((z * a) - t)) + (x / (y * t_1)));
} else if (t_2 <= -1e-313) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x)));
} else if (t_2 <= 2e+297) {
tmp = t_2;
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double t_2 = (x - (y * z)) / t_1;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = y * ((z / ((z * a) - t)) + (x / (y * t_1)));
} else if (t_2 <= -1e-313) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x)));
} else if (t_2 <= 2e+297) {
tmp = t_2;
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (z * a) t_2 = (x - (y * z)) / t_1 tmp = 0 if t_2 <= -math.inf: tmp = y * ((z / ((z * a) - t)) + (x / (y * t_1))) elif t_2 <= -1e-313: tmp = t_2 elif t_2 <= 0.0: tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x))) elif t_2 <= 2e+297: tmp = t_2 else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(z * a)) t_2 = Float64(Float64(x - Float64(y * z)) / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(y * Float64(Float64(z / Float64(Float64(z * a) - t)) + Float64(x / Float64(y * t_1)))); elseif (t_2 <= -1e-313) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(-1.0 / Float64(z * Float64(Float64(Float64(t / z) - a) / Float64(Float64(y * z) - x)))); elseif (t_2 <= 2e+297) tmp = t_2; else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (z * a); t_2 = (x - (y * z)) / t_1; tmp = 0.0; if (t_2 <= -Inf) tmp = y * ((z / ((z * a) - t)) + (x / (y * t_1))); elseif (t_2 <= -1e-313) tmp = t_2; elseif (t_2 <= 0.0) tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x))); elseif (t_2 <= 2e+297) tmp = t_2; else tmp = y / (a - (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(y * N[(N[(z / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(x / N[(y * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e-313], t$95$2, If[LessEqual[t$95$2, 0.0], N[(-1.0 / N[(z * N[(N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+297], t$95$2, N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - z \cdot a\\
t_2 := \frac{x - y \cdot z}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;y \cdot \left(\frac{z}{z \cdot a - t} + \frac{x}{y \cdot t\_1}\right)\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-313}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{-1}{z \cdot \frac{\frac{t}{z} - a}{y \cdot z - x}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+297}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0Initial program 55.7%
*-commutative55.7%
Simplified55.7%
Taylor expanded in y around inf 99.8%
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -1.00000000001e-313 or -0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 2e297Initial program 99.7%
if -1.00000000001e-313 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -0.0Initial program 53.8%
*-commutative53.8%
Simplified53.8%
Taylor expanded in z around inf 53.8%
clear-num53.8%
inv-pow53.8%
Applied egg-rr53.8%
unpow-153.8%
associate-/l*99.1%
*-commutative99.1%
Simplified99.1%
if 2e297 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 27.1%
*-commutative27.1%
Simplified27.1%
Taylor expanded in z around inf 27.1%
Taylor expanded in x around 0 95.2%
associate-*r/95.2%
mul-1-neg95.2%
Simplified95.2%
Final simplification99.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* y z)) (- t (* z a)))))
(if (<= t_1 -1e-313)
t_1
(if (<= t_1 0.0)
(/ -1.0 (* z (/ (- (/ t z) a) (- (* y z) x))))
(if (<= t_1 2e+297) t_1 (/ y (- a (/ t z))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_1 <= -1e-313) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x)));
} else if (t_1 <= 2e+297) {
tmp = t_1;
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: t_1
real(8) :: tmp
t_1 = (x - (y * z)) / (t - (z * a))
if (t_1 <= (-1d-313)) then
tmp = t_1
else if (t_1 <= 0.0d0) then
tmp = (-1.0d0) / (z * (((t / z) - a) / ((y * z) - x)))
else if (t_1 <= 2d+297) then
tmp = t_1
else
tmp = y / (a - (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_1 <= -1e-313) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x)));
} else if (t_1 <= 2e+297) {
tmp = t_1;
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (y * z)) / (t - (z * a)) tmp = 0 if t_1 <= -1e-313: tmp = t_1 elif t_1 <= 0.0: tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x))) elif t_1 <= 2e+297: tmp = t_1 else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))) tmp = 0.0 if (t_1 <= -1e-313) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(-1.0 / Float64(z * Float64(Float64(Float64(t / z) - a) / Float64(Float64(y * z) - x)))); elseif (t_1 <= 2e+297) tmp = t_1; else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (y * z)) / (t - (z * a)); tmp = 0.0; if (t_1 <= -1e-313) tmp = t_1; elseif (t_1 <= 0.0) tmp = -1.0 / (z * (((t / z) - a) / ((y * z) - x))); elseif (t_1 <= 2e+297) tmp = t_1; else tmp = y / (a - (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-313], t$95$1, If[LessEqual[t$95$1, 0.0], N[(-1.0 / N[(z * N[(N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+297], t$95$1, N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y \cdot z}{t - z \cdot a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-313}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{-1}{z \cdot \frac{\frac{t}{z} - a}{y \cdot z - x}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+297}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -1.00000000001e-313 or -0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 2e297Initial program 96.5%
if -1.00000000001e-313 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -0.0Initial program 53.8%
*-commutative53.8%
Simplified53.8%
Taylor expanded in z around inf 53.8%
clear-num53.8%
inv-pow53.8%
Applied egg-rr53.8%
unpow-153.8%
associate-/l*99.1%
*-commutative99.1%
Simplified99.1%
if 2e297 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 27.1%
*-commutative27.1%
Simplified27.1%
Taylor expanded in z around inf 27.1%
Taylor expanded in x around 0 95.2%
associate-*r/95.2%
mul-1-neg95.2%
Simplified95.2%
Final simplification96.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* y z)) (- t (* z a)))))
(if (<= t_1 -1e-313)
t_1
(if (<= t_1 0.0)
(/ (/ x z) (- (/ t z) a))
(if (<= t_1 2e+297) t_1 (/ y (- a (/ t z))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_1 <= -1e-313) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (x / z) / ((t / z) - a);
} else if (t_1 <= 2e+297) {
tmp = t_1;
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: t_1
real(8) :: tmp
t_1 = (x - (y * z)) / (t - (z * a))
if (t_1 <= (-1d-313)) then
tmp = t_1
else if (t_1 <= 0.0d0) then
tmp = (x / z) / ((t / z) - a)
else if (t_1 <= 2d+297) then
tmp = t_1
else
tmp = y / (a - (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_1 <= -1e-313) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (x / z) / ((t / z) - a);
} else if (t_1 <= 2e+297) {
tmp = t_1;
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (y * z)) / (t - (z * a)) tmp = 0 if t_1 <= -1e-313: tmp = t_1 elif t_1 <= 0.0: tmp = (x / z) / ((t / z) - a) elif t_1 <= 2e+297: tmp = t_1 else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))) tmp = 0.0 if (t_1 <= -1e-313) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(Float64(x / z) / Float64(Float64(t / z) - a)); elseif (t_1 <= 2e+297) tmp = t_1; else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (y * z)) / (t - (z * a)); tmp = 0.0; if (t_1 <= -1e-313) tmp = t_1; elseif (t_1 <= 0.0) tmp = (x / z) / ((t / z) - a); elseif (t_1 <= 2e+297) tmp = t_1; else tmp = y / (a - (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-313], t$95$1, If[LessEqual[t$95$1, 0.0], N[(N[(x / z), $MachinePrecision] / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+297], t$95$1, N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y \cdot z}{t - z \cdot a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-313}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{t}{z} - a}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+297}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -1.00000000001e-313 or -0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 2e297Initial program 96.5%
if -1.00000000001e-313 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -0.0Initial program 53.8%
*-commutative53.8%
Simplified53.8%
Taylor expanded in z around inf 53.8%
Taylor expanded in x around inf 53.8%
associate-/r*85.3%
Simplified85.3%
if 2e297 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 27.1%
*-commutative27.1%
Simplified27.1%
Taylor expanded in z around inf 27.1%
Taylor expanded in x around 0 95.2%
associate-*r/95.2%
mul-1-neg95.2%
Simplified95.2%
Final simplification95.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.32e+61)
(/ y a)
(if (<= z 6.2e-115)
(/ x t)
(if (<= z 1.34e+101) (/ (/ (- x) a) z) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.32e+61) {
tmp = y / a;
} else if (z <= 6.2e-115) {
tmp = x / t;
} else if (z <= 1.34e+101) {
tmp = (-x / a) / z;
} else {
tmp = y / a;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if (z <= (-2.32d+61)) then
tmp = y / a
else if (z <= 6.2d-115) then
tmp = x / t
else if (z <= 1.34d+101) then
tmp = (-x / a) / z
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.32e+61) {
tmp = y / a;
} else if (z <= 6.2e-115) {
tmp = x / t;
} else if (z <= 1.34e+101) {
tmp = (-x / a) / z;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.32e+61: tmp = y / a elif z <= 6.2e-115: tmp = x / t elif z <= 1.34e+101: tmp = (-x / a) / z else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.32e+61) tmp = Float64(y / a); elseif (z <= 6.2e-115) tmp = Float64(x / t); elseif (z <= 1.34e+101) tmp = Float64(Float64(Float64(-x) / a) / z); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.32e+61) tmp = y / a; elseif (z <= 6.2e-115) tmp = x / t; elseif (z <= 1.34e+101) tmp = (-x / a) / z; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.32e+61], N[(y / a), $MachinePrecision], If[LessEqual[z, 6.2e-115], N[(x / t), $MachinePrecision], If[LessEqual[z, 1.34e+101], N[(N[((-x) / a), $MachinePrecision] / z), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.32 \cdot 10^{+61}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-115}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 1.34 \cdot 10^{+101}:\\
\;\;\;\;\frac{\frac{-x}{a}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.32e61 or 1.3399999999999999e101 < z Initial program 58.2%
*-commutative58.2%
Simplified58.2%
Taylor expanded in z around inf 55.2%
if -2.32e61 < z < 6.20000000000000013e-115Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 59.9%
if 6.20000000000000013e-115 < z < 1.3399999999999999e101Initial program 92.7%
*-commutative92.7%
Simplified92.7%
Taylor expanded in x around -inf 82.5%
mul-1-neg82.5%
*-commutative82.5%
Simplified82.5%
Taylor expanded in a around -inf 56.0%
associate-/l*51.9%
Simplified51.9%
Taylor expanded in y around 0 36.0%
associate-/r*37.1%
Simplified37.1%
associate-*r/41.1%
frac-2neg41.1%
metadata-eval41.1%
un-div-inv41.2%
Applied egg-rr41.2%
Final simplification54.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.7e+61)
(/ y a)
(if (<= z 1.1e-115)
(/ x t)
(if (<= z 2.15e+135) (/ x (* z (- a))) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.7e+61) {
tmp = y / a;
} else if (z <= 1.1e-115) {
tmp = x / t;
} else if (z <= 2.15e+135) {
tmp = x / (z * -a);
} else {
tmp = y / a;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if (z <= (-2.7d+61)) then
tmp = y / a
else if (z <= 1.1d-115) then
tmp = x / t
else if (z <= 2.15d+135) then
tmp = x / (z * -a)
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.7e+61) {
tmp = y / a;
} else if (z <= 1.1e-115) {
tmp = x / t;
} else if (z <= 2.15e+135) {
tmp = x / (z * -a);
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.7e+61: tmp = y / a elif z <= 1.1e-115: tmp = x / t elif z <= 2.15e+135: tmp = x / (z * -a) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.7e+61) tmp = Float64(y / a); elseif (z <= 1.1e-115) tmp = Float64(x / t); elseif (z <= 2.15e+135) tmp = Float64(x / Float64(z * Float64(-a))); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.7e+61) tmp = y / a; elseif (z <= 1.1e-115) tmp = x / t; elseif (z <= 2.15e+135) tmp = x / (z * -a); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.7e+61], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.1e-115], N[(x / t), $MachinePrecision], If[LessEqual[z, 2.15e+135], N[(x / N[(z * (-a)), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+61}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-115}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+135}:\\
\;\;\;\;\frac{x}{z \cdot \left(-a\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.7000000000000002e61 or 2.14999999999999986e135 < z Initial program 57.5%
*-commutative57.5%
Simplified57.5%
Taylor expanded in z around inf 56.7%
if -2.7000000000000002e61 < z < 1.1e-115Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 59.9%
if 1.1e-115 < z < 2.14999999999999986e135Initial program 90.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in x around -inf 81.0%
mul-1-neg81.0%
*-commutative81.0%
Simplified81.0%
Taylor expanded in a around -inf 58.7%
associate-/l*54.9%
Simplified54.9%
Taylor expanded in x around inf 37.5%
associate-*r/37.5%
neg-mul-137.5%
*-commutative37.5%
Simplified37.5%
Final simplification53.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -1.5e-45) (not (<= x 9.8e+22))) (/ x (- t (* z a))) (/ y (- a (/ t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.5e-45) || !(x <= 9.8e+22)) {
tmp = x / (t - (z * a));
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if ((x <= (-1.5d-45)) .or. (.not. (x <= 9.8d+22))) then
tmp = x / (t - (z * a))
else
tmp = y / (a - (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.5e-45) || !(x <= 9.8e+22)) {
tmp = x / (t - (z * a));
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -1.5e-45) or not (x <= 9.8e+22): tmp = x / (t - (z * a)) else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -1.5e-45) || !(x <= 9.8e+22)) tmp = Float64(x / Float64(t - Float64(z * a))); else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -1.5e-45) || ~((x <= 9.8e+22))) tmp = x / (t - (z * a)); else tmp = y / (a - (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -1.5e-45], N[Not[LessEqual[x, 9.8e+22]], $MachinePrecision]], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-45} \lor \neg \left(x \leq 9.8 \cdot 10^{+22}\right):\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if x < -1.50000000000000005e-45 or 9.79999999999999958e22 < x Initial program 85.3%
*-commutative85.3%
Simplified85.3%
Taylor expanded in x around inf 75.5%
if -1.50000000000000005e-45 < x < 9.79999999999999958e22Initial program 85.9%
*-commutative85.9%
Simplified85.9%
Taylor expanded in z around inf 78.6%
Taylor expanded in x around 0 76.4%
associate-*r/76.4%
mul-1-neg76.4%
Simplified76.4%
Final simplification75.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -4.1e+83) (not (<= y 6.2e-30))) (/ (- x (* y z)) t) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -4.1e+83) || !(y <= 6.2e-30)) {
tmp = (x - (y * z)) / t;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if ((y <= (-4.1d+83)) .or. (.not. (y <= 6.2d-30))) then
tmp = (x - (y * z)) / t
else
tmp = x / (t - (z * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -4.1e+83) || !(y <= 6.2e-30)) {
tmp = (x - (y * z)) / t;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -4.1e+83) or not (y <= 6.2e-30): tmp = (x - (y * z)) / t else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -4.1e+83) || !(y <= 6.2e-30)) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = Float64(x / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -4.1e+83) || ~((y <= 6.2e-30))) tmp = (x - (y * z)) / t; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -4.1e+83], N[Not[LessEqual[y, 6.2e-30]], $MachinePrecision]], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{+83} \lor \neg \left(y \leq 6.2 \cdot 10^{-30}\right):\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if y < -4.1000000000000001e83 or 6.19999999999999982e-30 < y Initial program 77.1%
*-commutative77.1%
Simplified77.1%
Taylor expanded in t around inf 57.3%
*-commutative57.3%
Simplified57.3%
if -4.1000000000000001e83 < y < 6.19999999999999982e-30Initial program 92.9%
*-commutative92.9%
Simplified92.9%
Taylor expanded in x around inf 76.8%
Final simplification67.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.8e+78) (not (<= z 3.2e+136))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.8e+78) || !(z <= 3.2e+136)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if ((z <= (-5.8d+78)) .or. (.not. (z <= 3.2d+136))) then
tmp = y / a
else
tmp = x / (t - (z * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.8e+78) || !(z <= 3.2e+136)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.8e+78) or not (z <= 3.2e+136): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.8e+78) || !(z <= 3.2e+136)) tmp = Float64(y / a); else tmp = Float64(x / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -5.8e+78) || ~((z <= 3.2e+136))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.8e+78], N[Not[LessEqual[z, 3.2e+136]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+78} \lor \neg \left(z \leq 3.2 \cdot 10^{+136}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -5.80000000000000034e78 or 3.19999999999999988e136 < z Initial program 56.3%
*-commutative56.3%
Simplified56.3%
Taylor expanded in z around inf 58.1%
if -5.80000000000000034e78 < z < 3.19999999999999988e136Initial program 96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in x around inf 66.3%
Final simplification64.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4e+62) (not (<= z 6.9e-115))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4e+62) || !(z <= 6.9e-115)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if ((z <= (-4d+62)) .or. (.not. (z <= 6.9d-115))) then
tmp = y / a
else
tmp = x / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4e+62) || !(z <= 6.9e-115)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4e+62) or not (z <= 6.9e-115): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4e+62) || !(z <= 6.9e-115)) tmp = Float64(y / a); else tmp = Float64(x / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4e+62) || ~((z <= 6.9e-115))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4e+62], N[Not[LessEqual[z, 6.9e-115]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+62} \lor \neg \left(z \leq 6.9 \cdot 10^{-115}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -4.00000000000000014e62 or 6.89999999999999999e-115 < z Initial program 72.5%
*-commutative72.5%
Simplified72.5%
Taylor expanded in z around inf 43.4%
if -4.00000000000000014e62 < z < 6.89999999999999999e-115Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 59.9%
Final simplification51.4%
(FPCore (x y z t a) :precision binary64 (/ x t))
double code(double x, double y, double z, double t, double a) {
return x / t;
}
real(8) function code(x, y, z, t, a)
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
code = x / t
end function
public static double code(double x, double y, double z, double t, double a) {
return x / t;
}
def code(x, y, z, t, a): return x / t
function code(x, y, z, t, a) return Float64(x / t) end
function tmp = code(x, y, z, t, a) tmp = x / t; end
code[x_, y_, z_, t_, a_] := N[(x / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{t}
\end{array}
Initial program 85.6%
*-commutative85.6%
Simplified85.6%
Taylor expanded in z around 0 35.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (- (/ x t_1) (/ y (- (/ t z) a)))))
(if (< z -32113435955957344.0)
t_2
(if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 t_1)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t - (a * z)
t_2 = (x / t_1) - (y / ((t / z) - a))
if (z < (-32113435955957344.0d0)) then
tmp = t_2
else if (z < 3.5139522372978296d-86) then
tmp = (x - (y * z)) * (1.0d0 / t_1)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (a * z) t_2 = (x / t_1) - (y / ((t / z) - a)) tmp = 0 if z < -32113435955957344.0: tmp = t_2 elif z < 3.5139522372978296e-86: tmp = (x - (y * z)) * (1.0 / t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x / t_1) - Float64(y / Float64(Float64(t / z) - a))) tmp = 0.0 if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = Float64(Float64(x - Float64(y * z)) * Float64(1.0 / t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (a * z); t_2 = (x / t_1) - (y / ((t / z) - a)); tmp = 0.0; if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = (x - (y * z)) * (1.0 / t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / t$95$1), $MachinePrecision] - N[(y / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -32113435955957344.0], t$95$2, If[Less[z, 3.5139522372978296e-86], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x}{t\_1} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{if}\;z < -32113435955957344:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z < 3.5139522372978296 \cdot 10^{-86}:\\
\;\;\;\;\left(x - y \cdot z\right) \cdot \frac{1}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024145
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:alt
(! :herbie-platform default (if (< z -32113435955957344) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 4392440296622287/125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (- x (* y z)) (/ 1 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))))))
(/ (- x (* y z)) (- t (* a z))))