
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (+ x 1.0))) (t_2 (- x (* z t))))
(if (<= (/ (- x (/ (- (* y z) x) t_2)) (+ x 1.0)) INFINITY)
(- (+ t_1 (/ t_1 t_2)) (* y (/ (/ z (+ x 1.0)) t_2)))
(/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double t_2 = x - (z * t);
double tmp;
if (((x - (((y * z) - x) / t_2)) / (x + 1.0)) <= ((double) INFINITY)) {
tmp = (t_1 + (t_1 / t_2)) - (y * ((z / (x + 1.0)) / t_2));
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double t_2 = x - (z * t);
double tmp;
if (((x - (((y * z) - x) / t_2)) / (x + 1.0)) <= Double.POSITIVE_INFINITY) {
tmp = (t_1 + (t_1 / t_2)) - (y * ((z / (x + 1.0)) / t_2));
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (x + 1.0) t_2 = x - (z * t) tmp = 0 if ((x - (((y * z) - x) / t_2)) / (x + 1.0)) <= math.inf: tmp = (t_1 + (t_1 / t_2)) - (y * ((z / (x + 1.0)) / t_2)) else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(x + 1.0)) t_2 = Float64(x - Float64(z * t)) tmp = 0.0 if (Float64(Float64(x - Float64(Float64(Float64(y * z) - x) / t_2)) / Float64(x + 1.0)) <= Inf) tmp = Float64(Float64(t_1 + Float64(t_1 / t_2)) - Float64(y * Float64(Float64(z / Float64(x + 1.0)) / t_2))); else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (x + 1.0); t_2 = x - (z * t); tmp = 0.0; if (((x - (((y * z) - x) / t_2)) / (x + 1.0)) <= Inf) tmp = (t_1 + (t_1 / t_2)) - (y * ((z / (x + 1.0)) / t_2)); else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x - N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(t$95$1 + N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision] - N[(y * N[(N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$2), $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}{x + 1}\\
t_2 := x - z \cdot t\\
\mathbf{if}\;\frac{x - \frac{y \cdot z - x}{t\_2}}{x + 1} \leq \infty:\\
\;\;\;\;\left(t\_1 + \frac{t\_1}{t\_2}\right) - y \cdot \frac{\frac{z}{x + 1}}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < +inf.0Initial program 92.0%
*-commutative92.0%
Simplified92.0%
Taylor expanded in y around -inf 98.4%
Taylor expanded in y around 0 92.0%
distribute-lft-out92.0%
+-commutative92.0%
*-commutative92.0%
+-commutative92.0%
associate-/l/92.0%
associate-/l*98.6%
associate-/r*99.8%
+-commutative99.8%
Simplified99.8%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x (/ (- (* y z) x) (- x (* z t)))) (+ x 1.0))))
(if (<= t_1 -2e+169)
(* y (+ (/ z (* (- (* z t) x) (+ x 1.0))) (/ 1.0 y)))
(if (<= t_1 5e+195) t_1 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (x - (((y * z) - x) / (x - (z * t)))) / (x + 1.0);
double tmp;
if (t_1 <= -2e+169) {
tmp = y * ((z / (((z * t) - x) * (x + 1.0))) + (1.0 / y));
} else if (t_1 <= 5e+195) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x - (((y * z) - x) / (x - (z * t)))) / (x + 1.0d0)
if (t_1 <= (-2d+169)) then
tmp = y * ((z / (((z * t) - x) * (x + 1.0d0))) + (1.0d0 / y))
else if (t_1 <= 5d+195) then
tmp = t_1
else
tmp = (x + (y / t)) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - (((y * z) - x) / (x - (z * t)))) / (x + 1.0);
double tmp;
if (t_1 <= -2e+169) {
tmp = y * ((z / (((z * t) - x) * (x + 1.0))) + (1.0 / y));
} else if (t_1 <= 5e+195) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - (((y * z) - x) / (x - (z * t)))) / (x + 1.0) tmp = 0 if t_1 <= -2e+169: tmp = y * ((z / (((z * t) - x) * (x + 1.0))) + (1.0 / y)) elif t_1 <= 5e+195: tmp = t_1 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(x - Float64(z * t)))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -2e+169) tmp = Float64(y * Float64(Float64(z / Float64(Float64(Float64(z * t) - x) * Float64(x + 1.0))) + Float64(1.0 / y))); elseif (t_1 <= 5e+195) tmp = t_1; 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) / (x - (z * t)))) / (x + 1.0); tmp = 0.0; if (t_1 <= -2e+169) tmp = y * ((z / (((z * t) - x) * (x + 1.0))) + (1.0 / y)); elseif (t_1 <= 5e+195) tmp = t_1; 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[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+169], N[(y * N[(N[(z / N[(N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+195], t$95$1, 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}{x - z \cdot t}}{x + 1}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+169}:\\
\;\;\;\;y \cdot \left(\frac{z}{\left(z \cdot t - x\right) \cdot \left(x + 1\right)} + \frac{1}{y}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+195}:\\
\;\;\;\;t\_1\\
\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))) < -1.99999999999999987e169Initial program 56.8%
*-commutative56.8%
Simplified56.8%
Taylor expanded in y around -inf 92.9%
Taylor expanded in x around inf 92.9%
if -1.99999999999999987e169 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 4.9999999999999998e195Initial program 99.8%
if 4.9999999999999998e195 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 46.5%
*-commutative46.5%
Simplified46.5%
Taylor expanded in z around inf 97.2%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x (/ (- (* y z) x) (- x (* z t)))) (+ x 1.0))))
(if (<= t_1 -2e+169)
(* y (/ z (* (- (* z t) x) (+ x 1.0))))
(if (<= t_1 5e+195) t_1 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (x - (((y * z) - x) / (x - (z * t)))) / (x + 1.0);
double tmp;
if (t_1 <= -2e+169) {
tmp = y * (z / (((z * t) - x) * (x + 1.0)));
} else if (t_1 <= 5e+195) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x - (((y * z) - x) / (x - (z * t)))) / (x + 1.0d0)
if (t_1 <= (-2d+169)) then
tmp = y * (z / (((z * t) - x) * (x + 1.0d0)))
else if (t_1 <= 5d+195) then
tmp = t_1
else
tmp = (x + (y / t)) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - (((y * z) - x) / (x - (z * t)))) / (x + 1.0);
double tmp;
if (t_1 <= -2e+169) {
tmp = y * (z / (((z * t) - x) * (x + 1.0)));
} else if (t_1 <= 5e+195) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - (((y * z) - x) / (x - (z * t)))) / (x + 1.0) tmp = 0 if t_1 <= -2e+169: tmp = y * (z / (((z * t) - x) * (x + 1.0))) elif t_1 <= 5e+195: tmp = t_1 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(x - Float64(z * t)))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -2e+169) tmp = Float64(y * Float64(z / Float64(Float64(Float64(z * t) - x) * Float64(x + 1.0)))); elseif (t_1 <= 5e+195) tmp = t_1; 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) / (x - (z * t)))) / (x + 1.0); tmp = 0.0; if (t_1 <= -2e+169) tmp = y * (z / (((z * t) - x) * (x + 1.0))); elseif (t_1 <= 5e+195) tmp = t_1; 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[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+169], N[(y * N[(z / N[(N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+195], t$95$1, 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}{x - z \cdot t}}{x + 1}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+169}:\\
\;\;\;\;y \cdot \frac{z}{\left(z \cdot t - x\right) \cdot \left(x + 1\right)}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+195}:\\
\;\;\;\;t\_1\\
\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))) < -1.99999999999999987e169Initial program 56.8%
*-commutative56.8%
Simplified56.8%
Taylor expanded in y around -inf 92.9%
Taylor expanded in y around inf 56.5%
mul-1-neg56.5%
associate-/l*86.4%
*-commutative86.4%
+-commutative86.4%
distribute-rgt-neg-out86.4%
distribute-neg-frac86.4%
+-commutative86.4%
*-commutative86.4%
+-commutative86.4%
Simplified86.4%
if -1.99999999999999987e169 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 4.9999999999999998e195Initial program 99.8%
if 4.9999999999999998e195 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 46.5%
*-commutative46.5%
Simplified46.5%
Taylor expanded in z around inf 97.2%
Final simplification98.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.45e-73) (not (<= t 1.3e-62))) (/ (+ x (/ y t)) (+ x 1.0)) (* y (- (/ (/ z x) (- -1.0 x)) (/ -1.0 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.45e-73) || !(t <= 1.3e-62)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = y * (((z / x) / (-1.0 - x)) - (-1.0 / y));
}
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.45d-73)) .or. (.not. (t <= 1.3d-62))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = y * (((z / x) / ((-1.0d0) - x)) - ((-1.0d0) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.45e-73) || !(t <= 1.3e-62)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = y * (((z / x) / (-1.0 - x)) - (-1.0 / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.45e-73) or not (t <= 1.3e-62): tmp = (x + (y / t)) / (x + 1.0) else: tmp = y * (((z / x) / (-1.0 - x)) - (-1.0 / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.45e-73) || !(t <= 1.3e-62)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(y * Float64(Float64(Float64(z / x) / Float64(-1.0 - x)) - Float64(-1.0 / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.45e-73) || ~((t <= 1.3e-62))) tmp = (x + (y / t)) / (x + 1.0); else tmp = y * (((z / x) / (-1.0 - x)) - (-1.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.45e-73], N[Not[LessEqual[t, 1.3e-62]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(N[(z / x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] - N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{-73} \lor \neg \left(t \leq 1.3 \cdot 10^{-62}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{\frac{z}{x}}{-1 - x} - \frac{-1}{y}\right)\\
\end{array}
\end{array}
if t < -1.45e-73 or 1.3e-62 < t Initial program 83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in z around inf 88.1%
if -1.45e-73 < t < 1.3e-62Initial program 95.3%
*-commutative95.3%
Simplified95.3%
Taylor expanded in t around 0 81.2%
associate-+r+81.2%
mul-1-neg81.2%
unsub-neg81.2%
+-commutative81.2%
associate-/l*84.0%
+-commutative84.0%
Simplified84.0%
Taylor expanded in y around -inf 83.8%
associate-*r*83.8%
neg-mul-183.8%
sub-neg83.8%
associate-/r*84.7%
+-commutative84.7%
distribute-neg-frac84.7%
metadata-eval84.7%
Simplified84.7%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.2e-79) (not (<= t 1.82e-62))) (/ (+ 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 <= -3.2e-79) || !(t <= 1.82e-62)) {
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 <= (-3.2d-79)) .or. (.not. (t <= 1.82d-62))) 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 <= -3.2e-79) || !(t <= 1.82e-62)) {
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 <= -3.2e-79) or not (t <= 1.82e-62): 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 <= -3.2e-79) || !(t <= 1.82e-62)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x + 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 <= -3.2e-79) || ~((t <= 1.82e-62))) 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, -3.2e-79], N[Not[LessEqual[t, 1.82e-62]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{-79} \lor \neg \left(t \leq 1.82 \cdot 10^{-62}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 1\right) - y \cdot \frac{z}{x}}{x + 1}\\
\end{array}
\end{array}
if t < -3.19999999999999988e-79 or 1.81999999999999999e-62 < t Initial program 83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in z around inf 88.1%
if -3.19999999999999988e-79 < t < 1.81999999999999999e-62Initial program 95.3%
*-commutative95.3%
Simplified95.3%
Taylor expanded in t around 0 81.2%
associate-+r+81.2%
mul-1-neg81.2%
unsub-neg81.2%
+-commutative81.2%
associate-/l*84.0%
+-commutative84.0%
Simplified84.0%
Final simplification86.4%
(FPCore (x y z t)
:precision binary64
(if (<= x -7e-28)
1.0
(if (<= x 1.4e-114)
(/ y t)
(if (<= x 3900000.0) (- 1.0 (/ (* y z) x)) (+ 1.0 (/ -1.0 x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7e-28) {
tmp = 1.0;
} else if (x <= 1.4e-114) {
tmp = y / t;
} else if (x <= 3900000.0) {
tmp = 1.0 - ((y * z) / x);
} else {
tmp = 1.0 + (-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 <= (-7d-28)) then
tmp = 1.0d0
else if (x <= 1.4d-114) then
tmp = y / t
else if (x <= 3900000.0d0) then
tmp = 1.0d0 - ((y * z) / x)
else
tmp = 1.0d0 + ((-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 <= -7e-28) {
tmp = 1.0;
} else if (x <= 1.4e-114) {
tmp = y / t;
} else if (x <= 3900000.0) {
tmp = 1.0 - ((y * z) / x);
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7e-28: tmp = 1.0 elif x <= 1.4e-114: tmp = y / t elif x <= 3900000.0: tmp = 1.0 - ((y * z) / x) else: tmp = 1.0 + (-1.0 / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7e-28) tmp = 1.0; elseif (x <= 1.4e-114) tmp = Float64(y / t); elseif (x <= 3900000.0) tmp = Float64(1.0 - Float64(Float64(y * z) / x)); else tmp = Float64(1.0 + Float64(-1.0 / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7e-28) tmp = 1.0; elseif (x <= 1.4e-114) tmp = y / t; elseif (x <= 3900000.0) tmp = 1.0 - ((y * z) / x); else tmp = 1.0 + (-1.0 / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7e-28], 1.0, If[LessEqual[x, 1.4e-114], N[(y / t), $MachinePrecision], If[LessEqual[x, 3900000.0], N[(1.0 - N[(N[(y * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-28}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-114}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 3900000:\\
\;\;\;\;1 - \frac{y \cdot z}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if x < -6.9999999999999999e-28Initial program 85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in t around inf 85.6%
+-commutative85.6%
Simplified85.6%
Taylor expanded in x around inf 87.7%
if -6.9999999999999999e-28 < x < 1.4000000000000001e-114Initial program 89.5%
*-commutative89.5%
Simplified89.5%
Taylor expanded in t around -inf 80.0%
mul-1-neg80.0%
unsub-neg80.0%
cancel-sign-sub-inv80.0%
metadata-eval80.0%
*-lft-identity80.0%
+-commutative80.0%
mul-1-neg80.0%
unsub-neg80.0%
Simplified80.0%
Taylor expanded in x around 0 56.7%
if 1.4000000000000001e-114 < x < 3.9e6Initial program 85.4%
*-commutative85.4%
Simplified85.4%
Taylor expanded in t around 0 59.3%
associate-+r+59.3%
mul-1-neg59.3%
unsub-neg59.3%
+-commutative59.3%
associate-/l*59.5%
+-commutative59.5%
Simplified59.5%
Taylor expanded in y around 0 59.3%
associate-*r/59.3%
mul-1-neg59.3%
distribute-rgt-neg-out59.3%
+-commutative59.3%
Simplified59.3%
Taylor expanded in x around 0 56.2%
if 3.9e6 < x Initial program 90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in t around inf 81.5%
+-commutative81.5%
Simplified81.5%
Taylor expanded in x around inf 81.5%
Final simplification70.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.2e-73) (not (<= t 1.35e-62))) (/ (+ 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.2e-73) || !(t <= 1.35e-62)) {
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.2d-73)) .or. (.not. (t <= 1.35d-62))) 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.2e-73) || !(t <= 1.35e-62)) {
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.2e-73) or not (t <= 1.35e-62): 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.2e-73) || !(t <= 1.35e-62)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(Float64(y * z) / Float64(x * Float64(-1.0 - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.2e-73) || ~((t <= 1.35e-62))) 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.2e-73], N[Not[LessEqual[t, 1.35e-62]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * z), $MachinePrecision] / N[(x * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{-73} \lor \neg \left(t \leq 1.35 \cdot 10^{-62}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot z}{x \cdot \left(-1 - x\right)}\\
\end{array}
\end{array}
if t < -1.20000000000000003e-73 or 1.3500000000000001e-62 < t Initial program 83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in z around inf 88.1%
if -1.20000000000000003e-73 < t < 1.3500000000000001e-62Initial program 95.3%
*-commutative95.3%
Simplified95.3%
Taylor expanded in t around 0 81.2%
associate-+r+81.2%
mul-1-neg81.2%
unsub-neg81.2%
+-commutative81.2%
associate-/l*84.0%
+-commutative84.0%
Simplified84.0%
Taylor expanded in y around 0 81.1%
associate-*r/81.1%
mul-1-neg81.1%
distribute-rgt-neg-out81.1%
+-commutative81.1%
Simplified81.1%
Final simplification85.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5e-86) (not (<= t 8.8e-63))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (/ (* y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5e-86) || !(t <= 8.8e-63)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y * z) / 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 <= (-5d-86)) .or. (.not. (t <= 8.8d-63))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((y * z) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5e-86) || !(t <= 8.8e-63)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y * z) / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5e-86) or not (t <= 8.8e-63): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((y * z) / x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5e-86) || !(t <= 8.8e-63)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y * z) / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5e-86) || ~((t <= 8.8e-63))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((y * z) / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5e-86], N[Not[LessEqual[t, 8.8e-63]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-86} \lor \neg \left(t \leq 8.8 \cdot 10^{-63}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y \cdot z}{x}\\
\end{array}
\end{array}
if t < -4.9999999999999999e-86 or 8.7999999999999998e-63 < t Initial program 83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in z around inf 88.1%
if -4.9999999999999999e-86 < t < 8.7999999999999998e-63Initial program 95.3%
*-commutative95.3%
Simplified95.3%
Taylor expanded in t around 0 81.2%
associate-+r+81.2%
mul-1-neg81.2%
unsub-neg81.2%
+-commutative81.2%
associate-/l*84.0%
+-commutative84.0%
Simplified84.0%
Taylor expanded in y around 0 81.1%
associate-*r/81.1%
mul-1-neg81.1%
distribute-rgt-neg-out81.1%
+-commutative81.1%
Simplified81.1%
Taylor expanded in x around 0 74.9%
Final simplification82.8%
(FPCore (x y z t) :precision binary64 (if (<= x -2.8e-29) 1.0 (if (<= x 3.7e-30) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.8e-29) {
tmp = 1.0;
} else if (x <= 3.7e-30) {
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 <= (-2.8d-29)) then
tmp = 1.0d0
else if (x <= 3.7d-30) 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 <= -2.8e-29) {
tmp = 1.0;
} else if (x <= 3.7e-30) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.8e-29: tmp = 1.0 elif x <= 3.7e-30: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.8e-29) tmp = 1.0; elseif (x <= 3.7e-30) 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 <= -2.8e-29) tmp = 1.0; elseif (x <= 3.7e-30) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.8e-29], 1.0, If[LessEqual[x, 3.7e-30], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{-29}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{-30}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.8000000000000002e-29 or 3.7000000000000003e-30 < x Initial program 88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in t around inf 78.9%
+-commutative78.9%
Simplified78.9%
Taylor expanded in x around inf 82.1%
if -2.8000000000000002e-29 < x < 3.7000000000000003e-30Initial program 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in t around -inf 74.9%
mul-1-neg74.9%
unsub-neg74.9%
cancel-sign-sub-inv74.9%
metadata-eval74.9%
*-lft-identity74.9%
+-commutative74.9%
mul-1-neg74.9%
unsub-neg74.9%
Simplified74.9%
Taylor expanded in x around 0 52.2%
(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 88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in t around inf 50.1%
+-commutative50.1%
Simplified50.1%
Taylor expanded in x around inf 50.2%
(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 88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in y around -inf 96.6%
Taylor expanded in x around inf 50.1%
add-sqr-sqrt0.0%
sqrt-unprod2.6%
sqr-neg2.6%
mul-1-neg2.6%
mul-1-neg2.6%
sqrt-unprod2.6%
add-sqr-sqrt2.6%
associate-*r*2.6%
frac-2neg2.6%
metadata-eval2.6%
un-div-inv2.6%
neg-mul-12.6%
Applied egg-rr2.6%
Taylor expanded in y around 0 2.6%
(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 2024135
(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)))