
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x))
(t_2
(/
(* y (+ (+ (/ x y) (/ z t_1)) (/ x (* y (- x (* z t))))))
(+ x 1.0)))
(t_3 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
(if (<= t_3 -2e-297)
t_2
(if (<= t_3 2.0)
t_3
(if (<= t_3 INFINITY) t_2 (/ (+ x (/ y t)) (+ x 1.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (y * (((x / y) + (z / t_1)) + (x / (y * (x - (z * t)))))) / (x + 1.0);
double t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_3 <= -2e-297) {
tmp = t_2;
} else if (t_3 <= 2.0) {
tmp = t_3;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (y * (((x / y) + (z / t_1)) + (x / (y * (x - (z * t)))))) / (x + 1.0);
double t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_3 <= -2e-297) {
tmp = t_2;
} else if (t_3 <= 2.0) {
tmp = t_3;
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (y * (((x / y) + (z / t_1)) + (x / (y * (x - (z * t)))))) / (x + 1.0) t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0) tmp = 0 if t_3 <= -2e-297: tmp = t_2 elif t_3 <= 2.0: tmp = t_3 elif t_3 <= math.inf: tmp = t_2 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(y * Float64(Float64(Float64(x / y) + Float64(z / t_1)) + Float64(x / Float64(y * Float64(x - Float64(z * t)))))) / Float64(x + 1.0)) t_3 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_3 <= -2e-297) tmp = t_2; elseif (t_3 <= 2.0) tmp = t_3; elseif (t_3 <= Inf) tmp = t_2; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (y * (((x / y) + (z / t_1)) + (x / (y * (x - (z * t)))))) / (x + 1.0); t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0); tmp = 0.0; if (t_3 <= -2e-297) tmp = t_2; elseif (t_3 <= 2.0) tmp = t_3; elseif (t_3 <= Inf) tmp = t_2; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(N[(N[(x / y), $MachinePrecision] + N[(z / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(x / N[(y * N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-297], t$95$2, If[LessEqual[t$95$3, 2.0], t$95$3, If[LessEqual[t$95$3, Infinity], t$95$2, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{y \cdot \left(\left(\frac{x}{y} + \frac{z}{t\_1}\right) + \frac{x}{y \cdot \left(x - z \cdot t\right)}\right)}{x + 1}\\
t_3 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-297}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -2.00000000000000008e-297 or 2 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < +inf.0Initial program 81.1%
*-commutative81.1%
Simplified81.1%
Taylor expanded in y around inf 97.7%
if -2.00000000000000008e-297 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 99.9%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x))
(t_2 (/ (+ x (* y (/ z t_1))) (+ x 1.0)))
(t_3 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
(if (<= t_3 (- INFINITY))
t_2
(if (<= t_3 4e+60)
t_3
(if (<= t_3 INFINITY) t_2 (/ (+ x (/ y t)) (+ x 1.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x + (y * (z / t_1))) / (x + 1.0);
double t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_3 <= 4e+60) {
tmp = t_3;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x + (y * (z / t_1))) / (x + 1.0);
double t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_3 <= -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_3 <= 4e+60) {
tmp = t_3;
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x + (y * (z / t_1))) / (x + 1.0) t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0) tmp = 0 if t_3 <= -math.inf: tmp = t_2 elif t_3 <= 4e+60: tmp = t_3 elif t_3 <= math.inf: tmp = t_2 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x + Float64(y * Float64(z / t_1))) / Float64(x + 1.0)) t_3 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_2; elseif (t_3 <= 4e+60) tmp = t_3; elseif (t_3 <= Inf) tmp = t_2; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (x + (y * (z / t_1))) / (x + 1.0); t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0); tmp = 0.0; if (t_3 <= -Inf) tmp = t_2; elseif (t_3 <= 4e+60) tmp = t_3; elseif (t_3 <= Inf) tmp = t_2; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(y * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$2, If[LessEqual[t$95$3, 4e+60], t$95$3, If[LessEqual[t$95$3, Infinity], t$95$2, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x + y \cdot \frac{z}{t\_1}}{x + 1}\\
t_3 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{+60}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -inf.0 or 3.9999999999999998e60 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < +inf.0Initial program 63.1%
*-commutative63.1%
Simplified63.1%
div-inv63.1%
fma-neg63.1%
Applied egg-rr63.1%
Taylor expanded in y around inf 63.1%
associate-/l*97.5%
Simplified97.5%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 3.9999999999999998e60Initial program 99.5%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7e-21) (not (<= y 8e-63))) (/ (+ x (* y (/ z (- (* z t) x)))) (+ x 1.0)) (/ (+ x (/ x (- x (* z t)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7e-21) || !(y <= 8e-63)) {
tmp = (x + (y * (z / ((z * t) - x)))) / (x + 1.0);
} else {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-7d-21)) .or. (.not. (y <= 8d-63))) then
tmp = (x + (y * (z / ((z * t) - x)))) / (x + 1.0d0)
else
tmp = (x + (x / (x - (z * t)))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7e-21) || !(y <= 8e-63)) {
tmp = (x + (y * (z / ((z * t) - x)))) / (x + 1.0);
} else {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7e-21) or not (y <= 8e-63): tmp = (x + (y * (z / ((z * t) - x)))) / (x + 1.0) else: tmp = (x + (x / (x - (z * t)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7e-21) || !(y <= 8e-63)) tmp = Float64(Float64(x + Float64(y * Float64(z / Float64(Float64(z * t) - x)))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7e-21) || ~((y <= 8e-63))) tmp = (x + (y * (z / ((z * t) - x)))) / (x + 1.0); else tmp = (x + (x / (x - (z * t)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7e-21], N[Not[LessEqual[y, 8e-63]], $MachinePrecision]], N[(N[(x + N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{-21} \lor \neg \left(y \leq 8 \cdot 10^{-63}\right):\\
\;\;\;\;\frac{x + y \cdot \frac{z}{z \cdot t - x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\end{array}
\end{array}
if y < -7.0000000000000007e-21 or 8.00000000000000053e-63 < y Initial program 83.6%
*-commutative83.6%
Simplified83.6%
div-inv83.5%
fma-neg83.6%
Applied egg-rr83.6%
Taylor expanded in y around inf 77.4%
associate-/l*89.8%
Simplified89.8%
if -7.0000000000000007e-21 < y < 8.00000000000000053e-63Initial program 99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in y around 0 93.9%
Final simplification91.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.2e-149) (not (<= t 3.7e-101))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (* z (/ (/ y x) (- -1.0 x))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.2e-149) || !(t <= 3.7e-101)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + (z * ((y / x) / (-1.0 - x)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-6.2d-149)) .or. (.not. (t <= 3.7d-101))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + (z * ((y / x) / ((-1.0d0) - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.2e-149) || !(t <= 3.7e-101)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + (z * ((y / x) / (-1.0 - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.2e-149) or not (t <= 3.7e-101): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + (z * ((y / x) / (-1.0 - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.2e-149) || !(t <= 3.7e-101)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(z * Float64(Float64(y / x) / Float64(-1.0 - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -6.2e-149) || ~((t <= 3.7e-101))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + (z * ((y / x) / (-1.0 - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.2e-149], N[Not[LessEqual[t, 3.7e-101]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(z * N[(N[(y / x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-149} \lor \neg \left(t \leq 3.7 \cdot 10^{-101}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + z \cdot \frac{\frac{y}{x}}{-1 - x}\\
\end{array}
\end{array}
if t < -6.19999999999999974e-149 or 3.70000000000000005e-101 < t Initial program 90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in z around inf 85.5%
if -6.19999999999999974e-149 < t < 3.70000000000000005e-101Initial program 88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in z around 0 80.9%
Taylor expanded in y around inf 81.0%
associate-*r/81.0%
+-commutative81.0%
associate-/r*85.5%
mul-1-neg85.5%
Simplified85.5%
Final simplification85.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.5e-150) (not (<= t 5.5e-101))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (/ (* y (/ z x)) (- -1.0 x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.5e-150) || !(t <= 5.5e-101)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y * (z / x)) / (-1.0 - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-6.5d-150)) .or. (.not. (t <= 5.5d-101))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + ((y * (z / x)) / ((-1.0d0) - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.5e-150) || !(t <= 5.5e-101)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y * (z / x)) / (-1.0 - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.5e-150) or not (t <= 5.5e-101): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + ((y * (z / x)) / (-1.0 - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.5e-150) || !(t <= 5.5e-101)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(Float64(y * Float64(z / x)) / Float64(-1.0 - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -6.5e-150) || ~((t <= 5.5e-101))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + ((y * (z / x)) / (-1.0 - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.5e-150], N[Not[LessEqual[t, 5.5e-101]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.5 \cdot 10^{-150} \lor \neg \left(t \leq 5.5 \cdot 10^{-101}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \frac{z}{x}}{-1 - x}\\
\end{array}
\end{array}
if t < -6.49999999999999997e-150 or 5.49999999999999973e-101 < t Initial program 90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in z around inf 85.5%
if -6.49999999999999997e-150 < t < 5.49999999999999973e-101Initial program 88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in t around 0 76.4%
associate-+r+76.4%
mul-1-neg76.4%
unsub-neg76.4%
+-commutative76.4%
associate-/l*85.5%
+-commutative85.5%
Simplified85.5%
div-sub85.5%
pow185.5%
pow185.5%
pow-div85.5%
metadata-eval85.5%
metadata-eval85.5%
Applied egg-rr85.5%
Final simplification85.5%
(FPCore (x y z t) :precision binary64 (if (<= x -5.8e-52) 1.0 (if (<= x 1.6e-73) (/ y t) (if (<= x 1.3e-5) (* x (- 1.0 x)) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.8e-52) {
tmp = 1.0;
} else if (x <= 1.6e-73) {
tmp = y / t;
} else if (x <= 1.3e-5) {
tmp = x * (1.0 - x);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-5.8d-52)) then
tmp = 1.0d0
else if (x <= 1.6d-73) then
tmp = y / t
else if (x <= 1.3d-5) then
tmp = x * (1.0d0 - x)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.8e-52) {
tmp = 1.0;
} else if (x <= 1.6e-73) {
tmp = y / t;
} else if (x <= 1.3e-5) {
tmp = x * (1.0 - x);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.8e-52: tmp = 1.0 elif x <= 1.6e-73: tmp = y / t elif x <= 1.3e-5: tmp = x * (1.0 - x) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.8e-52) tmp = 1.0; elseif (x <= 1.6e-73) tmp = Float64(y / t); elseif (x <= 1.3e-5) tmp = Float64(x * Float64(1.0 - x)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5.8e-52) tmp = 1.0; elseif (x <= 1.6e-73) tmp = y / t; elseif (x <= 1.3e-5) tmp = x * (1.0 - x); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.8e-52], 1.0, If[LessEqual[x, 1.6e-73], N[(y / t), $MachinePrecision], If[LessEqual[x, 1.3e-5], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{-52}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-73}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-5}:\\
\;\;\;\;x \cdot \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -5.8000000000000003e-52 or 1.29999999999999992e-5 < x Initial program 88.2%
*-commutative88.2%
Simplified88.2%
div-inv88.2%
fma-neg88.2%
Applied egg-rr88.2%
Taylor expanded in y around inf 81.0%
associate-/l*92.0%
Simplified92.0%
Taylor expanded in x around inf 79.7%
if -5.8000000000000003e-52 < x < 1.59999999999999993e-73Initial program 90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in z around inf 75.1%
Taylor expanded in x around 0 56.7%
if 1.59999999999999993e-73 < x < 1.29999999999999992e-5Initial program 95.8%
*-commutative95.8%
Simplified95.8%
Taylor expanded in t around inf 58.7%
+-commutative58.7%
Simplified58.7%
Taylor expanded in x around 0 57.9%
neg-mul-157.9%
sub-neg57.9%
Simplified57.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.3e-104) (not (<= z 1.02e-173))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (* z (/ (- t y) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.3e-104) || !(z <= 1.02e-173)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + (z * ((t - y) / x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5.3d-104)) .or. (.not. (z <= 1.02d-173))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + (z * ((t - y) / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.3e-104) || !(z <= 1.02e-173)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + (z * ((t - y) / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.3e-104) or not (z <= 1.02e-173): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + (z * ((t - y) / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.3e-104) || !(z <= 1.02e-173)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(z * Float64(Float64(t - y) / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.3e-104) || ~((z <= 1.02e-173))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + (z * ((t - y) / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.3e-104], N[Not[LessEqual[z, 1.02e-173]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(z * N[(N[(t - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{-104} \lor \neg \left(z \leq 1.02 \cdot 10^{-173}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + z \cdot \frac{t - y}{x}\\
\end{array}
\end{array}
if z < -5.30000000000000018e-104 or 1.02000000000000006e-173 < z Initial program 86.5%
*-commutative86.5%
Simplified86.5%
Taylor expanded in z around inf 82.0%
if -5.30000000000000018e-104 < z < 1.02000000000000006e-173Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 77.6%
Taylor expanded in x around 0 79.9%
associate-/l*75.6%
mul-1-neg75.6%
sub-neg75.6%
Simplified75.6%
Final simplification80.4%
(FPCore (x y z t) :precision binary64 (if (<= x -2.6e-54) 1.0 (if (<= x 3.4e-75) (/ y t) (if (<= x 3e-13) x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.6e-54) {
tmp = 1.0;
} else if (x <= 3.4e-75) {
tmp = y / t;
} else if (x <= 3e-13) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-2.6d-54)) then
tmp = 1.0d0
else if (x <= 3.4d-75) then
tmp = y / t
else if (x <= 3d-13) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.6e-54) {
tmp = 1.0;
} else if (x <= 3.4e-75) {
tmp = y / t;
} else if (x <= 3e-13) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.6e-54: tmp = 1.0 elif x <= 3.4e-75: tmp = y / t elif x <= 3e-13: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.6e-54) tmp = 1.0; elseif (x <= 3.4e-75) tmp = Float64(y / t); elseif (x <= 3e-13) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.6e-54) tmp = 1.0; elseif (x <= 3.4e-75) tmp = y / t; elseif (x <= 3e-13) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.6e-54], 1.0, If[LessEqual[x, 3.4e-75], N[(y / t), $MachinePrecision], If[LessEqual[x, 3e-13], x, 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-54}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-75}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.60000000000000002e-54 or 2.99999999999999984e-13 < x Initial program 88.5%
*-commutative88.5%
Simplified88.5%
div-inv88.4%
fma-neg88.4%
Applied egg-rr88.4%
Taylor expanded in y around inf 80.8%
associate-/l*91.6%
Simplified91.6%
Taylor expanded in x around inf 78.8%
if -2.60000000000000002e-54 < x < 3.40000000000000015e-75Initial program 90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in z around inf 75.1%
Taylor expanded in x around 0 56.7%
if 3.40000000000000015e-75 < x < 2.99999999999999984e-13Initial program 95.3%
*-commutative95.3%
Simplified95.3%
Taylor expanded in t around inf 57.2%
+-commutative57.2%
Simplified57.2%
Taylor expanded in x around 0 57.2%
neg-mul-157.2%
sub-neg57.2%
Simplified57.2%
Taylor expanded in x around 0 57.0%
(FPCore (x y z t) :precision binary64 (if (<= x -8.5e-54) 1.0 (if (<= x 3.25e-77) (/ y t) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.5e-54) {
tmp = 1.0;
} else if (x <= 3.25e-77) {
tmp = y / t;
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-8.5d-54)) then
tmp = 1.0d0
else if (x <= 3.25d-77) then
tmp = y / t
else
tmp = x / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.5e-54) {
tmp = 1.0;
} else if (x <= 3.25e-77) {
tmp = y / t;
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8.5e-54: tmp = 1.0 elif x <= 3.25e-77: tmp = y / t else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8.5e-54) tmp = 1.0; elseif (x <= 3.25e-77) tmp = Float64(y / t); else tmp = Float64(x / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -8.5e-54) tmp = 1.0; elseif (x <= 3.25e-77) tmp = y / t; else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8.5e-54], 1.0, If[LessEqual[x, 3.25e-77], N[(y / t), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-54}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.25 \cdot 10^{-77}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -8.5e-54Initial program 85.1%
*-commutative85.1%
Simplified85.1%
div-inv85.0%
fma-neg85.0%
Applied egg-rr85.0%
Taylor expanded in y around inf 72.9%
associate-/l*86.5%
Simplified86.5%
Taylor expanded in x around inf 78.2%
if -8.5e-54 < x < 3.25e-77Initial program 90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in z around inf 75.1%
Taylor expanded in x around 0 56.7%
if 3.25e-77 < x Initial program 93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in t around inf 74.3%
+-commutative74.3%
Simplified74.3%
(FPCore (x y z t) :precision binary64 (if (<= x -2.5e-72) 1.0 (if (<= x 6.6e-13) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.5e-72) {
tmp = 1.0;
} else if (x <= 6.6e-13) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-2.5d-72)) then
tmp = 1.0d0
else if (x <= 6.6d-13) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.5e-72) {
tmp = 1.0;
} else if (x <= 6.6e-13) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.5e-72: tmp = 1.0 elif x <= 6.6e-13: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.5e-72) tmp = 1.0; elseif (x <= 6.6e-13) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.5e-72) tmp = 1.0; elseif (x <= 6.6e-13) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.5e-72], 1.0, If[LessEqual[x, 6.6e-13], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-72}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.4999999999999998e-72 or 6.6000000000000001e-13 < x Initial program 89.0%
*-commutative89.0%
Simplified89.0%
div-inv89.0%
fma-neg89.0%
Applied egg-rr89.0%
Taylor expanded in y around inf 79.7%
associate-/l*90.0%
Simplified90.0%
Taylor expanded in x around inf 76.7%
if -2.4999999999999998e-72 < x < 6.6000000000000001e-13Initial program 90.8%
*-commutative90.8%
Simplified90.8%
Taylor expanded in t around inf 28.9%
+-commutative28.9%
Simplified28.9%
Taylor expanded in x around 0 28.9%
neg-mul-128.9%
sub-neg28.9%
Simplified28.9%
Taylor expanded in x around 0 28.9%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 89.7%
*-commutative89.7%
Simplified89.7%
div-inv89.7%
fma-neg89.7%
Applied egg-rr89.7%
Taylor expanded in y around inf 78.7%
associate-/l*86.2%
Simplified86.2%
Taylor expanded in x around inf 48.8%
(FPCore (x y z t) :precision binary64 (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
def code(x, y, z, t): return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(y / Float64(t - Float64(x / z))) - Float64(x / Float64(Float64(t * z) - x)))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}
\end{array}
herbie shell --seed 2024110
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))