
(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 (- (* z t) x)) (t_2 (/ (- x (/ (- x (* y z)) t_1)) (+ x 1.0))))
(if (<= t_2 -2e+230)
(/ (* y (+ (/ z (- x (* z t))) (/ (- (/ x t_1) x) y))) (- -1.0 x))
(if (<= t_2 1e+52)
t_2
(if (<= t_2 INFINITY)
(/ y (* (+ x 1.0) (/ t_1 z)))
(+
(/ x (* x (+ 1.0 (/ 1.0 x))))
(/ (+ (/ y (+ x 1.0)) (/ (/ x z) (- -1.0 x))) t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -2e+230) {
tmp = (y * ((z / (x - (z * t))) + (((x / t_1) - x) / y))) / (-1.0 - x);
} else if (t_2 <= 1e+52) {
tmp = t_2;
} else if (t_2 <= ((double) INFINITY)) {
tmp = y / ((x + 1.0) * (t_1 / z));
} else {
tmp = (x / (x * (1.0 + (1.0 / x)))) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -2e+230) {
tmp = (y * ((z / (x - (z * t))) + (((x / t_1) - x) / y))) / (-1.0 - x);
} else if (t_2 <= 1e+52) {
tmp = t_2;
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = y / ((x + 1.0) * (t_1 / z));
} else {
tmp = (x / (x * (1.0 + (1.0 / x)))) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= -2e+230: tmp = (y * ((z / (x - (z * t))) + (((x / t_1) - x) / y))) / (-1.0 - x) elif t_2 <= 1e+52: tmp = t_2 elif t_2 <= math.inf: tmp = y / ((x + 1.0) * (t_1 / z)) else: tmp = (x / (x * (1.0 + (1.0 / x)))) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x - Float64(Float64(x - Float64(y * z)) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -2e+230) tmp = Float64(Float64(y * Float64(Float64(z / Float64(x - Float64(z * t))) + Float64(Float64(Float64(x / t_1) - x) / y))) / Float64(-1.0 - x)); elseif (t_2 <= 1e+52) tmp = t_2; elseif (t_2 <= Inf) tmp = Float64(y / Float64(Float64(x + 1.0) * Float64(t_1 / z))); else tmp = Float64(Float64(x / Float64(x * Float64(1.0 + Float64(1.0 / x)))) + Float64(Float64(Float64(y / Float64(x + 1.0)) + Float64(Float64(x / z) / Float64(-1.0 - x))) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= -2e+230) tmp = (y * ((z / (x - (z * t))) + (((x / t_1) - x) / y))) / (-1.0 - x); elseif (t_2 <= 1e+52) tmp = t_2; elseif (t_2 <= Inf) tmp = y / ((x + 1.0) * (t_1 / z)); else tmp = (x / (x * (1.0 + (1.0 / x)))) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t); 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[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+230], N[(N[(y * N[(N[(z / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(x / t$95$1), $MachinePrecision] - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+52], t$95$2, If[LessEqual[t$95$2, Infinity], N[(y / N[(N[(x + 1.0), $MachinePrecision] * N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x / z), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x - \frac{x - y \cdot z}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+230}:\\
\;\;\;\;\frac{y \cdot \left(\frac{z}{x - z \cdot t} + \frac{\frac{x}{t\_1} - x}{y}\right)}{-1 - x}\\
\mathbf{elif}\;t\_2 \leq 10^{+52}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot \frac{t\_1}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x \cdot \left(1 + \frac{1}{x}\right)} + \frac{\frac{y}{x + 1} + \frac{\frac{x}{z}}{-1 - x}}{t}\\
\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.0000000000000002e230Initial program 63.8%
*-commutative63.8%
Simplified63.8%
Taylor expanded in y around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
mul-1-neg99.8%
unsub-neg99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-neg-frac299.8%
sub-neg99.8%
*-commutative99.8%
distribute-neg-in99.8%
distribute-rgt-neg-in99.8%
remove-double-neg99.8%
Simplified99.8%
if -2.0000000000000002e230 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 9.9999999999999999e51Initial program 98.0%
if 9.9999999999999999e51 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < +inf.0Initial program 52.6%
*-commutative52.6%
Simplified52.6%
Taylor expanded in y around inf 52.3%
times-frac99.5%
+-commutative99.5%
Simplified99.5%
*-commutative99.5%
clear-num99.4%
frac-times99.9%
*-un-lft-identity99.9%
fmm-def99.9%
Applied egg-rr99.9%
*-commutative99.9%
+-commutative99.9%
fmm-def99.9%
Simplified99.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 t around -inf 99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 100.0%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x)) (t_2 (/ (- x (/ (- x (* y z)) t_1)) (+ x 1.0))))
(if (<= t_2 1e+52)
t_2
(if (<= t_2 INFINITY)
(/ y (* (+ x 1.0) (/ t_1 z)))
(+
(/ x (* x (+ 1.0 (/ 1.0 x))))
(/ (+ (/ y (+ x 1.0)) (/ (/ x z) (- -1.0 x))) t))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= 1e+52) {
tmp = t_2;
} else if (t_2 <= ((double) INFINITY)) {
tmp = y / ((x + 1.0) * (t_1 / z));
} else {
tmp = (x / (x * (1.0 + (1.0 / x)))) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= 1e+52) {
tmp = t_2;
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = y / ((x + 1.0) * (t_1 / z));
} else {
tmp = (x / (x * (1.0 + (1.0 / x)))) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= 1e+52: tmp = t_2 elif t_2 <= math.inf: tmp = y / ((x + 1.0) * (t_1 / z)) else: tmp = (x / (x * (1.0 + (1.0 / x)))) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x - Float64(Float64(x - Float64(y * z)) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= 1e+52) tmp = t_2; elseif (t_2 <= Inf) tmp = Float64(y / Float64(Float64(x + 1.0) * Float64(t_1 / z))); else tmp = Float64(Float64(x / Float64(x * Float64(1.0 + Float64(1.0 / x)))) + Float64(Float64(Float64(y / Float64(x + 1.0)) + Float64(Float64(x / z) / Float64(-1.0 - x))) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= 1e+52) tmp = t_2; elseif (t_2 <= Inf) tmp = y / ((x + 1.0) * (t_1 / z)); else tmp = (x / (x * (1.0 + (1.0 / x)))) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t); 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[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 1e+52], t$95$2, If[LessEqual[t$95$2, Infinity], N[(y / N[(N[(x + 1.0), $MachinePrecision] * N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x / z), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x - \frac{x - y \cdot z}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq 10^{+52}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot \frac{t\_1}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x \cdot \left(1 + \frac{1}{x}\right)} + \frac{\frac{y}{x + 1} + \frac{\frac{x}{z}}{-1 - x}}{t}\\
\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))) < 9.9999999999999999e51Initial program 95.5%
if 9.9999999999999999e51 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < +inf.0Initial program 52.6%
*-commutative52.6%
Simplified52.6%
Taylor expanded in y around inf 52.3%
times-frac99.5%
+-commutative99.5%
Simplified99.5%
*-commutative99.5%
clear-num99.4%
frac-times99.9%
*-un-lft-identity99.9%
fmm-def99.9%
Applied egg-rr99.9%
*-commutative99.9%
+-commutative99.9%
fmm-def99.9%
Simplified99.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 t around -inf 99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 100.0%
Final simplification96.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x)) (t_2 (/ (- x (/ (- x (* y z)) t_1)) (+ x 1.0))))
(if (<= t_2 1e+52)
t_2
(if (<= t_2 INFINITY)
(/ y (* (+ x 1.0) (/ t_1 z)))
(/ (+ 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 - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= 1e+52) {
tmp = t_2;
} else if (t_2 <= ((double) INFINITY)) {
tmp = y / ((x + 1.0) * (t_1 / 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 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= 1e+52) {
tmp = t_2;
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = y / ((x + 1.0) * (t_1 / z));
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= 1e+52: tmp = t_2 elif t_2 <= math.inf: tmp = y / ((x + 1.0) * (t_1 / z)) 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(Float64(x - Float64(y * z)) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= 1e+52) tmp = t_2; elseif (t_2 <= Inf) tmp = Float64(y / Float64(Float64(x + 1.0) * Float64(t_1 / 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 = (z * t) - x; t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= 1e+52) tmp = t_2; elseif (t_2 <= Inf) tmp = y / ((x + 1.0) * (t_1 / 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[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 1e+52], t$95$2, If[LessEqual[t$95$2, Infinity], N[(y / N[(N[(x + 1.0), $MachinePrecision] * N[(t$95$1 / 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 := z \cdot t - x\\
t_2 := \frac{x - \frac{x - y \cdot z}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq 10^{+52}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot \frac{t\_1}{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))) < 9.9999999999999999e51Initial program 95.5%
if 9.9999999999999999e51 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < +inf.0Initial program 52.6%
*-commutative52.6%
Simplified52.6%
Taylor expanded in y around inf 52.3%
times-frac99.5%
+-commutative99.5%
Simplified99.5%
*-commutative99.5%
clear-num99.4%
frac-times99.9%
*-un-lft-identity99.9%
fmm-def99.9%
Applied egg-rr99.9%
*-commutative99.9%
+-commutative99.9%
fmm-def99.9%
Simplified99.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 99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
Final simplification96.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.6e-47) (not (<= t 3.4e-199))) (/ (+ 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 <= -1.6e-47) || !(t <= 3.4e-199)) {
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 <= (-1.6d-47)) .or. (.not. (t <= 3.4d-199))) 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 <= -1.6e-47) || !(t <= 3.4e-199)) {
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 <= -1.6e-47) or not (t <= 3.4e-199): 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 <= -1.6e-47) || !(t <= 3.4e-199)) 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 <= -1.6e-47) || ~((t <= 3.4e-199))) 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, -1.6e-47], N[Not[LessEqual[t, 3.4e-199]], $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 -1.6 \cdot 10^{-47} \lor \neg \left(t \leq 3.4 \cdot 10^{-199}\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 < -1.6e-47 or 3.40000000000000006e-199 < t Initial program 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in z around inf 88.9%
+-commutative88.9%
+-commutative88.9%
Simplified88.9%
if -1.6e-47 < t < 3.40000000000000006e-199Initial program 89.1%
*-commutative89.1%
Simplified89.1%
clear-num89.0%
inv-pow89.0%
Applied egg-rr89.0%
unpow-189.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in t around 0 74.9%
associate-+r+74.9%
mul-1-neg74.9%
associate-*r/83.3%
unsub-neg83.3%
+-commutative83.3%
+-commutative83.3%
Simplified83.3%
div-sub83.3%
pow183.3%
pow183.3%
pow-div83.3%
metadata-eval83.3%
metadata-eval83.3%
Applied egg-rr83.3%
Final simplification87.2%
(FPCore (x y z t) :precision binary64 (if (<= x -5.5e-14) 1.0 (if (<= x 2.35e+23) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.5e-14) {
tmp = 1.0;
} else if (x <= 2.35e+23) {
tmp = (x + (y / t)) / (x + 1.0);
} 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.5d-14)) then
tmp = 1.0d0
else if (x <= 2.35d+23) then
tmp = (x + (y / t)) / (x + 1.0d0)
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.5e-14) {
tmp = 1.0;
} else if (x <= 2.35e+23) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.5e-14: tmp = 1.0 elif x <= 2.35e+23: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.5e-14) tmp = 1.0; elseif (x <= 2.35e+23) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5.5e-14) tmp = 1.0; elseif (x <= 2.35e+23) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.5e-14], 1.0, If[LessEqual[x, 2.35e+23], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-14}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.35 \cdot 10^{+23}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -5.49999999999999991e-14 or 2.3499999999999999e23 < x Initial program 88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in x around inf 89.0%
if -5.49999999999999991e-14 < x < 2.3499999999999999e23Initial program 87.3%
*-commutative87.3%
Simplified87.3%
Taylor expanded in z around inf 74.6%
+-commutative74.6%
+-commutative74.6%
Simplified74.6%
Final simplification81.6%
(FPCore (x y z t) :precision binary64 (if (<= x -1.3e-15) 1.0 (if (<= x 5.8e-38) (* y (/ z (- (* z t) x))) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.3e-15) {
tmp = 1.0;
} else if (x <= 5.8e-38) {
tmp = y * (z / ((z * t) - x));
} 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.3d-15)) then
tmp = 1.0d0
else if (x <= 5.8d-38) then
tmp = y * (z / ((z * t) - x))
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.3e-15) {
tmp = 1.0;
} else if (x <= 5.8e-38) {
tmp = y * (z / ((z * t) - x));
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.3e-15: tmp = 1.0 elif x <= 5.8e-38: tmp = y * (z / ((z * t) - x)) else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.3e-15) tmp = 1.0; elseif (x <= 5.8e-38) tmp = Float64(y * Float64(z / Float64(Float64(z * t) - x))); 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.3e-15) tmp = 1.0; elseif (x <= 5.8e-38) tmp = y * (z / ((z * t) - x)); else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.3e-15], 1.0, If[LessEqual[x, 5.8e-38], N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-15}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-38}:\\
\;\;\;\;y \cdot \frac{z}{z \cdot t - x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -1.30000000000000002e-15Initial program 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in x around inf 89.1%
if -1.30000000000000002e-15 < x < 5.79999999999999988e-38Initial program 86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in y around inf 47.9%
times-frac54.2%
+-commutative54.2%
Simplified54.2%
Taylor expanded in x around 0 54.2%
if 5.79999999999999988e-38 < x Initial program 89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in t around inf 84.5%
+-commutative84.5%
Simplified84.5%
Final simplification71.7%
(FPCore (x y z t) :precision binary64 (if (<= x -2.4e-15) 1.0 (if (<= x 2.7e-39) (/ y t) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.4e-15) {
tmp = 1.0;
} else if (x <= 2.7e-39) {
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 <= (-2.4d-15)) then
tmp = 1.0d0
else if (x <= 2.7d-39) 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 <= -2.4e-15) {
tmp = 1.0;
} else if (x <= 2.7e-39) {
tmp = y / t;
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.4e-15: tmp = 1.0 elif x <= 2.7e-39: tmp = y / t else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.4e-15) tmp = 1.0; elseif (x <= 2.7e-39) 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 <= -2.4e-15) tmp = 1.0; elseif (x <= 2.7e-39) tmp = y / t; else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.4e-15], 1.0, If[LessEqual[x, 2.7e-39], N[(y / t), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-15}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-39}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -2.39999999999999995e-15Initial program 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in x around inf 89.1%
if -2.39999999999999995e-15 < x < 2.7000000000000001e-39Initial program 86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in x around 0 53.9%
if 2.7000000000000001e-39 < x Initial program 89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in t around inf 84.5%
+-commutative84.5%
Simplified84.5%
(FPCore (x y z t) :precision binary64 (if (<= x -1.55e-15) 1.0 (if (<= x 1.7e-50) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.55e-15) {
tmp = 1.0;
} else if (x <= 1.7e-50) {
tmp = y / t;
} 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 <= (-1.55d-15)) then
tmp = 1.0d0
else if (x <= 1.7d-50) then
tmp = y / t
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 <= -1.55e-15) {
tmp = 1.0;
} else if (x <= 1.7e-50) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.55e-15: tmp = 1.0 elif x <= 1.7e-50: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.55e-15) tmp = 1.0; elseif (x <= 1.7e-50) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.55e-15) tmp = 1.0; elseif (x <= 1.7e-50) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.55e-15], 1.0, If[LessEqual[x, 1.7e-50], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-15}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-50}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.5499999999999999e-15 or 1.70000000000000007e-50 < x Initial program 88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in x around inf 83.1%
if -1.5499999999999999e-15 < x < 1.70000000000000007e-50Initial program 86.4%
*-commutative86.4%
Simplified86.4%
Taylor expanded in x around 0 54.7%
(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 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in x around inf 51.5%
(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 2024182
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(! :herbie-platform default (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1)))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))