
(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 8 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 (<= z -2.8e+151)
(/ (+ x (/ y t)) (+ x 1.0))
(if (<= z 4.2e+58)
(/ (+ x (/ 1.0 (/ (- (* z t) x) (- (* z y) x)))) (+ x 1.0))
(-
(+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0))))
(/ x (* t (* z (+ x 1.0))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+151) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (z <= 4.2e+58) {
tmp = (x + (1.0 / (((z * t) - x) / ((z * y) - x)))) / (x + 1.0);
} else {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (x + 1.0))));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2.8d+151)) then
tmp = (x + (y / t)) / (x + 1.0d0)
else if (z <= 4.2d+58) then
tmp = (x + (1.0d0 / (((z * t) - x) / ((z * y) - x)))) / (x + 1.0d0)
else
tmp = ((x / (x + 1.0d0)) + (y / (t * (x + 1.0d0)))) - (x / (t * (z * (x + 1.0d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+151) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (z <= 4.2e+58) {
tmp = (x + (1.0 / (((z * t) - x) / ((z * y) - x)))) / (x + 1.0);
} else {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (x + 1.0))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.8e+151: tmp = (x + (y / t)) / (x + 1.0) elif z <= 4.2e+58: tmp = (x + (1.0 / (((z * t) - x) / ((z * y) - x)))) / (x + 1.0) else: tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (x + 1.0)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e+151) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); elseif (z <= 4.2e+58) tmp = Float64(Float64(x + Float64(1.0 / Float64(Float64(Float64(z * t) - x) / Float64(Float64(z * y) - x)))) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x / Float64(x + 1.0)) + Float64(y / Float64(t * Float64(x + 1.0)))) - Float64(x / Float64(t * Float64(z * Float64(x + 1.0))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.8e+151) tmp = (x + (y / t)) / (x + 1.0); elseif (z <= 4.2e+58) tmp = (x + (1.0 / (((z * t) - x) / ((z * y) - x)))) / (x + 1.0); else tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (x + 1.0)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e+151], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+58], N[(N[(x + N[(1.0 / N[(N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(t * N[(z * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+151}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+58}:\\
\;\;\;\;\frac{x + \frac{1}{\frac{z \cdot t - x}{z \cdot y - x}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\right) - \frac{x}{t \cdot \left(z \cdot \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if z < -2.79999999999999987e151Initial program 69.7%
*-commutative69.7%
Simplified69.7%
Taylor expanded in z around inf 92.0%
if -2.79999999999999987e151 < z < 4.20000000000000024e58Initial program 99.2%
*-commutative99.2%
Simplified99.2%
clear-num99.2%
inv-pow99.2%
fma-neg99.2%
Applied egg-rr99.2%
unpow-199.2%
*-commutative99.2%
fma-neg99.2%
*-commutative99.2%
Simplified99.2%
if 4.20000000000000024e58 < z Initial program 86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in t around inf 94.8%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.7e+153) (not (<= z 6.2e+55))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (/ 1.0 (/ (- (* z t) x) (- (* z y) x)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e+153) || !(z <= 6.2e+55)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (1.0 / (((z * t) - x) / ((z * y) - 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 <= (-1.7d+153)) .or. (.not. (z <= 6.2d+55))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + (1.0d0 / (((z * t) - x) / ((z * y) - 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 <= -1.7e+153) || !(z <= 6.2e+55)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (1.0 / (((z * t) - x) / ((z * y) - x)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.7e+153) or not (z <= 6.2e+55): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (1.0 / (((z * t) - x) / ((z * y) - x)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.7e+153) || !(z <= 6.2e+55)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(1.0 / Float64(Float64(Float64(z * t) - x) / Float64(Float64(z * y) - x)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.7e+153) || ~((z <= 6.2e+55))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (1.0 / (((z * t) - x) / ((z * y) - x)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.7e+153], N[Not[LessEqual[z, 6.2e+55]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(1.0 / N[(N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{+153} \lor \neg \left(z \leq 6.2 \cdot 10^{+55}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{1}{\frac{z \cdot t - x}{z \cdot y - x}}}{x + 1}\\
\end{array}
\end{array}
if z < -1.6999999999999999e153 or 6.19999999999999987e55 < z Initial program 78.6%
*-commutative78.6%
Simplified78.6%
Taylor expanded in z around inf 93.4%
if -1.6999999999999999e153 < z < 6.19999999999999987e55Initial program 99.2%
*-commutative99.2%
Simplified99.2%
clear-num99.2%
inv-pow99.2%
fma-neg99.2%
Applied egg-rr99.2%
unpow-199.2%
*-commutative99.2%
fma-neg99.2%
*-commutative99.2%
Simplified99.2%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.18e+151) (not (<= z 3.6e+58))) (/ (+ x (/ y t)) (+ 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 <= -1.18e+151) || !(z <= 3.6e+58)) {
tmp = (x + (y / t)) / (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 <= (-1.18d+151)) .or. (.not. (z <= 3.6d+58))) then
tmp = (x + (y / t)) / (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 <= -1.18e+151) || !(z <= 3.6e+58)) {
tmp = (x + (y / t)) / (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 <= -1.18e+151) or not (z <= 3.6e+58): tmp = (x + (y / t)) / (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 <= -1.18e+151) || !(z <= 3.6e+58)) tmp = Float64(Float64(x + Float64(y / t)) / 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 <= -1.18e+151) || ~((z <= 3.6e+58))) tmp = (x + (y / t)) / (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, -1.18e+151], N[Not[LessEqual[z, 3.6e+58]], $MachinePrecision]], N[(N[(x + N[(y / t), $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 -1.18 \cdot 10^{+151} \lor \neg \left(z \leq 3.6 \cdot 10^{+58}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{z \cdot y - x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -1.18000000000000005e151 or 3.59999999999999996e58 < z Initial program 78.6%
*-commutative78.6%
Simplified78.6%
Taylor expanded in z around inf 93.4%
if -1.18000000000000005e151 < z < 3.59999999999999996e58Initial program 99.2%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.6e-129) (not (<= t 3.1e-142))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (/ (* y (/ z x)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.6e-129) || !(t <= 3.1e-142)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 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 <= (-7.6d-129)) .or. (.not. (t <= 3.1d-142))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 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 <= -7.6e-129) || !(t <= 3.1e-142)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y * (z / x)) / (x + 1.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.6e-129) or not (t <= 3.1e-142): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((y * (z / x)) / (x + 1.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.6e-129) || !(t <= 3.1e-142)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(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 <= -7.6e-129) || ~((t <= 3.1e-142))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((y * (z / x)) / (x + 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.6e-129], N[Not[LessEqual[t, 3.1e-142]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.6 \cdot 10^{-129} \lor \neg \left(t \leq 3.1 \cdot 10^{-142}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y \cdot \frac{z}{x}}{x + 1}\\
\end{array}
\end{array}
if t < -7.59999999999999969e-129 or 3.1e-142 < t Initial program 89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in z around inf 88.6%
if -7.59999999999999969e-129 < t < 3.1e-142Initial program 94.9%
*-commutative94.9%
Simplified94.9%
Taylor expanded in t around 0 74.2%
associate-+r+74.2%
mul-1-neg74.2%
unsub-neg74.2%
+-commutative74.2%
associate-/l*77.9%
+-commutative77.9%
Simplified77.9%
Taylor expanded in y around 0 73.8%
mul-1-neg73.8%
associate-/r*74.2%
associate-*r/78.0%
+-commutative78.0%
sub-neg78.0%
Simplified78.0%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 (if (<= x -2.3e-10) 1.0 (if (<= x 2.3e+58) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e-10) {
tmp = 1.0;
} else if (x <= 2.3e+58) {
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.3d-10)) then
tmp = 1.0d0
else if (x <= 2.3d+58) 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.3e-10) {
tmp = 1.0;
} else if (x <= 2.3e+58) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.3e-10: tmp = 1.0 elif x <= 2.3e+58: 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.3e-10) tmp = 1.0; elseif (x <= 2.3e+58) 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.3e-10) tmp = 1.0; elseif (x <= 2.3e+58) 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.3e-10], 1.0, If[LessEqual[x, 2.3e+58], 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.3 \cdot 10^{-10}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+58}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.30000000000000007e-10 or 2.30000000000000002e58 < x Initial program 89.4%
*-commutative89.4%
Simplified89.4%
clear-num89.4%
inv-pow89.4%
fma-neg89.4%
Applied egg-rr89.4%
unpow-189.4%
*-commutative89.4%
fma-neg89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in z around inf 76.5%
Taylor expanded in x around inf 93.8%
if -2.30000000000000007e-10 < x < 2.30000000000000002e58Initial program 92.0%
*-commutative92.0%
Simplified92.0%
Taylor expanded in z around inf 76.8%
Final simplification84.8%
(FPCore (x y z t) :precision binary64 (if (<= x -1.4e-13) 1.0 (if (<= x 6.6e-76) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.4e-13) {
tmp = 1.0;
} else if (x <= 6.6e-76) {
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.4d-13)) then
tmp = 1.0d0
else if (x <= 6.6d-76) 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.4e-13) {
tmp = 1.0;
} else if (x <= 6.6e-76) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.4e-13: tmp = 1.0 elif x <= 6.6e-76: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.4e-13) tmp = 1.0; elseif (x <= 6.6e-76) 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.4e-13) tmp = 1.0; elseif (x <= 6.6e-76) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.4e-13], 1.0, If[LessEqual[x, 6.6e-76], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-13}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-76}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.4000000000000001e-13 or 6.59999999999999967e-76 < x Initial program 89.0%
*-commutative89.0%
Simplified89.0%
clear-num89.0%
inv-pow89.0%
fma-neg89.0%
Applied egg-rr89.0%
unpow-189.0%
*-commutative89.0%
fma-neg89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in z around inf 74.3%
Taylor expanded in x around inf 86.1%
if -1.4000000000000001e-13 < x < 6.59999999999999967e-76Initial program 93.1%
*-commutative93.1%
Simplified93.1%
clear-num93.0%
inv-pow93.0%
fma-neg93.0%
Applied egg-rr93.0%
unpow-193.0%
*-commutative93.0%
fma-neg93.0%
*-commutative93.0%
Simplified93.0%
Taylor expanded in x around 0 65.9%
Final simplification77.1%
(FPCore (x y z t) :precision binary64 (if (<= x -7.8e-72) 1.0 (if (<= x 1.9e-99) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.8e-72) {
tmp = 1.0;
} else if (x <= 1.9e-99) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-7.8d-72)) then
tmp = 1.0d0
else if (x <= 1.9d-99) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.8e-72) {
tmp = 1.0;
} else if (x <= 1.9e-99) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.8e-72: tmp = 1.0 elif x <= 1.9e-99: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.8e-72) tmp = 1.0; elseif (x <= 1.9e-99) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.8e-72) tmp = 1.0; elseif (x <= 1.9e-99) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.8e-72], 1.0, If[LessEqual[x, 1.9e-99], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-72}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-99}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.8e-72 or 1.8999999999999998e-99 < x Initial program 89.9%
*-commutative89.9%
Simplified89.9%
clear-num89.9%
inv-pow89.9%
fma-neg89.9%
Applied egg-rr89.9%
unpow-189.9%
*-commutative89.9%
fma-neg89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in z around inf 72.7%
Taylor expanded in x around inf 81.6%
if -7.8e-72 < x < 1.8999999999999998e-99Initial program 92.2%
*-commutative92.2%
Simplified92.2%
Taylor expanded in t around inf 17.5%
+-commutative17.5%
Simplified17.5%
Taylor expanded in x around 0 17.5%
Final simplification56.5%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 90.8%
*-commutative90.8%
Simplified90.8%
clear-num90.8%
inv-pow90.8%
fma-neg90.8%
Applied egg-rr90.8%
unpow-190.8%
*-commutative90.8%
fma-neg90.8%
*-commutative90.8%
Simplified90.8%
Taylor expanded in z around inf 76.6%
Taylor expanded in x around inf 52.8%
Final simplification52.8%
(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 2023306
(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)))