
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
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) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
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) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
(FPCore (x y z t) :precision binary64 (fma x (/ 1.0 y) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
return fma(x, (1.0 / y), (-2.0 + ((2.0 + (2.0 / z)) / t)));
}
function code(x, y, z, t) return fma(x, Float64(1.0 / y), Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t))) end
code[x_, y_, z_, t_] := N[(x * N[(1.0 / y), $MachinePrecision] + N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \frac{1}{y}, -2 + \frac{2 + \frac{2}{z}}{t}\right)
\end{array}
Initial program 89.7%
sub-neg89.7%
distribute-rgt-in89.7%
*-lft-identity89.7%
associate-+r+89.7%
cancel-sign-sub-inv89.7%
div-sub80.3%
associate-*r*80.3%
associate-*l/80.3%
*-inverses99.0%
metadata-eval99.0%
sub-neg99.0%
metadata-eval99.0%
metadata-eval99.0%
+-commutative99.0%
metadata-eval99.0%
associate-/l/99.1%
Simplified99.1%
div-inv99.0%
fma-def99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -10000.0)
(+ (/ x y) (+ -2.0 (/ 2.0 t)))
(if (<= (/ x y) 2e+15)
(+ (/ 2.0 t) (- (/ 2.0 (* z t)) 2.0))
(+ (/ x y) (/ 2.0 t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -10000.0) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else if ((x / y) <= 2e+15) {
tmp = (2.0 / t) + ((2.0 / (z * t)) - 2.0);
} else {
tmp = (x / y) + (2.0 / 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 / y) <= (-10000.0d0)) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
else if ((x / y) <= 2d+15) then
tmp = (2.0d0 / t) + ((2.0d0 / (z * t)) - 2.0d0)
else
tmp = (x / y) + (2.0d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -10000.0) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else if ((x / y) <= 2e+15) {
tmp = (2.0 / t) + ((2.0 / (z * t)) - 2.0);
} else {
tmp = (x / y) + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -10000.0: tmp = (x / y) + (-2.0 + (2.0 / t)) elif (x / y) <= 2e+15: tmp = (2.0 / t) + ((2.0 / (z * t)) - 2.0) else: tmp = (x / y) + (2.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -10000.0) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); elseif (Float64(x / y) <= 2e+15) tmp = Float64(Float64(2.0 / t) + Float64(Float64(2.0 / Float64(z * t)) - 2.0)); else tmp = Float64(Float64(x / y) + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -10000.0) tmp = (x / y) + (-2.0 + (2.0 / t)); elseif ((x / y) <= 2e+15) tmp = (2.0 / t) + ((2.0 / (z * t)) - 2.0); else tmp = (x / y) + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -10000.0], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e+15], N[(N[(2.0 / t), $MachinePrecision] + N[(N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -10000:\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+15}:\\
\;\;\;\;\frac{2}{t} + \left(\frac{2}{z \cdot t} - 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -1e4Initial program 83.9%
sub-neg83.9%
distribute-rgt-in83.9%
*-lft-identity83.9%
associate-+r+83.9%
cancel-sign-sub-inv83.9%
div-sub79.9%
associate-*r*79.9%
associate-*l/79.9%
*-inverses97.2%
metadata-eval97.2%
sub-neg97.2%
metadata-eval97.2%
metadata-eval97.2%
+-commutative97.2%
metadata-eval97.2%
associate-/l/97.2%
Simplified97.2%
Taylor expanded in z around inf 76.6%
associate--l+76.6%
sub-neg76.6%
associate-*r/76.6%
metadata-eval76.6%
metadata-eval76.6%
Simplified76.6%
if -1e4 < (/.f64 x y) < 2e15Initial program 94.6%
sub-neg94.6%
distribute-rgt-in94.6%
*-lft-identity94.6%
associate-+r+94.6%
cancel-sign-sub-inv94.6%
div-sub79.2%
associate-*r*79.2%
associate-*l/79.2%
*-inverses99.7%
metadata-eval99.7%
sub-neg99.7%
metadata-eval99.7%
metadata-eval99.7%
+-commutative99.7%
metadata-eval99.7%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in x around 0 98.8%
associate--l+98.8%
associate-*r/98.8%
metadata-eval98.8%
associate-*r/98.8%
metadata-eval98.8%
Simplified98.8%
if 2e15 < (/.f64 x y) Initial program 87.4%
Taylor expanded in t around 0 99.9%
Taylor expanded in z around inf 92.4%
associate-*r/92.4%
metadata-eval92.4%
Simplified92.4%
Final simplification90.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= z -1.4e-132)
t_1
(if (<= z 1.4e-22)
(/ 2.0 (* z t))
(if (or (<= z 3e+47) (and (not (<= z 6.6e+198)) (<= z 2.1e+258)))
t_1
(+ -2.0 (/ 2.0 t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (z <= -1.4e-132) {
tmp = t_1;
} else if (z <= 1.4e-22) {
tmp = 2.0 / (z * t);
} else if ((z <= 3e+47) || (!(z <= 6.6e+198) && (z <= 2.1e+258))) {
tmp = t_1;
} else {
tmp = -2.0 + (2.0 / 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) :: t_1
real(8) :: tmp
t_1 = (x / y) - 2.0d0
if (z <= (-1.4d-132)) then
tmp = t_1
else if (z <= 1.4d-22) then
tmp = 2.0d0 / (z * t)
else if ((z <= 3d+47) .or. (.not. (z <= 6.6d+198)) .and. (z <= 2.1d+258)) then
tmp = t_1
else
tmp = (-2.0d0) + (2.0d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (z <= -1.4e-132) {
tmp = t_1;
} else if (z <= 1.4e-22) {
tmp = 2.0 / (z * t);
} else if ((z <= 3e+47) || (!(z <= 6.6e+198) && (z <= 2.1e+258))) {
tmp = t_1;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if z <= -1.4e-132: tmp = t_1 elif z <= 1.4e-22: tmp = 2.0 / (z * t) elif (z <= 3e+47) or (not (z <= 6.6e+198) and (z <= 2.1e+258)): tmp = t_1 else: tmp = -2.0 + (2.0 / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (z <= -1.4e-132) tmp = t_1; elseif (z <= 1.4e-22) tmp = Float64(2.0 / Float64(z * t)); elseif ((z <= 3e+47) || (!(z <= 6.6e+198) && (z <= 2.1e+258))) tmp = t_1; else tmp = Float64(-2.0 + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (z <= -1.4e-132) tmp = t_1; elseif (z <= 1.4e-22) tmp = 2.0 / (z * t); elseif ((z <= 3e+47) || (~((z <= 6.6e+198)) && (z <= 2.1e+258))) tmp = t_1; else tmp = -2.0 + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[z, -1.4e-132], t$95$1, If[LessEqual[z, 1.4e-22], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 3e+47], And[N[Not[LessEqual[z, 6.6e+198]], $MachinePrecision], LessEqual[z, 2.1e+258]]], t$95$1, N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{-132}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-22}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+47} \lor \neg \left(z \leq 6.6 \cdot 10^{+198}\right) \land z \leq 2.1 \cdot 10^{+258}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if z < -1.40000000000000001e-132 or 1.39999999999999997e-22 < z < 3.0000000000000001e47 or 6.59999999999999988e198 < z < 2.09999999999999997e258Initial program 84.8%
sub-neg84.8%
distribute-rgt-in84.8%
*-lft-identity84.8%
associate-+r+84.8%
cancel-sign-sub-inv84.8%
div-sub83.2%
associate-*r*83.2%
associate-*l/83.2%
*-inverses99.1%
metadata-eval99.1%
sub-neg99.1%
metadata-eval99.1%
metadata-eval99.1%
+-commutative99.1%
metadata-eval99.1%
associate-/l/99.2%
Simplified99.2%
Taylor expanded in t around inf 74.1%
if -1.40000000000000001e-132 < z < 1.39999999999999997e-22Initial program 98.6%
sub-neg98.6%
distribute-rgt-in98.6%
*-lft-identity98.6%
associate-+r+98.6%
cancel-sign-sub-inv98.6%
div-sub72.4%
associate-*r*72.4%
associate-*l/72.4%
*-inverses98.6%
metadata-eval98.6%
sub-neg98.6%
metadata-eval98.6%
metadata-eval98.6%
+-commutative98.6%
metadata-eval98.6%
associate-/l/98.6%
Simplified98.6%
Taylor expanded in z around 0 77.7%
if 3.0000000000000001e47 < z < 6.59999999999999988e198 or 2.09999999999999997e258 < z Initial program 86.7%
sub-neg86.7%
distribute-rgt-in86.7%
*-lft-identity86.7%
associate-+r+86.7%
cancel-sign-sub-inv86.7%
div-sub86.7%
associate-*r*86.7%
associate-*l/86.7%
*-inverses99.8%
metadata-eval99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
metadata-eval99.8%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
associate--l+100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 76.6%
sub-neg76.6%
metadata-eval76.6%
associate-*r/76.6%
metadata-eval76.6%
Simplified76.6%
Final simplification75.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= z -1.6e-137)
t_1
(if (<= z 2.2e-21)
(/ (/ 2.0 t) z)
(if (or (<= z 3e+54) (and (not (<= z 2.05e+199)) (<= z 1.2e+256)))
t_1
(+ -2.0 (/ 2.0 t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (z <= -1.6e-137) {
tmp = t_1;
} else if (z <= 2.2e-21) {
tmp = (2.0 / t) / z;
} else if ((z <= 3e+54) || (!(z <= 2.05e+199) && (z <= 1.2e+256))) {
tmp = t_1;
} else {
tmp = -2.0 + (2.0 / 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) :: t_1
real(8) :: tmp
t_1 = (x / y) - 2.0d0
if (z <= (-1.6d-137)) then
tmp = t_1
else if (z <= 2.2d-21) then
tmp = (2.0d0 / t) / z
else if ((z <= 3d+54) .or. (.not. (z <= 2.05d+199)) .and. (z <= 1.2d+256)) then
tmp = t_1
else
tmp = (-2.0d0) + (2.0d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (z <= -1.6e-137) {
tmp = t_1;
} else if (z <= 2.2e-21) {
tmp = (2.0 / t) / z;
} else if ((z <= 3e+54) || (!(z <= 2.05e+199) && (z <= 1.2e+256))) {
tmp = t_1;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if z <= -1.6e-137: tmp = t_1 elif z <= 2.2e-21: tmp = (2.0 / t) / z elif (z <= 3e+54) or (not (z <= 2.05e+199) and (z <= 1.2e+256)): tmp = t_1 else: tmp = -2.0 + (2.0 / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (z <= -1.6e-137) tmp = t_1; elseif (z <= 2.2e-21) tmp = Float64(Float64(2.0 / t) / z); elseif ((z <= 3e+54) || (!(z <= 2.05e+199) && (z <= 1.2e+256))) tmp = t_1; else tmp = Float64(-2.0 + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (z <= -1.6e-137) tmp = t_1; elseif (z <= 2.2e-21) tmp = (2.0 / t) / z; elseif ((z <= 3e+54) || (~((z <= 2.05e+199)) && (z <= 1.2e+256))) tmp = t_1; else tmp = -2.0 + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[z, -1.6e-137], t$95$1, If[LessEqual[z, 2.2e-21], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision], If[Or[LessEqual[z, 3e+54], And[N[Not[LessEqual[z, 2.05e+199]], $MachinePrecision], LessEqual[z, 1.2e+256]]], t$95$1, N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{-137}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-21}:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+54} \lor \neg \left(z \leq 2.05 \cdot 10^{+199}\right) \land z \leq 1.2 \cdot 10^{+256}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if z < -1.60000000000000011e-137 or 2.2000000000000001e-21 < z < 2.9999999999999999e54 or 2.04999999999999987e199 < z < 1.20000000000000007e256Initial program 84.8%
sub-neg84.8%
distribute-rgt-in84.8%
*-lft-identity84.8%
associate-+r+84.8%
cancel-sign-sub-inv84.8%
div-sub83.2%
associate-*r*83.2%
associate-*l/83.2%
*-inverses99.1%
metadata-eval99.1%
sub-neg99.1%
metadata-eval99.1%
metadata-eval99.1%
+-commutative99.1%
metadata-eval99.1%
associate-/l/99.2%
Simplified99.2%
Taylor expanded in t around inf 74.1%
if -1.60000000000000011e-137 < z < 2.2000000000000001e-21Initial program 98.6%
sub-neg98.6%
distribute-rgt-in98.6%
*-lft-identity98.6%
associate-+r+98.6%
cancel-sign-sub-inv98.6%
div-sub72.4%
associate-*r*72.4%
associate-*l/72.4%
*-inverses98.6%
metadata-eval98.6%
sub-neg98.6%
metadata-eval98.6%
metadata-eval98.6%
+-commutative98.6%
metadata-eval98.6%
associate-/l/98.6%
Simplified98.6%
Taylor expanded in z around 0 77.7%
associate-/r*77.7%
div-inv77.7%
Applied egg-rr77.7%
un-div-inv77.7%
Applied egg-rr77.7%
if 2.9999999999999999e54 < z < 2.04999999999999987e199 or 1.20000000000000007e256 < z Initial program 86.7%
sub-neg86.7%
distribute-rgt-in86.7%
*-lft-identity86.7%
associate-+r+86.7%
cancel-sign-sub-inv86.7%
div-sub86.7%
associate-*r*86.7%
associate-*l/86.7%
*-inverses99.8%
metadata-eval99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
metadata-eval99.8%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
associate--l+100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 76.6%
sub-neg76.6%
metadata-eval76.6%
associate-*r/76.6%
metadata-eval76.6%
Simplified76.6%
Final simplification75.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= z -3e-132)
t_1
(if (<= z 6e-21)
(+ -2.0 (/ 2.0 (* z t)))
(if (or (<= z 1.4e+50) (and (not (<= z 1.02e+199)) (<= z 4.7e+258)))
t_1
(+ -2.0 (/ 2.0 t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (z <= -3e-132) {
tmp = t_1;
} else if (z <= 6e-21) {
tmp = -2.0 + (2.0 / (z * t));
} else if ((z <= 1.4e+50) || (!(z <= 1.02e+199) && (z <= 4.7e+258))) {
tmp = t_1;
} else {
tmp = -2.0 + (2.0 / 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) :: t_1
real(8) :: tmp
t_1 = (x / y) - 2.0d0
if (z <= (-3d-132)) then
tmp = t_1
else if (z <= 6d-21) then
tmp = (-2.0d0) + (2.0d0 / (z * t))
else if ((z <= 1.4d+50) .or. (.not. (z <= 1.02d+199)) .and. (z <= 4.7d+258)) then
tmp = t_1
else
tmp = (-2.0d0) + (2.0d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (z <= -3e-132) {
tmp = t_1;
} else if (z <= 6e-21) {
tmp = -2.0 + (2.0 / (z * t));
} else if ((z <= 1.4e+50) || (!(z <= 1.02e+199) && (z <= 4.7e+258))) {
tmp = t_1;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if z <= -3e-132: tmp = t_1 elif z <= 6e-21: tmp = -2.0 + (2.0 / (z * t)) elif (z <= 1.4e+50) or (not (z <= 1.02e+199) and (z <= 4.7e+258)): tmp = t_1 else: tmp = -2.0 + (2.0 / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (z <= -3e-132) tmp = t_1; elseif (z <= 6e-21) tmp = Float64(-2.0 + Float64(2.0 / Float64(z * t))); elseif ((z <= 1.4e+50) || (!(z <= 1.02e+199) && (z <= 4.7e+258))) tmp = t_1; else tmp = Float64(-2.0 + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (z <= -3e-132) tmp = t_1; elseif (z <= 6e-21) tmp = -2.0 + (2.0 / (z * t)); elseif ((z <= 1.4e+50) || (~((z <= 1.02e+199)) && (z <= 4.7e+258))) tmp = t_1; else tmp = -2.0 + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[z, -3e-132], t$95$1, If[LessEqual[z, 6e-21], N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 1.4e+50], And[N[Not[LessEqual[z, 1.02e+199]], $MachinePrecision], LessEqual[z, 4.7e+258]]], t$95$1, N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;z \leq -3 \cdot 10^{-132}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-21}:\\
\;\;\;\;-2 + \frac{2}{z \cdot t}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+50} \lor \neg \left(z \leq 1.02 \cdot 10^{+199}\right) \land z \leq 4.7 \cdot 10^{+258}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if z < -3e-132 or 5.99999999999999982e-21 < z < 1.3999999999999999e50 or 1.02e199 < z < 4.7000000000000001e258Initial program 84.8%
sub-neg84.8%
distribute-rgt-in84.8%
*-lft-identity84.8%
associate-+r+84.8%
cancel-sign-sub-inv84.8%
div-sub83.2%
associate-*r*83.2%
associate-*l/83.2%
*-inverses99.1%
metadata-eval99.1%
sub-neg99.1%
metadata-eval99.1%
metadata-eval99.1%
+-commutative99.1%
metadata-eval99.1%
associate-/l/99.2%
Simplified99.2%
Taylor expanded in t around inf 74.1%
if -3e-132 < z < 5.99999999999999982e-21Initial program 98.6%
sub-neg98.6%
distribute-rgt-in98.6%
*-lft-identity98.6%
associate-+r+98.6%
cancel-sign-sub-inv98.6%
div-sub72.4%
associate-*r*72.4%
associate-*l/72.4%
*-inverses98.6%
metadata-eval98.6%
sub-neg98.6%
metadata-eval98.6%
metadata-eval98.6%
+-commutative98.6%
metadata-eval98.6%
associate-/l/98.6%
Simplified98.6%
div-inv98.6%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 84.7%
distribute-lft-out84.7%
fma-neg84.7%
+-commutative84.7%
metadata-eval84.7%
fma-def84.7%
distribute-lft-out84.7%
associate-*r/84.7%
metadata-eval84.7%
*-commutative84.7%
associate-*r/84.7%
metadata-eval84.7%
associate-+l+84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in t around inf 84.7%
if 1.3999999999999999e50 < z < 1.02e199 or 4.7000000000000001e258 < z Initial program 86.7%
sub-neg86.7%
distribute-rgt-in86.7%
*-lft-identity86.7%
associate-+r+86.7%
cancel-sign-sub-inv86.7%
div-sub86.7%
associate-*r*86.7%
associate-*l/86.7%
*-inverses99.8%
metadata-eval99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
metadata-eval99.8%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
associate--l+100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 76.6%
sub-neg76.6%
metadata-eval76.6%
associate-*r/76.6%
metadata-eval76.6%
Simplified76.6%
Final simplification78.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= t -8.5e-49)
t_1
(if (<= t 1.95e-19)
(/ (+ 2.0 (/ 2.0 z)) t)
(if (<= t 1.6e+14)
(+ (/ x y) (/ 2.0 t))
(if (<= t 3.6e+76) (+ -2.0 (/ 2.0 (* z t))) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (t <= -8.5e-49) {
tmp = t_1;
} else if (t <= 1.95e-19) {
tmp = (2.0 + (2.0 / z)) / t;
} else if (t <= 1.6e+14) {
tmp = (x / y) + (2.0 / t);
} else if (t <= 3.6e+76) {
tmp = -2.0 + (2.0 / (z * t));
} 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) :: tmp
t_1 = (x / y) - 2.0d0
if (t <= (-8.5d-49)) then
tmp = t_1
else if (t <= 1.95d-19) then
tmp = (2.0d0 + (2.0d0 / z)) / t
else if (t <= 1.6d+14) then
tmp = (x / y) + (2.0d0 / t)
else if (t <= 3.6d+76) then
tmp = (-2.0d0) + (2.0d0 / (z * t))
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 / y) - 2.0;
double tmp;
if (t <= -8.5e-49) {
tmp = t_1;
} else if (t <= 1.95e-19) {
tmp = (2.0 + (2.0 / z)) / t;
} else if (t <= 1.6e+14) {
tmp = (x / y) + (2.0 / t);
} else if (t <= 3.6e+76) {
tmp = -2.0 + (2.0 / (z * t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if t <= -8.5e-49: tmp = t_1 elif t <= 1.95e-19: tmp = (2.0 + (2.0 / z)) / t elif t <= 1.6e+14: tmp = (x / y) + (2.0 / t) elif t <= 3.6e+76: tmp = -2.0 + (2.0 / (z * t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -8.5e-49) tmp = t_1; elseif (t <= 1.95e-19) tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); elseif (t <= 1.6e+14) tmp = Float64(Float64(x / y) + Float64(2.0 / t)); elseif (t <= 3.6e+76) tmp = Float64(-2.0 + Float64(2.0 / Float64(z * t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (t <= -8.5e-49) tmp = t_1; elseif (t <= 1.95e-19) tmp = (2.0 + (2.0 / z)) / t; elseif (t <= 1.6e+14) tmp = (x / y) + (2.0 / t); elseif (t <= 3.6e+76) tmp = -2.0 + (2.0 / (z * t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -8.5e-49], t$95$1, If[LessEqual[t, 1.95e-19], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 1.6e+14], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.6e+76], N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -8.5 \cdot 10^{-49}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{-19}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+14}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{+76}:\\
\;\;\;\;-2 + \frac{2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -8.50000000000000069e-49 or 3.6000000000000003e76 < t Initial program 79.4%
sub-neg79.4%
distribute-rgt-in79.4%
*-lft-identity79.4%
associate-+r+79.4%
cancel-sign-sub-inv79.4%
div-sub79.4%
associate-*r*79.4%
associate-*l/79.4%
*-inverses99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in t around inf 86.5%
if -8.50000000000000069e-49 < t < 1.94999999999999998e-19Initial program 98.1%
sub-neg98.1%
distribute-rgt-in98.1%
*-lft-identity98.1%
associate-+r+98.1%
cancel-sign-sub-inv98.1%
div-sub78.4%
associate-*r*78.4%
associate-*l/78.4%
*-inverses98.1%
metadata-eval98.1%
sub-neg98.1%
metadata-eval98.1%
metadata-eval98.1%
+-commutative98.1%
metadata-eval98.1%
associate-/l/98.2%
Simplified98.3%
Taylor expanded in t around 0 82.0%
associate-*r/82.0%
metadata-eval82.0%
Simplified82.0%
if 1.94999999999999998e-19 < t < 1.6e14Initial program 99.7%
Taylor expanded in t around 0 87.8%
Taylor expanded in z around inf 87.8%
associate-*r/87.8%
metadata-eval87.8%
Simplified87.8%
if 1.6e14 < t < 3.6000000000000003e76Initial program 99.4%
sub-neg99.4%
distribute-rgt-in99.4%
*-lft-identity99.4%
associate-+r+99.4%
cancel-sign-sub-inv99.4%
div-sub99.4%
associate-*r*99.4%
associate-*l/99.4%
*-inverses99.4%
metadata-eval99.4%
sub-neg99.4%
metadata-eval99.4%
metadata-eval99.4%
+-commutative99.4%
metadata-eval99.4%
associate-/l/99.6%
Simplified99.6%
div-inv99.6%
fma-def99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 88.3%
distribute-lft-out88.3%
fma-neg88.3%
+-commutative88.3%
metadata-eval88.3%
fma-def88.3%
distribute-lft-out88.3%
associate-*r/88.3%
metadata-eval88.3%
*-commutative88.3%
associate-*r/88.3%
metadata-eval88.3%
associate-+l+88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in t around inf 88.3%
Final simplification84.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2500.0) (not (<= (/ x y) 5.4))) (+ (/ x y) (/ 2.0 t)) (+ -2.0 (/ 2.0 (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2500.0) || !((x / y) <= 5.4)) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = -2.0 + (2.0 / (z * 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 / y) <= (-2500.0d0)) .or. (.not. ((x / y) <= 5.4d0))) then
tmp = (x / y) + (2.0d0 / t)
else
tmp = (-2.0d0) + (2.0d0 / (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2500.0) || !((x / y) <= 5.4)) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = -2.0 + (2.0 / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2500.0) or not ((x / y) <= 5.4): tmp = (x / y) + (2.0 / t) else: tmp = -2.0 + (2.0 / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2500.0) || !(Float64(x / y) <= 5.4)) tmp = Float64(Float64(x / y) + Float64(2.0 / t)); else tmp = Float64(-2.0 + Float64(2.0 / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2500.0) || ~(((x / y) <= 5.4))) tmp = (x / y) + (2.0 / t); else tmp = -2.0 + (2.0 / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2500.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5.4]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2500 \lor \neg \left(\frac{x}{y} \leq 5.4\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{z \cdot t}\\
\end{array}
\end{array}
if (/.f64 x y) < -2500 or 5.4000000000000004 < (/.f64 x y) Initial program 85.1%
Taylor expanded in t around 0 97.1%
Taylor expanded in z around inf 82.1%
associate-*r/82.1%
metadata-eval82.1%
Simplified82.1%
if -2500 < (/.f64 x y) < 5.4000000000000004Initial program 95.3%
sub-neg95.3%
distribute-rgt-in95.3%
*-lft-identity95.3%
associate-+r+95.3%
cancel-sign-sub-inv95.3%
div-sub79.6%
associate-*r*79.6%
associate-*l/79.6%
*-inverses99.7%
metadata-eval99.7%
sub-neg99.7%
metadata-eval99.7%
metadata-eval99.7%
+-commutative99.7%
metadata-eval99.7%
associate-/l/99.9%
Simplified99.9%
div-inv99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 99.7%
distribute-lft-out99.7%
fma-neg99.7%
+-commutative99.7%
metadata-eval99.7%
fma-def99.7%
distribute-lft-out99.7%
associate-*r/99.7%
metadata-eval99.7%
*-commutative99.7%
associate-*r/99.7%
metadata-eval99.7%
associate-+l+99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around inf 78.8%
Final simplification80.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.5e-108) (not (<= z 6.8e-22))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (+ -2.0 (/ 2.0 (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.5e-108) || !(z <= 6.8e-22)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = -2.0 + (2.0 / (z * 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 ((z <= (-5.5d-108)) .or. (.not. (z <= 6.8d-22))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
else
tmp = (-2.0d0) + (2.0d0 / (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.5e-108) || !(z <= 6.8e-22)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = -2.0 + (2.0 / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.5e-108) or not (z <= 6.8e-22): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = -2.0 + (2.0 / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.5e-108) || !(z <= 6.8e-22)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); else tmp = Float64(-2.0 + Float64(2.0 / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.5e-108) || ~((z <= 6.8e-22))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = -2.0 + (2.0 / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.5e-108], N[Not[LessEqual[z, 6.8e-22]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-108} \lor \neg \left(z \leq 6.8 \cdot 10^{-22}\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -5.50000000000000031e-108 or 6.7999999999999997e-22 < z Initial program 85.0%
sub-neg85.0%
distribute-rgt-in85.0%
*-lft-identity85.0%
associate-+r+85.0%
cancel-sign-sub-inv85.0%
div-sub84.4%
associate-*r*84.4%
associate-*l/84.4%
*-inverses99.2%
metadata-eval99.2%
sub-neg99.2%
metadata-eval99.2%
metadata-eval99.2%
+-commutative99.2%
metadata-eval99.2%
associate-/l/99.4%
Simplified99.4%
Taylor expanded in z around inf 93.8%
associate--l+93.8%
sub-neg93.8%
associate-*r/93.8%
metadata-eval93.8%
metadata-eval93.8%
Simplified93.8%
if -5.50000000000000031e-108 < z < 6.7999999999999997e-22Initial program 98.7%
sub-neg98.7%
distribute-rgt-in98.7%
*-lft-identity98.7%
associate-+r+98.7%
cancel-sign-sub-inv98.7%
div-sub72.2%
associate-*r*72.2%
associate-*l/72.2%
*-inverses98.7%
metadata-eval98.7%
sub-neg98.7%
metadata-eval98.7%
metadata-eval98.7%
+-commutative98.7%
metadata-eval98.7%
associate-/l/98.6%
Simplified98.6%
div-inv98.6%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 84.2%
distribute-lft-out84.2%
fma-neg84.2%
+-commutative84.2%
metadata-eval84.2%
fma-def84.2%
distribute-lft-out84.2%
associate-*r/84.2%
metadata-eval84.2%
*-commutative84.2%
associate-*r/84.2%
metadata-eval84.2%
associate-+l+84.2%
*-commutative84.2%
Simplified84.2%
Taylor expanded in t around inf 84.2%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -8.2e+29) (/ x y) (if (<= (/ x y) 8.8e+24) (+ -2.0 (/ 2.0 t)) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -8.2e+29) {
tmp = x / y;
} else if ((x / y) <= 8.8e+24) {
tmp = -2.0 + (2.0 / t);
} else {
tmp = x / 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 ((x / y) <= (-8.2d+29)) then
tmp = x / y
else if ((x / y) <= 8.8d+24) then
tmp = (-2.0d0) + (2.0d0 / t)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -8.2e+29) {
tmp = x / y;
} else if ((x / y) <= 8.8e+24) {
tmp = -2.0 + (2.0 / t);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -8.2e+29: tmp = x / y elif (x / y) <= 8.8e+24: tmp = -2.0 + (2.0 / t) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -8.2e+29) tmp = Float64(x / y); elseif (Float64(x / y) <= 8.8e+24) tmp = Float64(-2.0 + Float64(2.0 / t)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -8.2e+29) tmp = x / y; elseif ((x / y) <= 8.8e+24) tmp = -2.0 + (2.0 / t); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -8.2e+29], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 8.8e+24], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -8.2 \cdot 10^{+29}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 8.8 \cdot 10^{+24}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -8.2000000000000007e29 or 8.80000000000000007e24 < (/.f64 x y) Initial program 85.2%
sub-neg85.2%
distribute-rgt-in85.2%
*-lft-identity85.2%
associate-+r+85.2%
cancel-sign-sub-inv85.2%
div-sub80.5%
associate-*r*80.5%
associate-*l/80.5%
*-inverses98.4%
metadata-eval98.4%
sub-neg98.4%
metadata-eval98.4%
metadata-eval98.4%
+-commutative98.4%
metadata-eval98.4%
associate-/l/98.4%
Simplified98.4%
Taylor expanded in x around inf 70.7%
if -8.2000000000000007e29 < (/.f64 x y) < 8.80000000000000007e24Initial program 94.2%
sub-neg94.2%
distribute-rgt-in94.2%
*-lft-identity94.2%
associate-+r+94.2%
cancel-sign-sub-inv94.2%
div-sub80.1%
associate-*r*80.1%
associate-*l/80.1%
*-inverses99.7%
metadata-eval99.7%
sub-neg99.7%
metadata-eval99.7%
metadata-eval99.7%
+-commutative99.7%
metadata-eval99.7%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in z around inf 58.3%
associate--l+58.3%
sub-neg58.3%
associate-*r/58.3%
metadata-eval58.3%
metadata-eval58.3%
Simplified58.3%
Taylor expanded in x around 0 54.5%
sub-neg54.5%
metadata-eval54.5%
associate-*r/54.5%
metadata-eval54.5%
Simplified54.5%
Final simplification62.7%
(FPCore (x y z t) :precision binary64 (+ (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t)) (/ x y)))
double code(double x, double y, double z, double t) {
return (-2.0 + ((2.0 + (2.0 / z)) / t)) + (x / y);
}
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 = ((-2.0d0) + ((2.0d0 + (2.0d0 / z)) / t)) + (x / y)
end function
public static double code(double x, double y, double z, double t) {
return (-2.0 + ((2.0 + (2.0 / z)) / t)) + (x / y);
}
def code(x, y, z, t): return (-2.0 + ((2.0 + (2.0 / z)) / t)) + (x / y)
function code(x, y, z, t) return Float64(Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t)) + Float64(x / y)) end
function tmp = code(x, y, z, t) tmp = (-2.0 + ((2.0 + (2.0 / z)) / t)) + (x / y); end
code[x_, y_, z_, t_] := N[(N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-2 + \frac{2 + \frac{2}{z}}{t}\right) + \frac{x}{y}
\end{array}
Initial program 89.7%
sub-neg89.7%
distribute-rgt-in89.7%
*-lft-identity89.7%
associate-+r+89.7%
cancel-sign-sub-inv89.7%
div-sub80.3%
associate-*r*80.3%
associate-*l/80.3%
*-inverses99.0%
metadata-eval99.0%
sub-neg99.0%
metadata-eval99.0%
metadata-eval99.0%
+-commutative99.0%
metadata-eval99.0%
associate-/l/99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -0.56) (/ x y) (if (<= (/ x y) 2.0) -2.0 (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -0.56) {
tmp = x / y;
} else if ((x / y) <= 2.0) {
tmp = -2.0;
} else {
tmp = x / 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 ((x / y) <= (-0.56d0)) then
tmp = x / y
else if ((x / y) <= 2.0d0) then
tmp = -2.0d0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -0.56) {
tmp = x / y;
} else if ((x / y) <= 2.0) {
tmp = -2.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -0.56: tmp = x / y elif (x / y) <= 2.0: tmp = -2.0 else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -0.56) tmp = Float64(x / y); elseif (Float64(x / y) <= 2.0) tmp = -2.0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -0.56) tmp = x / y; elseif ((x / y) <= 2.0) tmp = -2.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -0.56], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.0], -2.0, N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -0.56:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -0.56000000000000005 or 2 < (/.f64 x y) Initial program 85.2%
sub-neg85.2%
distribute-rgt-in85.2%
*-lft-identity85.2%
associate-+r+85.2%
cancel-sign-sub-inv85.2%
div-sub81.0%
associate-*r*81.0%
associate-*l/81.0%
*-inverses98.5%
metadata-eval98.5%
sub-neg98.5%
metadata-eval98.5%
metadata-eval98.5%
+-commutative98.5%
metadata-eval98.5%
associate-/l/98.5%
Simplified98.5%
Taylor expanded in x around inf 66.0%
if -0.56000000000000005 < (/.f64 x y) < 2Initial program 95.3%
sub-neg95.3%
distribute-rgt-in95.3%
*-lft-identity95.3%
associate-+r+95.3%
cancel-sign-sub-inv95.3%
div-sub79.4%
associate-*r*79.4%
associate-*l/79.4%
*-inverses99.8%
metadata-eval99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
metadata-eval99.8%
associate-/l/99.9%
Simplified99.9%
div-inv99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 99.7%
distribute-lft-out99.7%
fma-neg99.7%
+-commutative99.7%
metadata-eval99.7%
fma-def99.7%
distribute-lft-out99.7%
associate-*r/99.7%
metadata-eval99.7%
*-commutative99.7%
associate-*r/99.7%
metadata-eval99.7%
associate-+l+99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around inf 34.4%
Final simplification52.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.85e-123) (not (<= t 1.35e-95))) (- (/ x y) 2.0) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.85e-123) || !(t <= 1.35e-95)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / 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 ((t <= (-1.85d-123)) .or. (.not. (t <= 1.35d-95))) then
tmp = (x / y) - 2.0d0
else
tmp = 2.0d0 / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.85e-123) || !(t <= 1.35e-95)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.85e-123) or not (t <= 1.35e-95): tmp = (x / y) - 2.0 else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.85e-123) || !(t <= 1.35e-95)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(2.0 / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.85e-123) || ~((t <= 1.35e-95))) tmp = (x / y) - 2.0; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.85e-123], N[Not[LessEqual[t, 1.35e-95]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.85 \cdot 10^{-123} \lor \neg \left(t \leq 1.35 \cdot 10^{-95}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if t < -1.85000000000000008e-123 or 1.35e-95 < t Initial program 85.4%
sub-neg85.4%
distribute-rgt-in85.4%
*-lft-identity85.4%
associate-+r+85.4%
cancel-sign-sub-inv85.4%
div-sub84.2%
associate-*r*84.2%
associate-*l/84.2%
*-inverses99.8%
metadata-eval99.8%
sub-neg99.8%
metadata-eval99.8%
metadata-eval99.8%
+-commutative99.8%
metadata-eval99.8%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in t around inf 74.8%
if -1.85000000000000008e-123 < t < 1.35e-95Initial program 97.6%
sub-neg97.6%
distribute-rgt-in97.6%
*-lft-identity97.6%
associate-+r+97.6%
cancel-sign-sub-inv97.6%
div-sub73.1%
associate-*r*73.1%
associate-*l/73.1%
*-inverses97.6%
metadata-eval97.6%
sub-neg97.6%
metadata-eval97.6%
metadata-eval97.6%
+-commutative97.6%
metadata-eval97.6%
associate-/l/97.7%
Simplified97.7%
Taylor expanded in z around inf 53.2%
associate--l+53.2%
sub-neg53.2%
associate-*r/53.2%
metadata-eval53.2%
metadata-eval53.2%
Simplified53.2%
Taylor expanded in t around 0 42.4%
Final simplification63.4%
(FPCore (x y z t) :precision binary64 (if (<= t -1600000000.0) -2.0 (if (<= t 0.46) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1600000000.0) {
tmp = -2.0;
} else if (t <= 0.46) {
tmp = 2.0 / t;
} else {
tmp = -2.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 <= (-1600000000.0d0)) then
tmp = -2.0d0
else if (t <= 0.46d0) then
tmp = 2.0d0 / t
else
tmp = -2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1600000000.0) {
tmp = -2.0;
} else if (t <= 0.46) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1600000000.0: tmp = -2.0 elif t <= 0.46: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1600000000.0) tmp = -2.0; elseif (t <= 0.46) tmp = Float64(2.0 / t); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1600000000.0) tmp = -2.0; elseif (t <= 0.46) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1600000000.0], -2.0, If[LessEqual[t, 0.46], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1600000000:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 0.46:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -1.6e9 or 0.46000000000000002 < t Initial program 79.5%
sub-neg79.5%
distribute-rgt-in79.5%
*-lft-identity79.5%
associate-+r+79.5%
cancel-sign-sub-inv79.5%
div-sub79.6%
associate-*r*79.6%
associate-*l/79.6%
*-inverses99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate-/l/99.9%
Simplified99.9%
div-inv99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 48.2%
distribute-lft-out48.2%
fma-neg48.2%
+-commutative48.2%
metadata-eval48.2%
fma-def48.2%
distribute-lft-out48.2%
associate-*r/48.2%
metadata-eval48.2%
*-commutative48.2%
associate-*r/48.2%
metadata-eval48.2%
associate-+l+48.2%
*-commutative48.2%
Simplified48.2%
Taylor expanded in t around inf 33.5%
if -1.6e9 < t < 0.46000000000000002Initial program 98.3%
sub-neg98.3%
distribute-rgt-in98.3%
*-lft-identity98.3%
associate-+r+98.3%
cancel-sign-sub-inv98.3%
div-sub80.9%
associate-*r*80.9%
associate-*l/80.9%
*-inverses98.3%
metadata-eval98.3%
sub-neg98.3%
metadata-eval98.3%
metadata-eval98.3%
+-commutative98.3%
metadata-eval98.3%
associate-/l/98.4%
Simplified98.4%
Taylor expanded in z around inf 58.8%
associate--l+58.8%
sub-neg58.8%
associate-*r/58.8%
metadata-eval58.8%
metadata-eval58.8%
Simplified58.8%
Taylor expanded in t around 0 34.6%
Final simplification34.1%
(FPCore (x y z t) :precision binary64 -2.0)
double code(double x, double y, double z, double t) {
return -2.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 = -2.0d0
end function
public static double code(double x, double y, double z, double t) {
return -2.0;
}
def code(x, y, z, t): return -2.0
function code(x, y, z, t) return -2.0 end
function tmp = code(x, y, z, t) tmp = -2.0; end
code[x_, y_, z_, t_] := -2.0
\begin{array}{l}
\\
-2
\end{array}
Initial program 89.7%
sub-neg89.7%
distribute-rgt-in89.7%
*-lft-identity89.7%
associate-+r+89.7%
cancel-sign-sub-inv89.7%
div-sub80.3%
associate-*r*80.3%
associate-*l/80.3%
*-inverses99.0%
metadata-eval99.0%
sub-neg99.0%
metadata-eval99.0%
metadata-eval99.0%
+-commutative99.0%
metadata-eval99.0%
associate-/l/99.1%
Simplified99.1%
div-inv99.0%
fma-def99.4%
Applied egg-rr99.4%
Taylor expanded in x around 0 63.1%
distribute-lft-out63.1%
fma-neg63.1%
+-commutative63.1%
metadata-eval63.1%
fma-def63.1%
distribute-lft-out63.1%
associate-*r/63.1%
metadata-eval63.1%
*-commutative63.1%
associate-*r/63.1%
metadata-eval63.1%
associate-+l+63.1%
*-commutative63.1%
Simplified63.1%
Taylor expanded in t around inf 16.7%
Final simplification16.7%
(FPCore (x y z t) :precision binary64 (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y))))
double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
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 = (((2.0d0 / z) + 2.0d0) / t) - (2.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
def code(x, y, z, t): return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(2.0 / z) + 2.0) / t) - Float64(2.0 - Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = (((2.0 / z) + 2.0) / t) - (2.0 - (x / y)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(2.0 / z), $MachinePrecision] + 2.0), $MachinePrecision] / t), $MachinePrecision] - N[(2.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{z} + 2}{t} - \left(2 - \frac{x}{y}\right)
\end{array}
herbie shell --seed 2023230
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:herbie-target
(- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))