
(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 13 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 (+ (/ x y) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
return (x / y) + (-2.0 + ((2.0 + (2.0 / z)) / t));
}
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) + ((2.0d0 + (2.0d0 / z)) / t))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + (-2.0 + ((2.0 + (2.0 / z)) / t));
}
def code(x, y, z, t): return (x / y) + (-2.0 + ((2.0 + (2.0 / z)) / t))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t))) end
function tmp = code(x, y, z, t) tmp = (x / y) + (-2.0 + ((2.0 + (2.0 / z)) / t)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)
\end{array}
Initial program 90.5%
sub-neg90.5%
distribute-rgt-in90.5%
*-lft-identity90.5%
associate-+r+90.5%
cancel-sign-sub-inv90.5%
div-sub78.7%
associate-*r*78.7%
associate-*l/78.7%
*-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%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -9.4e+30) (not (<= (/ x y) 0.00195))) (+ (/ x y) (/ 2.0 (* z t))) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -9.4e+30) || !((x / y) <= 0.00195)) {
tmp = (x / y) + (2.0 / (z * t));
} else {
tmp = -2.0 + ((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) <= (-9.4d+30)) .or. (.not. ((x / y) <= 0.00195d0))) then
tmp = (x / y) + (2.0d0 / (z * t))
else
tmp = (-2.0d0) + ((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) <= -9.4e+30) || !((x / y) <= 0.00195)) {
tmp = (x / y) + (2.0 / (z * t));
} else {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -9.4e+30) or not ((x / y) <= 0.00195): tmp = (x / y) + (2.0 / (z * t)) else: tmp = -2.0 + ((2.0 + (2.0 / z)) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -9.4e+30) || !(Float64(x / y) <= 0.00195)) tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(z * t))); else tmp = Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -9.4e+30) || ~(((x / y) <= 0.00195))) tmp = (x / y) + (2.0 / (z * t)); else tmp = -2.0 + ((2.0 + (2.0 / z)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -9.4e+30], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.00195]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -9.4 \cdot 10^{+30} \lor \neg \left(\frac{x}{y} \leq 0.00195\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -9.39999999999999979e30 or 0.0019499999999999999 < (/.f64 x y) Initial program 91.6%
Taylor expanded in z around 0 92.7%
if -9.39999999999999979e30 < (/.f64 x y) < 0.0019499999999999999Initial program 89.5%
sub-neg89.5%
distribute-rgt-in89.5%
*-lft-identity89.5%
associate-+r+89.5%
cancel-sign-sub-inv89.5%
div-sub76.3%
associate-*r*76.3%
associate-*l/76.3%
*-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%
add-cube-cbrt99.1%
pow399.1%
Applied egg-rr99.1%
Taylor expanded in x around 0 98.9%
sub-neg98.9%
pow-base-198.9%
associate-*r/98.9%
associate-*r/98.9%
metadata-eval98.9%
*-lft-identity98.9%
metadata-eval98.9%
Simplified98.9%
Final simplification96.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 7e-6))) (+ (/ x y) (- (/ 2.0 t) 2.0)) (+ (/ x y) (+ -2.0 (/ 2.0 (* z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 7e-6)) {
tmp = (x / y) + ((2.0 / t) - 2.0);
} else {
tmp = (x / y) + (-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 <= (-1.0d0)) .or. (.not. (z <= 7d-6))) then
tmp = (x / y) + ((2.0d0 / t) - 2.0d0)
else
tmp = (x / y) + ((-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 <= -1.0) || !(z <= 7e-6)) {
tmp = (x / y) + ((2.0 / t) - 2.0);
} else {
tmp = (x / y) + (-2.0 + (2.0 / (z * t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 7e-6): tmp = (x / y) + ((2.0 / t) - 2.0) else: tmp = (x / y) + (-2.0 + (2.0 / (z * t))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 7e-6)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) - 2.0)); else tmp = Float64(Float64(x / y) + 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 <= -1.0) || ~((z <= 7e-6))) tmp = (x / y) + ((2.0 / t) - 2.0); else tmp = (x / y) + (-2.0 + (2.0 / (z * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 7e-6]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 7 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} - 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{z \cdot t}\right)\\
\end{array}
\end{array}
if z < -1 or 6.99999999999999989e-6 < z Initial program 78.2%
sub-neg78.2%
distribute-rgt-in78.2%
*-lft-identity78.2%
associate-+r+78.2%
cancel-sign-sub-inv78.2%
div-sub78.2%
associate-*r*78.2%
associate-*l/78.2%
*-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 98.4%
associate--l+98.4%
associate-*r/98.4%
metadata-eval98.4%
Simplified98.4%
if -1 < z < 6.99999999999999989e-6Initial program 99.9%
sub-neg99.9%
distribute-rgt-in99.9%
*-lft-identity99.9%
associate-+r+99.9%
cancel-sign-sub-inv99.9%
div-sub79.2%
associate-*r*79.2%
associate-*l/79.2%
*-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 z around 0 99.5%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -6.2e+69) (/ x y) (if (<= (/ x y) 1e+93) (+ -2.0 (/ 2.0 (* z t))) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -6.2e+69) {
tmp = x / y;
} else if ((x / y) <= 1e+93) {
tmp = -2.0 + (2.0 / (z * t));
} else {
tmp = (x / y) - 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 ((x / y) <= (-6.2d+69)) then
tmp = x / y
else if ((x / y) <= 1d+93) then
tmp = (-2.0d0) + (2.0d0 / (z * t))
else
tmp = (x / y) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -6.2e+69) {
tmp = x / y;
} else if ((x / y) <= 1e+93) {
tmp = -2.0 + (2.0 / (z * t));
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -6.2e+69: tmp = x / y elif (x / y) <= 1e+93: tmp = -2.0 + (2.0 / (z * t)) else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -6.2e+69) tmp = Float64(x / y); elseif (Float64(x / y) <= 1e+93) tmp = Float64(-2.0 + Float64(2.0 / Float64(z * t))); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -6.2e+69) tmp = x / y; elseif ((x / y) <= 1e+93) tmp = -2.0 + (2.0 / (z * t)); else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -6.2e+69], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e+93], N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -6.2 \cdot 10^{+69}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{+93}:\\
\;\;\;\;-2 + \frac{2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -6.1999999999999997e69Initial program 88.8%
sub-neg88.8%
distribute-rgt-in88.8%
*-lft-identity88.8%
associate-+r+88.8%
cancel-sign-sub-inv88.8%
div-sub77.7%
associate-*r*77.7%
associate-*l/77.7%
*-inverses99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in x around inf 79.7%
if -6.1999999999999997e69 < (/.f64 x y) < 1.00000000000000004e93Initial program 90.4%
sub-neg90.4%
distribute-rgt-in90.4%
*-lft-identity90.4%
associate-+r+90.4%
cancel-sign-sub-inv90.4%
div-sub77.3%
associate-*r*77.3%
associate-*l/77.3%
*-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 z around 0 77.2%
Taylor expanded in x around 0 72.2%
sub-neg72.2%
associate-*r/72.2%
metadata-eval72.2%
*-commutative72.2%
metadata-eval72.2%
+-commutative72.2%
*-commutative72.2%
Simplified72.2%
if 1.00000000000000004e93 < (/.f64 x y) Initial program 92.1%
sub-neg92.1%
distribute-rgt-in92.1%
*-lft-identity92.1%
associate-+r+92.1%
cancel-sign-sub-inv92.1%
div-sub84.2%
associate-*r*84.2%
associate-*l/84.2%
*-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 85.3%
Final simplification76.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -18000000000.0) (not (<= t 4.4e-73))) (+ (/ x y) (- (/ 2.0 t) 2.0)) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -18000000000.0) || !(t <= 4.4e-73)) {
tmp = (x / y) + ((2.0 / t) - 2.0);
} 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 ((t <= (-18000000000.0d0)) .or. (.not. (t <= 4.4d-73))) then
tmp = (x / y) + ((2.0d0 / t) - 2.0d0)
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 ((t <= -18000000000.0) || !(t <= 4.4e-73)) {
tmp = (x / y) + ((2.0 / t) - 2.0);
} else {
tmp = (2.0 + (2.0 / z)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -18000000000.0) or not (t <= 4.4e-73): tmp = (x / y) + ((2.0 / t) - 2.0) else: tmp = (2.0 + (2.0 / z)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -18000000000.0) || !(t <= 4.4e-73)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) - 2.0)); else tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -18000000000.0) || ~((t <= 4.4e-73))) tmp = (x / y) + ((2.0 / t) - 2.0); else tmp = (2.0 + (2.0 / z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -18000000000.0], N[Not[LessEqual[t, 4.4e-73]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -18000000000 \lor \neg \left(t \leq 4.4 \cdot 10^{-73}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} - 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -1.8e10 or 4.4e-73 < t Initial program 82.6%
sub-neg82.6%
distribute-rgt-in82.5%
*-lft-identity82.5%
associate-+r+82.5%
cancel-sign-sub-inv82.5%
div-sub81.8%
associate-*r*81.8%
associate-*l/81.8%
*-inverses99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate-/l/99.9%
Simplified100.0%
Taylor expanded in z around inf 87.3%
associate--l+87.3%
associate-*r/87.3%
metadata-eval87.3%
Simplified87.3%
if -1.8e10 < t < 4.4e-73Initial program 99.7%
sub-neg99.7%
distribute-rgt-in99.7%
*-lft-identity99.7%
associate-+r+99.7%
cancel-sign-sub-inv99.7%
div-sub75.2%
associate-*r*75.2%
associate-*l/75.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%
div-inv99.9%
fma-def99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 83.4%
associate-*r/83.4%
metadata-eval83.4%
Simplified83.4%
Final simplification85.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.6e-12) (not (<= z 5.6e-6))) (+ (/ x y) (- (/ 2.0 t) 2.0)) (+ (/ x y) (/ 2.0 (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.6e-12) || !(z <= 5.6e-6)) {
tmp = (x / y) + ((2.0 / t) - 2.0);
} else {
tmp = (x / y) + (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 <= (-9.6d-12)) .or. (.not. (z <= 5.6d-6))) then
tmp = (x / y) + ((2.0d0 / t) - 2.0d0)
else
tmp = (x / y) + (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 <= -9.6e-12) || !(z <= 5.6e-6)) {
tmp = (x / y) + ((2.0 / t) - 2.0);
} else {
tmp = (x / y) + (2.0 / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.6e-12) or not (z <= 5.6e-6): tmp = (x / y) + ((2.0 / t) - 2.0) else: tmp = (x / y) + (2.0 / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.6e-12) || !(z <= 5.6e-6)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) - 2.0)); else tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9.6e-12) || ~((z <= 5.6e-6))) tmp = (x / y) + ((2.0 / t) - 2.0); else tmp = (x / y) + (2.0 / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.6e-12], N[Not[LessEqual[z, 5.6e-6]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.6 \cdot 10^{-12} \lor \neg \left(z \leq 5.6 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} - 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -9.59999999999999948e-12 or 5.59999999999999975e-6 < z Initial program 78.6%
sub-neg78.6%
distribute-rgt-in78.6%
*-lft-identity78.6%
associate-+r+78.6%
cancel-sign-sub-inv78.6%
div-sub78.6%
associate-*r*78.6%
associate-*l/78.6%
*-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 98.4%
associate--l+98.4%
associate-*r/98.4%
metadata-eval98.4%
Simplified98.4%
if -9.59999999999999948e-12 < z < 5.59999999999999975e-6Initial program 99.9%
Taylor expanded in z around 0 87.0%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -4e+31) (/ x y) (if (<= (/ x y) 0.00195) (+ -2.0 (/ 2.0 t)) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -4e+31) {
tmp = x / y;
} else if ((x / y) <= 0.00195) {
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) <= (-4d+31)) then
tmp = x / y
else if ((x / y) <= 0.00195d0) 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) <= -4e+31) {
tmp = x / y;
} else if ((x / y) <= 0.00195) {
tmp = -2.0 + (2.0 / t);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -4e+31: tmp = x / y elif (x / y) <= 0.00195: 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) <= -4e+31) tmp = Float64(x / y); elseif (Float64(x / y) <= 0.00195) 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) <= -4e+31) tmp = x / y; elseif ((x / y) <= 0.00195) 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], -4e+31], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 0.00195], 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 -4 \cdot 10^{+31}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 0.00195:\\
\;\;\;\;-2 + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -3.9999999999999999e31 or 0.0019499999999999999 < (/.f64 x y) Initial program 91.6%
sub-neg91.6%
distribute-rgt-in91.6%
*-lft-identity91.6%
associate-+r+91.6%
cancel-sign-sub-inv91.6%
div-sub81.6%
associate-*r*81.6%
associate-*l/81.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%
Taylor expanded in x around inf 71.9%
if -3.9999999999999999e31 < (/.f64 x y) < 0.0019499999999999999Initial program 89.5%
sub-neg89.5%
distribute-rgt-in89.5%
*-lft-identity89.5%
associate-+r+89.5%
cancel-sign-sub-inv89.5%
div-sub76.3%
associate-*r*76.3%
associate-*l/76.3%
*-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 z around inf 61.7%
associate--l+61.7%
associate-*r/61.7%
metadata-eval61.7%
Simplified61.7%
Taylor expanded in x around 0 60.6%
sub-neg60.6%
associate-*r/60.6%
metadata-eval60.6%
metadata-eval60.6%
Simplified60.6%
Final simplification65.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -6.5e+27) (/ x y) (if (<= (/ x y) 2.3e-6) (+ -2.0 (/ 2.0 t)) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -6.5e+27) {
tmp = x / y;
} else if ((x / y) <= 2.3e-6) {
tmp = -2.0 + (2.0 / t);
} else {
tmp = (x / y) - 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 ((x / y) <= (-6.5d+27)) then
tmp = x / y
else if ((x / y) <= 2.3d-6) then
tmp = (-2.0d0) + (2.0d0 / t)
else
tmp = (x / y) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -6.5e+27) {
tmp = x / y;
} else if ((x / y) <= 2.3e-6) {
tmp = -2.0 + (2.0 / t);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -6.5e+27: tmp = x / y elif (x / y) <= 2.3e-6: tmp = -2.0 + (2.0 / t) else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -6.5e+27) tmp = Float64(x / y); elseif (Float64(x / y) <= 2.3e-6) tmp = Float64(-2.0 + Float64(2.0 / t)); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -6.5e+27) tmp = x / y; elseif ((x / y) <= 2.3e-6) tmp = -2.0 + (2.0 / t); else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -6.5e+27], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.3e-6], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -6.5 \cdot 10^{+27}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2.3 \cdot 10^{-6}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -6.5000000000000005e27Initial program 90.8%
sub-neg90.8%
distribute-rgt-in90.8%
*-lft-identity90.8%
associate-+r+90.8%
cancel-sign-sub-inv90.8%
div-sub79.9%
associate-*r*79.9%
associate-*l/79.9%
*-inverses99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in x around inf 69.5%
if -6.5000000000000005e27 < (/.f64 x y) < 2.3e-6Initial program 89.5%
sub-neg89.5%
distribute-rgt-in89.5%
*-lft-identity89.5%
associate-+r+89.5%
cancel-sign-sub-inv89.5%
div-sub76.3%
associate-*r*76.3%
associate-*l/76.3%
*-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 z around inf 61.7%
associate--l+61.7%
associate-*r/61.7%
metadata-eval61.7%
Simplified61.7%
Taylor expanded in x around 0 60.6%
sub-neg60.6%
associate-*r/60.6%
metadata-eval60.6%
metadata-eval60.6%
Simplified60.6%
if 2.3e-6 < (/.f64 x y) Initial program 92.2%
sub-neg92.2%
distribute-rgt-in92.2%
*-lft-identity92.2%
associate-+r+92.2%
cancel-sign-sub-inv92.2%
div-sub83.0%
associate-*r*83.0%
associate-*l/83.0%
*-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 74.3%
Final simplification66.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -18000000000.0) (not (<= t 9.2e-64))) (- (/ x y) 2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -18000000000.0) || !(t <= 9.2e-64)) {
tmp = (x / y) - 2.0;
} 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 ((t <= (-18000000000.0d0)) .or. (.not. (t <= 9.2d-64))) then
tmp = (x / y) - 2.0d0
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 ((t <= -18000000000.0) || !(t <= 9.2e-64)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 + (2.0 / z)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -18000000000.0) or not (t <= 9.2e-64): tmp = (x / y) - 2.0 else: tmp = (2.0 + (2.0 / z)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -18000000000.0) || !(t <= 9.2e-64)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -18000000000.0) || ~((t <= 9.2e-64))) tmp = (x / y) - 2.0; else tmp = (2.0 + (2.0 / z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -18000000000.0], N[Not[LessEqual[t, 9.2e-64]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -18000000000 \lor \neg \left(t \leq 9.2 \cdot 10^{-64}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -1.8e10 or 9.2000000000000006e-64 < t Initial program 82.6%
sub-neg82.6%
distribute-rgt-in82.5%
*-lft-identity82.5%
associate-+r+82.5%
cancel-sign-sub-inv82.5%
div-sub81.8%
associate-*r*81.8%
associate-*l/81.8%
*-inverses99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate-/l/99.9%
Simplified100.0%
Taylor expanded in t around inf 84.1%
if -1.8e10 < t < 9.2000000000000006e-64Initial program 99.7%
sub-neg99.7%
distribute-rgt-in99.7%
*-lft-identity99.7%
associate-+r+99.7%
cancel-sign-sub-inv99.7%
div-sub75.2%
associate-*r*75.2%
associate-*l/75.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%
div-inv99.9%
fma-def99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 83.4%
associate-*r/83.4%
metadata-eval83.4%
Simplified83.4%
Final simplification83.8%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -7.8e+32) (/ x y) (if (<= (/ x y) 0.00195) (/ 2.0 t) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -7.8e+32) {
tmp = x / y;
} else if ((x / y) <= 0.00195) {
tmp = 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) <= (-7.8d+32)) then
tmp = x / y
else if ((x / y) <= 0.00195d0) then
tmp = 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) <= -7.8e+32) {
tmp = x / y;
} else if ((x / y) <= 0.00195) {
tmp = 2.0 / t;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -7.8e+32: tmp = x / y elif (x / y) <= 0.00195: tmp = 2.0 / t else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -7.8e+32) tmp = Float64(x / y); elseif (Float64(x / y) <= 0.00195) tmp = 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) <= -7.8e+32) tmp = x / y; elseif ((x / y) <= 0.00195) tmp = 2.0 / t; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -7.8e+32], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 0.00195], N[(2.0 / t), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -7.8 \cdot 10^{+32}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 0.00195:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -7.7999999999999998e32 or 0.0019499999999999999 < (/.f64 x y) Initial program 91.6%
sub-neg91.6%
distribute-rgt-in91.6%
*-lft-identity91.6%
associate-+r+91.6%
cancel-sign-sub-inv91.6%
div-sub81.6%
associate-*r*81.6%
associate-*l/81.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%
Taylor expanded in x around inf 71.9%
if -7.7999999999999998e32 < (/.f64 x y) < 0.0019499999999999999Initial program 89.5%
sub-neg89.5%
distribute-rgt-in89.5%
*-lft-identity89.5%
associate-+r+89.5%
cancel-sign-sub-inv89.5%
div-sub76.3%
associate-*r*76.3%
associate-*l/76.3%
*-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 z around inf 61.7%
associate--l+61.7%
associate-*r/61.7%
metadata-eval61.7%
Simplified61.7%
Taylor expanded in t around 0 26.2%
Final simplification47.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -18000000000.0) (not (<= t 6.2e-64))) (- (/ x y) 2.0) (/ 2.0 (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -18000000000.0) || !(t <= 6.2e-64)) {
tmp = (x / y) - 2.0;
} else {
tmp = 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 ((t <= (-18000000000.0d0)) .or. (.not. (t <= 6.2d-64))) then
tmp = (x / y) - 2.0d0
else
tmp = 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 ((t <= -18000000000.0) || !(t <= 6.2e-64)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -18000000000.0) or not (t <= 6.2e-64): tmp = (x / y) - 2.0 else: tmp = 2.0 / (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -18000000000.0) || !(t <= 6.2e-64)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(2.0 / Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -18000000000.0) || ~((t <= 6.2e-64))) tmp = (x / y) - 2.0; else tmp = 2.0 / (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -18000000000.0], N[Not[LessEqual[t, 6.2e-64]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -18000000000 \lor \neg \left(t \leq 6.2 \cdot 10^{-64}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\end{array}
\end{array}
if t < -1.8e10 or 6.20000000000000049e-64 < t Initial program 82.6%
sub-neg82.6%
distribute-rgt-in82.5%
*-lft-identity82.5%
associate-+r+82.5%
cancel-sign-sub-inv82.5%
div-sub81.8%
associate-*r*81.8%
associate-*l/81.8%
*-inverses99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate-/l/99.9%
Simplified100.0%
Taylor expanded in t around inf 84.1%
if -1.8e10 < t < 6.20000000000000049e-64Initial program 99.7%
sub-neg99.7%
distribute-rgt-in99.7%
*-lft-identity99.7%
associate-+r+99.7%
cancel-sign-sub-inv99.7%
div-sub75.2%
associate-*r*75.2%
associate-*l/75.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%
div-inv99.9%
fma-def99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 53.1%
Final simplification69.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -38000000000.0) (not (<= t 7.2e-66))) (- (/ x y) 2.0) (/ (/ 2.0 z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -38000000000.0) || !(t <= 7.2e-66)) {
tmp = (x / y) - 2.0;
} else {
tmp = (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 ((t <= (-38000000000.0d0)) .or. (.not. (t <= 7.2d-66))) then
tmp = (x / y) - 2.0d0
else
tmp = (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 ((t <= -38000000000.0) || !(t <= 7.2e-66)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 / z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -38000000000.0) or not (t <= 7.2e-66): tmp = (x / y) - 2.0 else: tmp = (2.0 / z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -38000000000.0) || !(t <= 7.2e-66)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(Float64(2.0 / z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -38000000000.0) || ~((t <= 7.2e-66))) tmp = (x / y) - 2.0; else tmp = (2.0 / z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -38000000000.0], N[Not[LessEqual[t, 7.2e-66]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -38000000000 \lor \neg \left(t \leq 7.2 \cdot 10^{-66}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -3.8e10 or 7.20000000000000025e-66 < t Initial program 82.6%
sub-neg82.6%
distribute-rgt-in82.5%
*-lft-identity82.5%
associate-+r+82.5%
cancel-sign-sub-inv82.5%
div-sub81.8%
associate-*r*81.8%
associate-*l/81.8%
*-inverses99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate-/l/99.9%
Simplified100.0%
Taylor expanded in t around inf 84.1%
if -3.8e10 < t < 7.20000000000000025e-66Initial program 99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
distribute-rgt1-in99.7%
*-commutative99.7%
times-frac99.9%
fma-def99.9%
*-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around 0 83.2%
Taylor expanded in z around 0 53.1%
associate-/l/53.2%
Simplified53.2%
associate-*r/53.2%
div-inv53.2%
Applied egg-rr53.2%
Final simplification69.9%
(FPCore (x y z t) :precision binary64 (/ 2.0 t))
double code(double x, double y, double z, double t) {
return 2.0 / t;
}
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 / t
end function
public static double code(double x, double y, double z, double t) {
return 2.0 / t;
}
def code(x, y, z, t): return 2.0 / t
function code(x, y, z, t) return Float64(2.0 / t) end
function tmp = code(x, y, z, t) tmp = 2.0 / t; end
code[x_, y_, z_, t_] := N[(2.0 / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{t}
\end{array}
Initial program 90.5%
sub-neg90.5%
distribute-rgt-in90.5%
*-lft-identity90.5%
associate-+r+90.5%
cancel-sign-sub-inv90.5%
div-sub78.7%
associate-*r*78.7%
associate-*l/78.7%
*-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 z around inf 69.7%
associate--l+69.7%
associate-*r/69.7%
metadata-eval69.7%
Simplified69.7%
Taylor expanded in t around 0 17.7%
Final simplification17.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 2023257
(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))))