
(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 9 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 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (<= t_1 1e+16)
t_1
(if (<= t_1 INFINITY)
(/ y (* (- -1.0 x) (/ (- x (* z t)) z)))
(/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= 1e+16) {
tmp = t_1;
} else if (t_1 <= ((double) INFINITY)) {
tmp = y / ((-1.0 - x) * ((x - (z * t)) / z));
} 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 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= 1e+16) {
tmp = t_1;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = y / ((-1.0 - x) * ((x - (z * t)) / z));
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_1 <= 1e+16: tmp = t_1 elif t_1 <= math.inf: tmp = y / ((-1.0 - x) * ((x - (z * t)) / z)) else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= 1e+16) tmp = t_1; elseif (t_1 <= Inf) tmp = Float64(y / Float64(Float64(-1.0 - x) * Float64(Float64(x - Float64(z * t)) / z))); 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 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= 1e+16) tmp = t_1; elseif (t_1 <= Inf) tmp = y / ((-1.0 - x) * ((x - (z * t)) / z)); else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+16], t$95$1, If[LessEqual[t$95$1, Infinity], N[(y / N[(N[(-1.0 - x), $MachinePrecision] * N[(N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{y}{\left(-1 - x\right) \cdot \frac{x - z \cdot t}{z}}\\
\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))) < 1e16Initial program 97.3%
if 1e16 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < +inf.0Initial program 54.1%
*-commutative54.1%
Simplified54.1%
clear-num54.1%
inv-pow54.1%
fma-neg54.1%
Applied egg-rr54.1%
unpow-154.1%
div-sub53.3%
*-commutative53.3%
div-sub54.1%
fma-neg54.1%
*-commutative54.1%
Simplified54.1%
Taylor expanded in y around inf 53.5%
associate-/l*78.4%
+-commutative78.4%
*-commutative78.4%
Simplified78.4%
clear-num78.7%
un-div-inv78.8%
associate-/l*87.6%
*-commutative87.6%
fma-neg87.6%
Applied egg-rr87.6%
fma-neg87.6%
Simplified87.6%
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 simplification96.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9.5e-30) (not (<= t 4.2e-88))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (- 1.0 (/ y (/ x z)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9.5e-30) || !(t <= 4.2e-88)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (1.0 - (y / (x / z)))) / (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 ((t <= (-9.5d-30)) .or. (.not. (t <= 4.2d-88))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + (1.0d0 - (y / (x / z)))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9.5e-30) || !(t <= 4.2e-88)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9.5e-30) or not (t <= 4.2e-88): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9.5e-30) || !(t <= 4.2e-88)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(1.0 - Float64(y / Float64(x / z)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -9.5e-30) || ~((t <= 4.2e-88))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9.5e-30], N[Not[LessEqual[t, 4.2e-88]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(1.0 - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{-30} \lor \neg \left(t \leq 4.2 \cdot 10^{-88}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(1 - \frac{y}{\frac{x}{z}}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -9.49999999999999939e-30 or 4.1999999999999999e-88 < t Initial program 86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in z around inf 86.8%
if -9.49999999999999939e-30 < t < 4.1999999999999999e-88Initial program 92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in t around 0 75.3%
associate-+r+75.3%
+-commutative75.3%
associate-+l+75.3%
mul-1-neg75.3%
unsub-neg75.3%
associate-/l*82.1%
+-commutative82.1%
Simplified82.1%
clear-num82.1%
un-div-inv82.1%
Applied egg-rr82.1%
Final simplification84.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.2e-23) (not (<= t 9e-88))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (- 1.0 (* y (/ z x)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.2e-23) || !(t <= 9e-88)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (1.0 - (y * (z / 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 ((t <= (-1.2d-23)) .or. (.not. (t <= 9d-88))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + (1.0d0 - (y * (z / 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 ((t <= -1.2e-23) || !(t <= 9e-88)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (1.0 - (y * (z / x)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.2e-23) or not (t <= 9e-88): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (1.0 - (y * (z / x)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.2e-23) || !(t <= 9e-88)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(1.0 - Float64(y * Float64(z / x)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.2e-23) || ~((t <= 9e-88))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (1.0 - (y * (z / x)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.2e-23], N[Not[LessEqual[t, 9e-88]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(1.0 - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{-23} \lor \neg \left(t \leq 9 \cdot 10^{-88}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(1 - y \cdot \frac{z}{x}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -1.19999999999999998e-23 or 8.99999999999999982e-88 < t Initial program 86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in z around inf 86.8%
if -1.19999999999999998e-23 < t < 8.99999999999999982e-88Initial program 92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in t around 0 75.3%
associate-+r+75.3%
+-commutative75.3%
associate-+l+75.3%
mul-1-neg75.3%
unsub-neg75.3%
associate-/l*82.1%
+-commutative82.1%
Simplified82.1%
Final simplification84.7%
(FPCore (x y z t)
:precision binary64
(if (<= x -2.95e-21)
1.0
(if (<= x 1.02e+17)
(/ (+ x (/ y t)) (+ x 1.0))
(+ 1.0 (/ (+ (/ 1.0 x) -1.0) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.95e-21) {
tmp = 1.0;
} else if (x <= 1.02e+17) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + (((1.0 / 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 (x <= (-2.95d-21)) then
tmp = 1.0d0
else if (x <= 1.02d+17) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + (((1.0d0 / 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 (x <= -2.95e-21) {
tmp = 1.0;
} else if (x <= 1.02e+17) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + (((1.0 / x) + -1.0) / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.95e-21: tmp = 1.0 elif x <= 1.02e+17: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + (((1.0 / x) + -1.0) / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.95e-21) tmp = 1.0; elseif (x <= 1.02e+17) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(Float64(Float64(1.0 / x) + -1.0) / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.95e-21) tmp = 1.0; elseif (x <= 1.02e+17) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + (((1.0 / x) + -1.0) / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.95e-21], 1.0, If[LessEqual[x, 1.02e+17], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.95 \cdot 10^{-21}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{+17}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{1}{x} + -1}{x}\\
\end{array}
\end{array}
if x < -2.9500000000000001e-21Initial program 81.9%
*-commutative81.9%
Simplified81.9%
Taylor expanded in t around 0 77.6%
associate-+r+77.6%
+-commutative77.6%
associate-+l+77.6%
mul-1-neg77.6%
unsub-neg77.6%
associate-/l*88.8%
+-commutative88.8%
Simplified88.8%
Taylor expanded in x around inf 86.9%
if -2.9500000000000001e-21 < x < 1.02e17Initial program 94.0%
*-commutative94.0%
Simplified94.0%
Taylor expanded in z around inf 70.3%
if 1.02e17 < x Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in t around inf 94.7%
+-commutative94.7%
Simplified94.7%
clear-num94.7%
inv-pow94.7%
Applied egg-rr94.7%
unpow-194.7%
Simplified94.7%
Taylor expanded in x around -inf 94.7%
mul-1-neg94.7%
unsub-neg94.7%
Simplified94.7%
Final simplification81.1%
(FPCore (x y z t) :precision binary64 (if (<= x -1.5e-57) 1.0 (if (<= x 1.9e-147) (/ y (* t (+ x 1.0))) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.5e-57) {
tmp = 1.0;
} else if (x <= 1.9e-147) {
tmp = y / (t * (x + 1.0));
} 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 <= (-1.5d-57)) then
tmp = 1.0d0
else if (x <= 1.9d-147) then
tmp = y / (t * (x + 1.0d0))
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 <= -1.5e-57) {
tmp = 1.0;
} else if (x <= 1.9e-147) {
tmp = y / (t * (x + 1.0));
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.5e-57: tmp = 1.0 elif x <= 1.9e-147: tmp = y / (t * (x + 1.0)) else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.5e-57) tmp = 1.0; elseif (x <= 1.9e-147) tmp = Float64(y / Float64(t * Float64(x + 1.0))); 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 <= -1.5e-57) tmp = 1.0; elseif (x <= 1.9e-147) tmp = y / (t * (x + 1.0)); else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.5e-57], 1.0, If[LessEqual[x, 1.9e-147], N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-57}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-147}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -1.5e-57Initial program 82.1%
*-commutative82.1%
Simplified82.1%
Taylor expanded in t around 0 75.9%
associate-+r+75.9%
+-commutative75.9%
associate-+l+75.9%
mul-1-neg75.9%
unsub-neg75.9%
associate-/l*86.3%
+-commutative86.3%
Simplified86.3%
Taylor expanded in x around inf 84.6%
if -1.5e-57 < x < 1.90000000000000014e-147Initial program 93.8%
*-commutative93.8%
Simplified93.8%
Taylor expanded in z around inf 74.1%
Taylor expanded in y around inf 49.1%
+-commutative49.1%
Simplified49.1%
if 1.90000000000000014e-147 < x Initial program 92.8%
*-commutative92.8%
Simplified92.8%
Taylor expanded in t around inf 78.2%
+-commutative78.2%
Simplified78.2%
(FPCore (x y z t) :precision binary64 (if (<= x -7.8e-59) 1.0 (if (<= x 2.45e-147) (/ y t) (if (<= x 1.2e-33) x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.8e-59) {
tmp = 1.0;
} else if (x <= 2.45e-147) {
tmp = y / t;
} else if (x <= 1.2e-33) {
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 <= (-7.8d-59)) then
tmp = 1.0d0
else if (x <= 2.45d-147) then
tmp = y / t
else if (x <= 1.2d-33) 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 <= -7.8e-59) {
tmp = 1.0;
} else if (x <= 2.45e-147) {
tmp = y / t;
} else if (x <= 1.2e-33) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.8e-59: tmp = 1.0 elif x <= 2.45e-147: tmp = y / t elif x <= 1.2e-33: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.8e-59) tmp = 1.0; elseif (x <= 2.45e-147) tmp = Float64(y / t); elseif (x <= 1.2e-33) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.8e-59) tmp = 1.0; elseif (x <= 2.45e-147) tmp = y / t; elseif (x <= 1.2e-33) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.8e-59], 1.0, If[LessEqual[x, 2.45e-147], N[(y / t), $MachinePrecision], If[LessEqual[x, 1.2e-33], x, 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-59}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.45 \cdot 10^{-147}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-33}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.80000000000000038e-59 or 1.2e-33 < x Initial program 85.8%
*-commutative85.8%
Simplified85.8%
Taylor expanded in t around 0 79.5%
associate-+r+79.5%
+-commutative79.5%
associate-+l+79.5%
mul-1-neg79.5%
unsub-neg79.5%
associate-/l*86.9%
+-commutative86.9%
Simplified86.9%
Taylor expanded in x around inf 85.0%
if -7.80000000000000038e-59 < x < 2.45000000000000002e-147Initial program 93.8%
*-commutative93.8%
Simplified93.8%
Taylor expanded in z around inf 74.1%
clear-num73.9%
inv-pow73.9%
Applied egg-rr73.9%
unpow-173.9%
Simplified73.9%
Taylor expanded in x around 0 49.1%
if 2.45000000000000002e-147 < x < 1.2e-33Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around inf 51.8%
+-commutative51.8%
Simplified51.8%
Taylor expanded in x around 0 51.8%
(FPCore (x y z t) :precision binary64 (if (<= x -1.15e-58) 1.0 (if (<= x 7.8e-150) (/ y t) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.15e-58) {
tmp = 1.0;
} else if (x <= 7.8e-150) {
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 <= (-1.15d-58)) then
tmp = 1.0d0
else if (x <= 7.8d-150) 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 <= -1.15e-58) {
tmp = 1.0;
} else if (x <= 7.8e-150) {
tmp = y / t;
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.15e-58: tmp = 1.0 elif x <= 7.8e-150: tmp = y / t else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.15e-58) tmp = 1.0; elseif (x <= 7.8e-150) 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 <= -1.15e-58) tmp = 1.0; elseif (x <= 7.8e-150) tmp = y / t; else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.15e-58], 1.0, If[LessEqual[x, 7.8e-150], N[(y / t), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{-58}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{-150}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -1.1499999999999999e-58Initial program 82.1%
*-commutative82.1%
Simplified82.1%
Taylor expanded in t around 0 75.9%
associate-+r+75.9%
+-commutative75.9%
associate-+l+75.9%
mul-1-neg75.9%
unsub-neg75.9%
associate-/l*86.3%
+-commutative86.3%
Simplified86.3%
Taylor expanded in x around inf 84.6%
if -1.1499999999999999e-58 < x < 7.8000000000000004e-150Initial program 93.8%
*-commutative93.8%
Simplified93.8%
Taylor expanded in z around inf 74.1%
clear-num73.9%
inv-pow73.9%
Applied egg-rr73.9%
unpow-173.9%
Simplified73.9%
Taylor expanded in x around 0 49.1%
if 7.8000000000000004e-150 < x Initial program 92.8%
*-commutative92.8%
Simplified92.8%
Taylor expanded in t around inf 78.2%
+-commutative78.2%
Simplified78.2%
(FPCore (x y z t) :precision binary64 (if (<= x -2e-160) 1.0 (if (<= x 1.9e-31) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2e-160) {
tmp = 1.0;
} else if (x <= 1.9e-31) {
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 <= (-2d-160)) then
tmp = 1.0d0
else if (x <= 1.9d-31) 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 <= -2e-160) {
tmp = 1.0;
} else if (x <= 1.9e-31) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2e-160: tmp = 1.0 elif x <= 1.9e-31: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2e-160) tmp = 1.0; elseif (x <= 1.9e-31) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2e-160) tmp = 1.0; elseif (x <= 1.9e-31) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2e-160], 1.0, If[LessEqual[x, 1.9e-31], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-160}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-31}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2e-160 or 1.9e-31 < x Initial program 86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in t around 0 75.7%
associate-+r+75.7%
+-commutative75.7%
associate-+l+75.7%
mul-1-neg75.7%
unsub-neg75.7%
associate-/l*82.3%
+-commutative82.3%
Simplified82.3%
Taylor expanded in x around inf 78.5%
if -2e-160 < x < 1.9e-31Initial program 94.8%
*-commutative94.8%
Simplified94.8%
Taylor expanded in t around inf 33.5%
+-commutative33.5%
Simplified33.5%
Taylor expanded in x around 0 33.5%
(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.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in t around 0 59.7%
associate-+r+59.7%
+-commutative59.7%
associate-+l+59.7%
mul-1-neg59.7%
unsub-neg59.7%
associate-/l*64.3%
+-commutative64.3%
Simplified64.3%
Taylor expanded in x around inf 57.9%
(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 2024086
(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)))