
(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 12 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)))
(if (<= (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0)) INFINITY)
(/ (+ (/ y (/ t_1 z)) (- x (/ x t_1))) (+ x 1.0))
(-
(+ (/ y (* t (+ x 1.0))) (/ x (+ x 1.0)))
(/ x (* (* z t) (+ x 1.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double tmp;
if (((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= ((double) INFINITY)) {
tmp = ((y / (t_1 / z)) + (x - (x / t_1))) / (x + 1.0);
} else {
tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / ((z * 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 tmp;
if (((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= Double.POSITIVE_INFINITY) {
tmp = ((y / (t_1 / z)) + (x - (x / t_1))) / (x + 1.0);
} else {
tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / ((z * t) * (x + 1.0)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x tmp = 0 if ((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= math.inf: tmp = ((y / (t_1 / z)) + (x - (x / t_1))) / (x + 1.0) else: tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / ((z * t) * (x + 1.0))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) tmp = 0.0 if (Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) <= Inf) tmp = Float64(Float64(Float64(y / Float64(t_1 / z)) + Float64(x - Float64(x / t_1))) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(y / Float64(t * Float64(x + 1.0))) + Float64(x / Float64(x + 1.0))) - Float64(x / Float64(Float64(z * t) * Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; tmp = 0.0; if (((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= Inf) tmp = ((y / (t_1 / z)) + (x - (x / t_1))) / (x + 1.0); else tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / ((z * 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]}, If[LessEqual[N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(y / N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] + N[(x - N[(x / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(z * t), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
\mathbf{if}\;\frac{x + \frac{y \cdot z - x}{t_1}}{x + 1} \leq \infty:\\
\;\;\;\;\frac{\frac{y}{\frac{t_1}{z}} + \left(x - \frac{x}{t_1}\right)}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y}{t \cdot \left(x + 1\right)} + \frac{x}{x + 1}\right) - \frac{x}{\left(z \cdot t\right) \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < +inf.0Initial program 94.4%
*-commutative94.4%
Simplified94.4%
+-commutative94.4%
div-sub94.5%
associate-+l-94.5%
associate-/l*98.1%
Applied egg-rr98.1%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in t around inf 100.0%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.25e+125) (not (<= z 6.4e+134))) (- (+ (/ y (* t (+ x 1.0))) (/ x (+ x 1.0))) (/ x (* (* z t) (+ x 1.0)))) (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.25e+125) || !(z <= 6.4e+134)) {
tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / ((z * t) * (x + 1.0)));
} else {
tmp = (x + (((y * z) - x) / ((z * t) - 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 ((z <= (-3.25d+125)) .or. (.not. (z <= 6.4d+134))) then
tmp = ((y / (t * (x + 1.0d0))) + (x / (x + 1.0d0))) - (x / ((z * t) * (x + 1.0d0)))
else
tmp = (x + (((y * z) - x) / ((z * t) - 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 ((z <= -3.25e+125) || !(z <= 6.4e+134)) {
tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / ((z * t) * (x + 1.0)));
} else {
tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.25e+125) or not (z <= 6.4e+134): tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / ((z * t) * (x + 1.0))) else: tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.25e+125) || !(z <= 6.4e+134)) tmp = Float64(Float64(Float64(y / Float64(t * Float64(x + 1.0))) + Float64(x / Float64(x + 1.0))) - Float64(x / Float64(Float64(z * t) * Float64(x + 1.0)))); else tmp = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.25e+125) || ~((z <= 6.4e+134))) tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / ((z * t) * (x + 1.0))); else tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.25e+125], N[Not[LessEqual[z, 6.4e+134]], $MachinePrecision]], N[(N[(N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(z * t), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.25 \cdot 10^{+125} \lor \neg \left(z \leq 6.4 \cdot 10^{+134}\right):\\
\;\;\;\;\left(\frac{y}{t \cdot \left(x + 1\right)} + \frac{x}{x + 1}\right) - \frac{x}{\left(z \cdot t\right) \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -3.2499999999999999e125 or 6.4000000000000001e134 < z Initial program 64.8%
*-commutative64.8%
Simplified64.8%
Taylor expanded in t around inf 95.1%
if -3.2499999999999999e125 < z < 6.4000000000000001e134Initial program 98.4%
Final simplification97.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.2e+125) (not (<= z 1.9e+140))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.2e+125) || !(z <= 1.9e+140)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (((y * z) - x) / ((z * t) - 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 ((z <= (-3.2d+125)) .or. (.not. (z <= 1.9d+140))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + (((y * z) - x) / ((z * t) - 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 ((z <= -3.2e+125) || !(z <= 1.9e+140)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.2e+125) or not (z <= 1.9e+140): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.2e+125) || !(z <= 1.9e+140)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.2e+125) || ~((z <= 1.9e+140))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.2e+125], N[Not[LessEqual[z, 1.9e+140]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+125} \lor \neg \left(z \leq 1.9 \cdot 10^{+140}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -3.19999999999999983e125 or 1.9e140 < z Initial program 65.6%
*-commutative65.6%
Simplified65.6%
Taylor expanded in z around inf 95.0%
if -3.19999999999999983e125 < z < 1.9e140Initial program 97.9%
Final simplification97.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (+ x 1.0))) (t_2 (* y (/ z (- (* z t) x)))))
(if (<= x -1.8e-84)
t_1
(if (<= x 4.1e-157)
t_2
(if (<= x 7.2e-35) 1.0 (if (<= x 5e-12) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double t_2 = y * (z / ((z * t) - x));
double tmp;
if (x <= -1.8e-84) {
tmp = t_1;
} else if (x <= 4.1e-157) {
tmp = t_2;
} else if (x <= 7.2e-35) {
tmp = 1.0;
} else if (x <= 5e-12) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x / (x + 1.0d0)
t_2 = y * (z / ((z * t) - x))
if (x <= (-1.8d-84)) then
tmp = t_1
else if (x <= 4.1d-157) then
tmp = t_2
else if (x <= 7.2d-35) then
tmp = 1.0d0
else if (x <= 5d-12) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double t_2 = y * (z / ((z * t) - x));
double tmp;
if (x <= -1.8e-84) {
tmp = t_1;
} else if (x <= 4.1e-157) {
tmp = t_2;
} else if (x <= 7.2e-35) {
tmp = 1.0;
} else if (x <= 5e-12) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (x + 1.0) t_2 = y * (z / ((z * t) - x)) tmp = 0 if x <= -1.8e-84: tmp = t_1 elif x <= 4.1e-157: tmp = t_2 elif x <= 7.2e-35: tmp = 1.0 elif x <= 5e-12: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(x + 1.0)) t_2 = Float64(y * Float64(z / Float64(Float64(z * t) - x))) tmp = 0.0 if (x <= -1.8e-84) tmp = t_1; elseif (x <= 4.1e-157) tmp = t_2; elseif (x <= 7.2e-35) tmp = 1.0; elseif (x <= 5e-12) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (x + 1.0); t_2 = y * (z / ((z * t) - x)); tmp = 0.0; if (x <= -1.8e-84) tmp = t_1; elseif (x <= 4.1e-157) tmp = t_2; elseif (x <= 7.2e-35) tmp = 1.0; elseif (x <= 5e-12) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.8e-84], t$95$1, If[LessEqual[x, 4.1e-157], t$95$2, If[LessEqual[x, 7.2e-35], 1.0, If[LessEqual[x, 5e-12], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
t_2 := y \cdot \frac{z}{z \cdot t - x}\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{-84}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-157}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-35}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-12}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.80000000000000002e-84 or 4.9999999999999997e-12 < x Initial program 87.3%
*-commutative87.3%
Simplified87.3%
Taylor expanded in t around inf 81.6%
+-commutative81.6%
Simplified81.6%
if -1.80000000000000002e-84 < x < 4.1000000000000002e-157 or 7.20000000000000038e-35 < x < 4.9999999999999997e-12Initial program 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in y around inf 58.8%
*-commutative58.8%
*-commutative58.8%
times-frac61.4%
+-commutative61.4%
*-commutative61.4%
Simplified61.4%
Taylor expanded in x around 0 61.4%
if 4.1000000000000002e-157 < x < 7.20000000000000038e-35Initial program 86.4%
*-commutative86.4%
Simplified86.4%
+-commutative86.4%
div-sub86.4%
associate-+l-86.4%
associate-/l*90.0%
Applied egg-rr90.0%
Taylor expanded in z around 0 50.6%
Final simplification71.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z (- (* z t) x)))))
(if (<= x -1.85e-84)
(/ x (+ x 1.0))
(if (<= x 4.1e-157)
t_1
(if (<= x 9.6e-34)
1.0
(if (<= x 1.6e-21) t_1 (- 1.0 (/ y (/ (* x x) z)))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / ((z * t) - x));
double tmp;
if (x <= -1.85e-84) {
tmp = x / (x + 1.0);
} else if (x <= 4.1e-157) {
tmp = t_1;
} else if (x <= 9.6e-34) {
tmp = 1.0;
} else if (x <= 1.6e-21) {
tmp = t_1;
} else {
tmp = 1.0 - (y / ((x * x) / z));
}
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) :: t_1
real(8) :: tmp
t_1 = y * (z / ((z * t) - x))
if (x <= (-1.85d-84)) then
tmp = x / (x + 1.0d0)
else if (x <= 4.1d-157) then
tmp = t_1
else if (x <= 9.6d-34) then
tmp = 1.0d0
else if (x <= 1.6d-21) then
tmp = t_1
else
tmp = 1.0d0 - (y / ((x * x) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z / ((z * t) - x));
double tmp;
if (x <= -1.85e-84) {
tmp = x / (x + 1.0);
} else if (x <= 4.1e-157) {
tmp = t_1;
} else if (x <= 9.6e-34) {
tmp = 1.0;
} else if (x <= 1.6e-21) {
tmp = t_1;
} else {
tmp = 1.0 - (y / ((x * x) / z));
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / ((z * t) - x)) tmp = 0 if x <= -1.85e-84: tmp = x / (x + 1.0) elif x <= 4.1e-157: tmp = t_1 elif x <= 9.6e-34: tmp = 1.0 elif x <= 1.6e-21: tmp = t_1 else: tmp = 1.0 - (y / ((x * x) / z)) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / Float64(Float64(z * t) - x))) tmp = 0.0 if (x <= -1.85e-84) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 4.1e-157) tmp = t_1; elseif (x <= 9.6e-34) tmp = 1.0; elseif (x <= 1.6e-21) tmp = t_1; else tmp = Float64(1.0 - Float64(y / Float64(Float64(x * x) / z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / ((z * t) - x)); tmp = 0.0; if (x <= -1.85e-84) tmp = x / (x + 1.0); elseif (x <= 4.1e-157) tmp = t_1; elseif (x <= 9.6e-34) tmp = 1.0; elseif (x <= 1.6e-21) tmp = t_1; else tmp = 1.0 - (y / ((x * x) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.85e-84], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.1e-157], t$95$1, If[LessEqual[x, 9.6e-34], 1.0, If[LessEqual[x, 1.6e-21], t$95$1, N[(1.0 - N[(y / N[(N[(x * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{z \cdot t - x}\\
\mathbf{if}\;x \leq -1.85 \cdot 10^{-84}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-157}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{-34}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-21}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{\frac{x \cdot x}{z}}\\
\end{array}
\end{array}
if x < -1.85e-84Initial program 91.4%
*-commutative91.4%
Simplified91.4%
Taylor expanded in t around inf 83.7%
+-commutative83.7%
Simplified83.7%
if -1.85e-84 < x < 4.1000000000000002e-157 or 9.59999999999999965e-34 < x < 1.6000000000000001e-21Initial program 88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in y around inf 58.5%
*-commutative58.5%
*-commutative58.5%
times-frac61.2%
+-commutative61.2%
*-commutative61.2%
Simplified61.2%
Taylor expanded in x around 0 61.2%
if 4.1000000000000002e-157 < x < 9.59999999999999965e-34Initial program 86.4%
*-commutative86.4%
Simplified86.4%
+-commutative86.4%
div-sub86.4%
associate-+l-86.4%
associate-/l*90.0%
Applied egg-rr90.0%
Taylor expanded in z around 0 50.6%
if 1.6000000000000001e-21 < x Initial program 81.6%
*-commutative81.6%
Simplified81.6%
Taylor expanded in t around 0 72.6%
+-commutative72.6%
mul-1-neg72.6%
unsub-neg72.6%
associate-/l*79.2%
+-commutative79.2%
Simplified79.2%
Taylor expanded in x around inf 72.2%
mul-1-neg72.2%
unsub-neg72.2%
associate-/l*79.3%
unpow279.3%
Simplified79.3%
Final simplification72.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x)))
(if (<= x -1.45e-84)
(/ x (+ x 1.0))
(if (<= x 3.6e-157)
(/ y (/ t_1 z))
(if (<= x 1.35e-36)
1.0
(if (<= x 1.15e-19) (* y (/ z t_1)) (- 1.0 (/ y (/ (* x x) z)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double tmp;
if (x <= -1.45e-84) {
tmp = x / (x + 1.0);
} else if (x <= 3.6e-157) {
tmp = y / (t_1 / z);
} else if (x <= 1.35e-36) {
tmp = 1.0;
} else if (x <= 1.15e-19) {
tmp = y * (z / t_1);
} else {
tmp = 1.0 - (y / ((x * x) / z));
}
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) :: t_1
real(8) :: tmp
t_1 = (z * t) - x
if (x <= (-1.45d-84)) then
tmp = x / (x + 1.0d0)
else if (x <= 3.6d-157) then
tmp = y / (t_1 / z)
else if (x <= 1.35d-36) then
tmp = 1.0d0
else if (x <= 1.15d-19) then
tmp = y * (z / t_1)
else
tmp = 1.0d0 - (y / ((x * x) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double tmp;
if (x <= -1.45e-84) {
tmp = x / (x + 1.0);
} else if (x <= 3.6e-157) {
tmp = y / (t_1 / z);
} else if (x <= 1.35e-36) {
tmp = 1.0;
} else if (x <= 1.15e-19) {
tmp = y * (z / t_1);
} else {
tmp = 1.0 - (y / ((x * x) / z));
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x tmp = 0 if x <= -1.45e-84: tmp = x / (x + 1.0) elif x <= 3.6e-157: tmp = y / (t_1 / z) elif x <= 1.35e-36: tmp = 1.0 elif x <= 1.15e-19: tmp = y * (z / t_1) else: tmp = 1.0 - (y / ((x * x) / z)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) tmp = 0.0 if (x <= -1.45e-84) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 3.6e-157) tmp = Float64(y / Float64(t_1 / z)); elseif (x <= 1.35e-36) tmp = 1.0; elseif (x <= 1.15e-19) tmp = Float64(y * Float64(z / t_1)); else tmp = Float64(1.0 - Float64(y / Float64(Float64(x * x) / z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; tmp = 0.0; if (x <= -1.45e-84) tmp = x / (x + 1.0); elseif (x <= 3.6e-157) tmp = y / (t_1 / z); elseif (x <= 1.35e-36) tmp = 1.0; elseif (x <= 1.15e-19) tmp = y * (z / t_1); else tmp = 1.0 - (y / ((x * x) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, If[LessEqual[x, -1.45e-84], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.6e-157], N[(y / N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.35e-36], 1.0, If[LessEqual[x, 1.15e-19], N[(y * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(y / N[(N[(x * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
\mathbf{if}\;x \leq -1.45 \cdot 10^{-84}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-157}:\\
\;\;\;\;\frac{y}{\frac{t_1}{z}}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-36}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-19}:\\
\;\;\;\;y \cdot \frac{z}{t_1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{\frac{x \cdot x}{z}}\\
\end{array}
\end{array}
if x < -1.4500000000000001e-84Initial program 91.4%
*-commutative91.4%
Simplified91.4%
Taylor expanded in t around inf 83.7%
+-commutative83.7%
Simplified83.7%
if -1.4500000000000001e-84 < x < 3.6e-157Initial program 88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in y around inf 56.2%
*-commutative56.2%
*-commutative56.2%
times-frac59.0%
+-commutative59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in x around 0 59.0%
Taylor expanded in y around 0 56.2%
fma-neg56.2%
associate-/l*59.2%
fma-neg59.2%
Simplified59.2%
if 3.6e-157 < x < 1.35000000000000004e-36Initial program 86.4%
*-commutative86.4%
Simplified86.4%
+-commutative86.4%
div-sub86.4%
associate-+l-86.4%
associate-/l*90.0%
Applied egg-rr90.0%
Taylor expanded in z around 0 50.6%
if 1.35000000000000004e-36 < x < 1.1499999999999999e-19Initial program 99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in y around inf 99.2%
*-commutative99.2%
*-commutative99.2%
times-frac99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in x around 0 99.6%
if 1.1499999999999999e-19 < x Initial program 81.6%
*-commutative81.6%
Simplified81.6%
Taylor expanded in t around 0 72.6%
+-commutative72.6%
mul-1-neg72.6%
unsub-neg72.6%
associate-/l*79.2%
+-commutative79.2%
Simplified79.2%
Taylor expanded in x around inf 72.2%
mul-1-neg72.2%
unsub-neg72.2%
associate-/l*79.3%
unpow279.3%
Simplified79.3%
Final simplification72.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.5e-39) (not (<= t 5.9e-36))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ (- x (/ y (/ x z))) 1.0) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.5e-39) || !(t <= 5.9e-36)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((x - (y / (x / z))) + 1.0) / (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 <= (-3.5d-39)) .or. (.not. (t <= 5.9d-36))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = ((x - (y / (x / z))) + 1.0d0) / (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 <= -3.5e-39) || !(t <= 5.9e-36)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((x - (y / (x / z))) + 1.0) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.5e-39) or not (t <= 5.9e-36): tmp = (x + (y / t)) / (x + 1.0) else: tmp = ((x - (y / (x / z))) + 1.0) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.5e-39) || !(t <= 5.9e-36)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x - Float64(y / Float64(x / z))) + 1.0) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.5e-39) || ~((t <= 5.9e-36))) tmp = (x + (y / t)) / (x + 1.0); else tmp = ((x - (y / (x / z))) + 1.0) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.5e-39], N[Not[LessEqual[t, 5.9e-36]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \cdot 10^{-39} \lor \neg \left(t \leq 5.9 \cdot 10^{-36}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - \frac{y}{\frac{x}{z}}\right) + 1}{x + 1}\\
\end{array}
\end{array}
if t < -3.5e-39 or 5.89999999999999995e-36 < t Initial program 83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in z around inf 92.0%
if -3.5e-39 < t < 5.89999999999999995e-36Initial program 93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in t around 0 78.1%
+-commutative78.1%
mul-1-neg78.1%
unsub-neg78.1%
associate-/l*82.7%
+-commutative82.7%
Simplified82.7%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.2e-113) (not (<= t 1.32e-176))) (/ (+ x (/ y t)) (+ x 1.0)) (+ (* (/ z x) (/ (- t y) x)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.2e-113) || !(t <= 1.32e-176)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((z / x) * ((t - y) / 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 <= (-6.2d-113)) .or. (.not. (t <= 1.32d-176))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = ((z / x) * ((t - y) / 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 <= -6.2e-113) || !(t <= 1.32e-176)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((z / x) * ((t - y) / x)) + 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.2e-113) or not (t <= 1.32e-176): tmp = (x + (y / t)) / (x + 1.0) else: tmp = ((z / x) * ((t - y) / x)) + 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.2e-113) || !(t <= 1.32e-176)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(z / x) * Float64(Float64(t - y) / x)) + 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -6.2e-113) || ~((t <= 1.32e-176))) tmp = (x + (y / t)) / (x + 1.0); else tmp = ((z / x) * ((t - y) / x)) + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.2e-113], N[Not[LessEqual[t, 1.32e-176]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / x), $MachinePrecision] * N[(N[(t - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-113} \lor \neg \left(t \leq 1.32 \cdot 10^{-176}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{x} \cdot \frac{t - y}{x} + 1\\
\end{array}
\end{array}
if t < -6.20000000000000024e-113 or 1.32e-176 < t Initial program 84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in z around inf 86.7%
if -6.20000000000000024e-113 < t < 1.32e-176Initial program 95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in x around -inf 61.1%
mul-1-neg61.1%
unsub-neg61.1%
distribute-rgt-out--61.1%
unpow261.1%
times-frac65.3%
Simplified65.3%
Final simplification80.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.9e-109) (not (<= t 2.1e-182))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (/ y (/ (* x x) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.9e-109) || !(t <= 2.1e-182)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - (y / ((x * x) / z));
}
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.9d-109)) .or. (.not. (t <= 2.1d-182))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - (y / ((x * x) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.9e-109) || !(t <= 2.1e-182)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - (y / ((x * x) / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.9e-109) or not (t <= 2.1e-182): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - (y / ((x * x) / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.9e-109) || !(t <= 2.1e-182)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(y / Float64(Float64(x * x) / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.9e-109) || ~((t <= 2.1e-182))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - (y / ((x * x) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.9e-109], N[Not[LessEqual[t, 2.1e-182]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(y / N[(N[(x * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{-109} \lor \neg \left(t \leq 2.1 \cdot 10^{-182}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{\frac{x \cdot x}{z}}\\
\end{array}
\end{array}
if t < -1.90000000000000001e-109 or 2.1e-182 < t Initial program 84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in z around inf 86.7%
if -1.90000000000000001e-109 < t < 2.1e-182Initial program 95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in t around 0 83.0%
+-commutative83.0%
mul-1-neg83.0%
unsub-neg83.0%
associate-/l*86.9%
+-commutative86.9%
Simplified86.9%
Taylor expanded in x around inf 61.2%
mul-1-neg61.2%
unsub-neg61.2%
associate-/l*62.6%
unpow262.6%
Simplified62.6%
Final simplification79.8%
(FPCore (x y z t) :precision binary64 (if (<= x -0.0066) 1.0 (if (<= x 1.6e-111) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.0066) {
tmp = 1.0;
} else if (x <= 1.6e-111) {
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 <= (-0.0066d0)) then
tmp = 1.0d0
else if (x <= 1.6d-111) 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 <= -0.0066) {
tmp = 1.0;
} else if (x <= 1.6e-111) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.0066: tmp = 1.0 elif x <= 1.6e-111: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.0066) tmp = 1.0; elseif (x <= 1.6e-111) 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 <= -0.0066) tmp = 1.0; elseif (x <= 1.6e-111) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.0066], 1.0, If[LessEqual[x, 1.6e-111], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0066:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-111}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -0.0066 or 1.5999999999999999e-111 < x Initial program 87.2%
*-commutative87.2%
Simplified87.2%
+-commutative87.2%
div-sub87.2%
associate-+l-87.2%
associate-/l*95.6%
Applied egg-rr95.6%
Taylor expanded in z around 0 80.0%
if -0.0066 < x < 1.5999999999999999e-111Initial program 88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in z around inf 71.4%
Taylor expanded in y around inf 46.2%
Taylor expanded in x around 0 46.2%
Final simplification66.7%
(FPCore (x y z t) :precision binary64 (if (<= x -1.8e-114) (/ x (+ x 1.0)) (if (<= x 9e-111) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.8e-114) {
tmp = x / (x + 1.0);
} else if (x <= 9e-111) {
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.8d-114)) then
tmp = x / (x + 1.0d0)
else if (x <= 9d-111) 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.8e-114) {
tmp = x / (x + 1.0);
} else if (x <= 9e-111) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.8e-114: tmp = x / (x + 1.0) elif x <= 9e-111: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.8e-114) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 9e-111) 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.8e-114) tmp = x / (x + 1.0); elseif (x <= 9e-111) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.8e-114], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9e-111], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-114}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-111}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.80000000000000009e-114Initial program 91.7%
*-commutative91.7%
Simplified91.7%
Taylor expanded in t around inf 81.3%
+-commutative81.3%
Simplified81.3%
if -1.80000000000000009e-114 < x < 8.99999999999999987e-111Initial program 88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in z around inf 71.3%
Taylor expanded in y around inf 51.6%
Taylor expanded in x around 0 51.6%
if 8.99999999999999987e-111 < x Initial program 82.7%
*-commutative82.7%
Simplified82.7%
+-commutative82.7%
div-sub82.7%
associate-+l-82.7%
associate-/l*92.8%
Applied egg-rr92.8%
Taylor expanded in z around 0 67.9%
Final simplification67.8%
(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%
+-commutative87.8%
div-sub87.8%
associate-+l-87.8%
associate-/l*93.7%
Applied egg-rr93.7%
Taylor expanded in z around 0 54.3%
Final simplification54.3%
(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 2023200
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))