
(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 (if (or (<= z -2.9e-36) (not (<= z 6.2e-53))) (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)) (/ (+ x (/ (- (* z y) x) (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.9e-36) || !(z <= 6.2e-53)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x + (((z * y) - 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 <= (-2.9d-36)) .or. (.not. (z <= 6.2d-53))) then
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
else
tmp = (x + (((z * y) - 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 <= -2.9e-36) || !(z <= 6.2e-53)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.9e-36) or not (z <= 6.2e-53): tmp = (x + (y / (t - (x / z)))) / (x + 1.0) else: tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.9e-36) || !(z <= 6.2e-53)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(Float64(z * y) - 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 <= -2.9e-36) || ~((z <= 6.2e-53))) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); else tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.9e-36], N[Not[LessEqual[z, 6.2e-53]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(N[(z * y), $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 -2.9 \cdot 10^{-36} \lor \neg \left(z \leq 6.2 \cdot 10^{-53}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{z \cdot y - x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -2.90000000000000013e-36 or 6.20000000000000031e-53 < z Initial program 78.7%
*-commutative78.7%
Simplified78.7%
Taylor expanded in y around inf 78.7%
associate-/l*93.0%
*-commutative93.0%
*-commutative93.0%
fma-neg93.0%
Simplified93.0%
Taylor expanded in t around 0 99.3%
mul-1-neg99.3%
unsub-neg99.3%
Simplified99.3%
if -2.90000000000000013e-36 < z < 6.20000000000000031e-53Initial program 99.9%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(if (<= x -6.6e-17)
(/ x (+ x 1.0))
(if (<= x 4.5e-90)
(/ y t)
(if (<= x 2e-32)
(- 1.0 (* z (/ y x)))
(if (<= x 5.2e-20) (/ y t) (/ 1.0 (+ 1.0 (/ 1.0 x))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.6e-17) {
tmp = x / (x + 1.0);
} else if (x <= 4.5e-90) {
tmp = y / t;
} else if (x <= 2e-32) {
tmp = 1.0 - (z * (y / x));
} else if (x <= 5.2e-20) {
tmp = y / t;
} else {
tmp = 1.0 / (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 <= (-6.6d-17)) then
tmp = x / (x + 1.0d0)
else if (x <= 4.5d-90) then
tmp = y / t
else if (x <= 2d-32) then
tmp = 1.0d0 - (z * (y / x))
else if (x <= 5.2d-20) then
tmp = y / t
else
tmp = 1.0d0 / (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 <= -6.6e-17) {
tmp = x / (x + 1.0);
} else if (x <= 4.5e-90) {
tmp = y / t;
} else if (x <= 2e-32) {
tmp = 1.0 - (z * (y / x));
} else if (x <= 5.2e-20) {
tmp = y / t;
} else {
tmp = 1.0 / (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.6e-17: tmp = x / (x + 1.0) elif x <= 4.5e-90: tmp = y / t elif x <= 2e-32: tmp = 1.0 - (z * (y / x)) elif x <= 5.2e-20: tmp = y / t else: tmp = 1.0 / (1.0 + (1.0 / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.6e-17) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 4.5e-90) tmp = Float64(y / t); elseif (x <= 2e-32) tmp = Float64(1.0 - Float64(z * Float64(y / x))); elseif (x <= 5.2e-20) tmp = Float64(y / t); else tmp = Float64(1.0 / Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.6e-17) tmp = x / (x + 1.0); elseif (x <= 4.5e-90) tmp = y / t; elseif (x <= 2e-32) tmp = 1.0 - (z * (y / x)); elseif (x <= 5.2e-20) tmp = y / t; else tmp = 1.0 / (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.6e-17], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.5e-90], N[(y / t), $MachinePrecision], If[LessEqual[x, 2e-32], N[(1.0 - N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.2e-20], N[(y / t), $MachinePrecision], N[(1.0 / N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.6 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-90}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-32}:\\
\;\;\;\;1 - z \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-20}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \frac{1}{x}}\\
\end{array}
\end{array}
if x < -6.60000000000000001e-17Initial program 88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in t around inf 85.5%
+-commutative85.5%
Simplified85.5%
if -6.60000000000000001e-17 < x < 4.50000000000000009e-90 or 2.00000000000000011e-32 < x < 5.1999999999999999e-20Initial program 87.5%
*-commutative87.5%
Simplified87.5%
Taylor expanded in y around inf 53.0%
Taylor expanded in x around 0 41.1%
times-frac52.0%
pow152.0%
pow152.0%
pow-div52.0%
metadata-eval52.0%
metadata-eval52.0%
Applied egg-rr52.0%
if 4.50000000000000009e-90 < x < 2.00000000000000011e-32Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 71.8%
Taylor expanded in y around inf 68.9%
associate-*r/68.9%
mul-1-neg68.9%
+-commutative68.9%
Simplified68.9%
Taylor expanded in x around 0 68.9%
associate-*r/68.9%
neg-mul-168.9%
Simplified68.9%
if 5.1999999999999999e-20 < x Initial program 84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in t around inf 85.6%
+-commutative85.6%
Simplified85.6%
clear-num85.6%
+-commutative85.6%
inv-pow85.6%
+-commutative85.6%
Applied egg-rr85.6%
unpow-185.6%
Simplified85.6%
Taylor expanded in x around 0 85.6%
Final simplification71.4%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.14e-14)
(/ x (+ x 1.0))
(if (<= x 1.15e-88)
(/ y t)
(if (<= x 1.35e-37)
(+ 1.0 (* z (/ (- t y) x)))
(if (<= x 3.4e-20) (/ y t) (/ 1.0 (+ 1.0 (/ 1.0 x))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.14e-14) {
tmp = x / (x + 1.0);
} else if (x <= 1.15e-88) {
tmp = y / t;
} else if (x <= 1.35e-37) {
tmp = 1.0 + (z * ((t - y) / x));
} else if (x <= 3.4e-20) {
tmp = y / t;
} else {
tmp = 1.0 / (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 <= (-1.14d-14)) then
tmp = x / (x + 1.0d0)
else if (x <= 1.15d-88) then
tmp = y / t
else if (x <= 1.35d-37) then
tmp = 1.0d0 + (z * ((t - y) / x))
else if (x <= 3.4d-20) then
tmp = y / t
else
tmp = 1.0d0 / (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 <= -1.14e-14) {
tmp = x / (x + 1.0);
} else if (x <= 1.15e-88) {
tmp = y / t;
} else if (x <= 1.35e-37) {
tmp = 1.0 + (z * ((t - y) / x));
} else if (x <= 3.4e-20) {
tmp = y / t;
} else {
tmp = 1.0 / (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.14e-14: tmp = x / (x + 1.0) elif x <= 1.15e-88: tmp = y / t elif x <= 1.35e-37: tmp = 1.0 + (z * ((t - y) / x)) elif x <= 3.4e-20: tmp = y / t else: tmp = 1.0 / (1.0 + (1.0 / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.14e-14) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 1.15e-88) tmp = Float64(y / t); elseif (x <= 1.35e-37) tmp = Float64(1.0 + Float64(z * Float64(Float64(t - y) / x))); elseif (x <= 3.4e-20) tmp = Float64(y / t); else tmp = Float64(1.0 / Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.14e-14) tmp = x / (x + 1.0); elseif (x <= 1.15e-88) tmp = y / t; elseif (x <= 1.35e-37) tmp = 1.0 + (z * ((t - y) / x)); elseif (x <= 3.4e-20) tmp = y / t; else tmp = 1.0 / (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.14e-14], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.15e-88], N[(y / t), $MachinePrecision], If[LessEqual[x, 1.35e-37], N[(1.0 + N[(z * N[(N[(t - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.4e-20], N[(y / t), $MachinePrecision], N[(1.0 / N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.14 \cdot 10^{-14}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-88}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-37}:\\
\;\;\;\;1 + z \cdot \frac{t - y}{x}\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-20}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \frac{1}{x}}\\
\end{array}
\end{array}
if x < -1.1400000000000001e-14Initial program 88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in t around inf 85.5%
+-commutative85.5%
Simplified85.5%
if -1.1400000000000001e-14 < x < 1.14999999999999993e-88 or 1.35000000000000008e-37 < x < 3.3999999999999997e-20Initial program 87.5%
*-commutative87.5%
Simplified87.5%
Taylor expanded in y around inf 53.0%
Taylor expanded in x around 0 41.1%
times-frac52.0%
pow152.0%
pow152.0%
pow-div52.0%
metadata-eval52.0%
metadata-eval52.0%
Applied egg-rr52.0%
if 1.14999999999999993e-88 < x < 1.35000000000000008e-37Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 71.8%
Taylor expanded in x around 0 71.8%
mul-1-neg71.8%
sub-neg71.8%
Simplified71.8%
if 3.3999999999999997e-20 < x Initial program 84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in t around inf 85.6%
+-commutative85.6%
Simplified85.6%
clear-num85.6%
+-commutative85.6%
inv-pow85.6%
+-commutative85.6%
Applied egg-rr85.6%
unpow-185.6%
Simplified85.6%
Taylor expanded in x around 0 85.6%
Final simplification71.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.8e-153) (not (<= z 4.4e-217))) (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)) (+ 1.0 (/ (* z (- t y)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e-153) || !(z <= 4.4e-217)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = 1.0 + ((z * (t - y)) / x);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.8d-153)) .or. (.not. (z <= 4.4d-217))) then
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
else
tmp = 1.0d0 + ((z * (t - y)) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e-153) || !(z <= 4.4e-217)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = 1.0 + ((z * (t - y)) / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.8e-153) or not (z <= 4.4e-217): tmp = (x + (y / (t - (x / z)))) / (x + 1.0) else: tmp = 1.0 + ((z * (t - y)) / x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.8e-153) || !(z <= 4.4e-217)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(Float64(z * Float64(t - y)) / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.8e-153) || ~((z <= 4.4e-217))) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); else tmp = 1.0 + ((z * (t - y)) / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.8e-153], N[Not[LessEqual[z, 4.4e-217]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(z * N[(t - y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-153} \lor \neg \left(z \leq 4.4 \cdot 10^{-217}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{z \cdot \left(t - y\right)}{x}\\
\end{array}
\end{array}
if z < -1.7999999999999999e-153 or 4.39999999999999964e-217 < z Initial program 84.4%
*-commutative84.4%
Simplified84.4%
Taylor expanded in y around inf 79.5%
associate-/l*90.0%
*-commutative90.0%
*-commutative90.0%
fma-neg90.0%
Simplified90.0%
Taylor expanded in t around 0 94.7%
mul-1-neg94.7%
unsub-neg94.7%
Simplified94.7%
if -1.7999999999999999e-153 < z < 4.39999999999999964e-217Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 83.3%
Taylor expanded in x around 0 87.4%
associate-/l*83.3%
mul-1-neg83.3%
sub-neg83.3%
Simplified83.3%
Taylor expanded in z around 0 87.4%
Final simplification93.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.2e-83) (not (<= z 9.5e-220))) (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)) (/ (- x (/ x (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.2e-83) || !(z <= 9.5e-220)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x - (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 <= (-7.2d-83)) .or. (.not. (z <= 9.5d-220))) then
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
else
tmp = (x - (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 <= -7.2e-83) || !(z <= 9.5e-220)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.2e-83) or not (z <= 9.5e-220): tmp = (x + (y / (t - (x / z)))) / (x + 1.0) else: tmp = (x - (x / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.2e-83) || !(z <= 9.5e-220)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(Float64(x - Float64(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 <= -7.2e-83) || ~((z <= 9.5e-220))) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); else tmp = (x - (x / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.2e-83], N[Not[LessEqual[z, 9.5e-220]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(x / 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 -7.2 \cdot 10^{-83} \lor \neg \left(z \leq 9.5 \cdot 10^{-220}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -7.20000000000000025e-83 or 9.50000000000000062e-220 < z Initial program 83.4%
*-commutative83.4%
Simplified83.4%
Taylor expanded in y around inf 79.9%
associate-/l*91.0%
*-commutative91.0%
*-commutative91.0%
fma-neg91.0%
Simplified91.0%
Taylor expanded in t around 0 96.0%
mul-1-neg96.0%
unsub-neg96.0%
Simplified96.0%
if -7.20000000000000025e-83 < z < 9.50000000000000062e-220Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 89.8%
Final simplification94.5%
(FPCore (x y z t) :precision binary64 (if (<= x -5.1e+35) 1.0 (if (<= x 300000.0) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.1e+35) {
tmp = 1.0;
} else if (x <= 300000.0) {
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.1d+35)) then
tmp = 1.0d0
else if (x <= 300000.0d0) 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.1e+35) {
tmp = 1.0;
} else if (x <= 300000.0) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.1e+35: tmp = 1.0 elif x <= 300000.0: 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.1e+35) tmp = 1.0; elseif (x <= 300000.0) 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.1e+35) tmp = 1.0; elseif (x <= 300000.0) 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.1e+35], 1.0, If[LessEqual[x, 300000.0], 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.1 \cdot 10^{+35}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 300000:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -5.10000000000000017e35 or 3e5 < x Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in y around inf 87.7%
associate-/l*97.5%
*-commutative97.5%
*-commutative97.5%
fma-neg97.5%
Simplified97.5%
Taylor expanded in x around inf 91.6%
if -5.10000000000000017e35 < x < 3e5Initial program 86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in z around inf 70.0%
Final simplification80.1%
(FPCore (x y z t) :precision binary64 (if (<= x -2.8e+81) (/ (- x (/ y (/ x z))) (+ x 1.0)) (if (<= x 270000.0) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.8e+81) {
tmp = (x - (y / (x / z))) / (x + 1.0);
} else if (x <= 270000.0) {
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 <= (-2.8d+81)) then
tmp = (x - (y / (x / z))) / (x + 1.0d0)
else if (x <= 270000.0d0) 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 <= -2.8e+81) {
tmp = (x - (y / (x / z))) / (x + 1.0);
} else if (x <= 270000.0) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.8e+81: tmp = (x - (y / (x / z))) / (x + 1.0) elif x <= 270000.0: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.8e+81) tmp = Float64(Float64(x - Float64(y / Float64(x / z))) / Float64(x + 1.0)); elseif (x <= 270000.0) 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 <= -2.8e+81) tmp = (x - (y / (x / z))) / (x + 1.0); elseif (x <= 270000.0) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.8e+81], N[(N[(x - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 270000.0], 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 -2.8 \cdot 10^{+81}:\\
\;\;\;\;\frac{x - \frac{y}{\frac{x}{z}}}{x + 1}\\
\mathbf{elif}\;x \leq 270000:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.79999999999999995e81Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in y around inf 91.0%
associate-/l*100.0%
*-commutative100.0%
*-commutative100.0%
fma-neg100.0%
Simplified100.0%
Taylor expanded in t around 0 91.0%
mul-1-neg91.0%
unsub-neg91.0%
associate-/l*97.8%
+-commutative97.8%
Simplified97.8%
if -2.79999999999999995e81 < x < 2.7e5Initial program 86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in z around inf 71.2%
if 2.7e5 < x Initial program 85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in y around inf 83.9%
associate-/l*95.6%
*-commutative95.6%
*-commutative95.6%
fma-neg95.6%
Simplified95.6%
Taylor expanded in x around inf 89.2%
Final simplification80.4%
(FPCore (x y z t) :precision binary64 (if (<= x -6.3e-15) (/ x (+ x 1.0)) (if (<= x 8.8e-82) (/ y t) (/ 1.0 (+ 1.0 (/ 1.0 x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.3e-15) {
tmp = x / (x + 1.0);
} else if (x <= 8.8e-82) {
tmp = y / t;
} else {
tmp = 1.0 / (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 <= (-6.3d-15)) then
tmp = x / (x + 1.0d0)
else if (x <= 8.8d-82) then
tmp = y / t
else
tmp = 1.0d0 / (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 <= -6.3e-15) {
tmp = x / (x + 1.0);
} else if (x <= 8.8e-82) {
tmp = y / t;
} else {
tmp = 1.0 / (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.3e-15: tmp = x / (x + 1.0) elif x <= 8.8e-82: tmp = y / t else: tmp = 1.0 / (1.0 + (1.0 / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.3e-15) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 8.8e-82) tmp = Float64(y / t); else tmp = Float64(1.0 / Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.3e-15) tmp = x / (x + 1.0); elseif (x <= 8.8e-82) tmp = y / t; else tmp = 1.0 / (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.3e-15], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.8e-82], N[(y / t), $MachinePrecision], N[(1.0 / N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.3 \cdot 10^{-15}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-82}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \frac{1}{x}}\\
\end{array}
\end{array}
if x < -6.29999999999999982e-15Initial program 88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in t around inf 85.5%
+-commutative85.5%
Simplified85.5%
if -6.29999999999999982e-15 < x < 8.79999999999999943e-82Initial program 87.3%
*-commutative87.3%
Simplified87.3%
Taylor expanded in y around inf 53.0%
Taylor expanded in x around 0 41.0%
times-frac52.0%
pow152.0%
pow152.0%
pow-div52.0%
metadata-eval52.0%
metadata-eval52.0%
Applied egg-rr52.0%
if 8.79999999999999943e-82 < x Initial program 85.9%
*-commutative85.9%
Simplified85.9%
Taylor expanded in t around inf 78.2%
+-commutative78.2%
Simplified78.2%
clear-num78.2%
+-commutative78.2%
inv-pow78.2%
+-commutative78.2%
Applied egg-rr78.2%
unpow-178.2%
Simplified78.2%
Taylor expanded in x around 0 78.3%
Final simplification69.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e-17) (not (<= x 2.55e-82))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e-17) || !(x <= 2.55e-82)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-7.2d-17)) .or. (.not. (x <= 2.55d-82))) then
tmp = x / (x + 1.0d0)
else
tmp = y / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e-17) || !(x <= 2.55e-82)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.2e-17) or not (x <= 2.55e-82): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.2e-17) || !(x <= 2.55e-82)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.2e-17) || ~((x <= 2.55e-82))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.2e-17], N[Not[LessEqual[x, 2.55e-82]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-17} \lor \neg \left(x \leq 2.55 \cdot 10^{-82}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -7.1999999999999999e-17 or 2.54999999999999996e-82 < x Initial program 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in t around inf 81.5%
+-commutative81.5%
Simplified81.5%
if -7.1999999999999999e-17 < x < 2.54999999999999996e-82Initial program 87.3%
*-commutative87.3%
Simplified87.3%
Taylor expanded in y around inf 53.0%
Taylor expanded in x around 0 41.0%
times-frac52.0%
pow152.0%
pow152.0%
pow-div52.0%
metadata-eval52.0%
metadata-eval52.0%
Applied egg-rr52.0%
Final simplification69.8%
(FPCore (x y z t) :precision binary64 (if (<= x -1.65e-22) 1.0 (if (<= x 0.18) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.65e-22) {
tmp = 1.0;
} else if (x <= 0.18) {
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.65d-22)) then
tmp = 1.0d0
else if (x <= 0.18d0) 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.65e-22) {
tmp = 1.0;
} else if (x <= 0.18) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.65e-22: tmp = 1.0 elif x <= 0.18: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.65e-22) tmp = 1.0; elseif (x <= 0.18) 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.65e-22) tmp = 1.0; elseif (x <= 0.18) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.65e-22], 1.0, If[LessEqual[x, 0.18], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-22}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 0.18:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.65e-22 or 0.17999999999999999 < x Initial program 86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in y around inf 83.5%
associate-/l*93.3%
*-commutative93.3%
*-commutative93.3%
fma-neg93.3%
Simplified93.3%
Taylor expanded in x around inf 85.9%
if -1.65e-22 < x < 0.17999999999999999Initial program 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in y around inf 52.5%
Taylor expanded in x around 0 38.6%
times-frac48.0%
pow148.0%
pow148.0%
pow-div48.0%
metadata-eval48.0%
metadata-eval48.0%
Applied egg-rr48.0%
Final simplification68.9%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in y around inf 77.7%
associate-/l*86.2%
*-commutative86.2%
*-commutative86.2%
fma-neg86.2%
Simplified86.2%
Taylor expanded in x around inf 53.5%
Final simplification53.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 2024011
(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)))