
(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 10 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 (let* ((t_1 (+ (/ x y) (/ (+ 2.0 (* (* 2.0 z) (- 1.0 t))) (* z t))))) (if (<= t_1 INFINITY) t_1 (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) + ((2.0 + ((2.0 * z) * (1.0 - t))) / (z * t));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) + ((2.0 + ((2.0 * z) * (1.0 - t))) / (z * t));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) + ((2.0 + ((2.0 * z) * (1.0 - t))) / (z * t)) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(2.0 * z) * Float64(1.0 - t))) / Float64(z * t))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) + ((2.0 + ((2.0 * z) * (1.0 - t))) / (z * t)); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(2.0 * z), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + \frac{2 + \left(2 \cdot z\right) \cdot \left(1 - t\right)}{z \cdot t}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) < +inf.0Initial program 99.8%
if +inf.0 < (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) Initial program 0.0%
Taylor expanded in t around inf 100.0%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= t -5.6e+28)
t_1
(if (<= t 2e+27)
(/ (+ 2.0 (/ 2.0 z)) t)
(if (or (<= t 1.6e+73) (not (<= t 2.55e+88))) t_1 (/ (/ 2.0 t) z))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (t <= -5.6e+28) {
tmp = t_1;
} else if (t <= 2e+27) {
tmp = (2.0 + (2.0 / z)) / t;
} else if ((t <= 1.6e+73) || !(t <= 2.55e+88)) {
tmp = t_1;
} else {
tmp = (2.0 / t) / z;
}
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 <= (-5.6d+28)) then
tmp = t_1
else if (t <= 2d+27) then
tmp = (2.0d0 + (2.0d0 / z)) / t
else if ((t <= 1.6d+73) .or. (.not. (t <= 2.55d+88))) then
tmp = t_1
else
tmp = (2.0d0 / t) / z
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 <= -5.6e+28) {
tmp = t_1;
} else if (t <= 2e+27) {
tmp = (2.0 + (2.0 / z)) / t;
} else if ((t <= 1.6e+73) || !(t <= 2.55e+88)) {
tmp = t_1;
} else {
tmp = (2.0 / t) / z;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if t <= -5.6e+28: tmp = t_1 elif t <= 2e+27: tmp = (2.0 + (2.0 / z)) / t elif (t <= 1.6e+73) or not (t <= 2.55e+88): tmp = t_1 else: tmp = (2.0 / t) / z return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -5.6e+28) tmp = t_1; elseif (t <= 2e+27) tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); elseif ((t <= 1.6e+73) || !(t <= 2.55e+88)) tmp = t_1; else tmp = Float64(Float64(2.0 / t) / z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (t <= -5.6e+28) tmp = t_1; elseif (t <= 2e+27) tmp = (2.0 + (2.0 / z)) / t; elseif ((t <= 1.6e+73) || ~((t <= 2.55e+88))) tmp = t_1; else tmp = (2.0 / t) / z; 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, -5.6e+28], t$95$1, If[LessEqual[t, 2e+27], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[t, 1.6e+73], N[Not[LessEqual[t, 2.55e+88]], $MachinePrecision]], t$95$1, N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -5.6 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+27}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+73} \lor \neg \left(t \leq 2.55 \cdot 10^{+88}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if t < -5.6000000000000003e28 or 2e27 < t < 1.59999999999999991e73 or 2.5499999999999999e88 < t Initial program 72.9%
Taylor expanded in t around inf 85.8%
if -5.6000000000000003e28 < t < 2e27Initial program 97.1%
Taylor expanded in t around 0 74.4%
associate-*r/74.4%
metadata-eval74.4%
Simplified74.4%
if 1.59999999999999991e73 < t < 2.5499999999999999e88Initial program 99.7%
+-commutative99.7%
associate-/r*100.0%
frac-add83.5%
+-commutative83.5%
fma-define83.5%
*-commutative83.5%
Applied egg-rr83.5%
Taylor expanded in z around 0 83.7%
associate-*r/83.7%
Simplified83.7%
Taylor expanded in y around inf 99.7%
associate-/r*100.0%
Simplified100.0%
Final simplification79.3%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -22000000000.0) (/ x y) (if (<= (/ x y) 9.2e-72) -2.0 (if (<= (/ x y) 4.8e+28) (/ 2.0 t) (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -22000000000.0) {
tmp = x / y;
} else if ((x / y) <= 9.2e-72) {
tmp = -2.0;
} else if ((x / y) <= 4.8e+28) {
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) <= (-22000000000.0d0)) then
tmp = x / y
else if ((x / y) <= 9.2d-72) then
tmp = -2.0d0
else if ((x / y) <= 4.8d+28) 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) <= -22000000000.0) {
tmp = x / y;
} else if ((x / y) <= 9.2e-72) {
tmp = -2.0;
} else if ((x / y) <= 4.8e+28) {
tmp = 2.0 / t;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -22000000000.0: tmp = x / y elif (x / y) <= 9.2e-72: tmp = -2.0 elif (x / y) <= 4.8e+28: tmp = 2.0 / t else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -22000000000.0) tmp = Float64(x / y); elseif (Float64(x / y) <= 9.2e-72) tmp = -2.0; elseif (Float64(x / y) <= 4.8e+28) 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) <= -22000000000.0) tmp = x / y; elseif ((x / y) <= 9.2e-72) tmp = -2.0; elseif ((x / y) <= 4.8e+28) tmp = 2.0 / t; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -22000000000.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 9.2e-72], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 4.8e+28], N[(2.0 / t), $MachinePrecision], N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -22000000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 9.2 \cdot 10^{-72}:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq 4.8 \cdot 10^{+28}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -2.2e10 or 4.79999999999999962e28 < (/.f64 x y) Initial program 84.1%
Taylor expanded in x around inf 67.0%
if -2.2e10 < (/.f64 x y) < 9.19999999999999978e-72Initial program 90.6%
+-commutative90.6%
associate-/r*80.1%
frac-add64.3%
+-commutative64.3%
fma-define64.3%
*-commutative64.3%
Applied egg-rr64.3%
Taylor expanded in y around -inf 90.0%
Taylor expanded in t around inf 31.9%
if 9.19999999999999978e-72 < (/.f64 x y) < 4.79999999999999962e28Initial program 99.5%
Taylor expanded in t around 0 79.0%
associate-*r/79.0%
metadata-eval79.0%
Simplified79.0%
Taylor expanded in z around inf 54.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.7e-9) (not (<= z 0.00018))) (+ (/ x y) (+ (/ 2.0 t) -2.0)) (+ (/ x y) (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.7e-9) || !(z <= 0.00018)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
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 <= (-6.7d-9)) .or. (.not. (z <= 0.00018d0))) then
tmp = (x / y) + ((2.0d0 / t) + (-2.0d0))
else
tmp = (x / y) + ((2.0d0 / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.7e-9) || !(z <= 0.00018)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.7e-9) or not (z <= 0.00018): tmp = (x / y) + ((2.0 / t) + -2.0) else: tmp = (x / y) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.7e-9) || !(z <= 0.00018)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); else tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.7e-9) || ~((z <= 0.00018))) tmp = (x / y) + ((2.0 / t) + -2.0); else tmp = (x / y) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.7e-9], N[Not[LessEqual[z, 0.00018]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.7 \cdot 10^{-9} \lor \neg \left(z \leq 0.00018\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if z < -6.69999999999999961e-9 or 1.80000000000000011e-4 < z Initial program 77.3%
Taylor expanded in z around inf 99.2%
div-sub99.2%
sub-neg99.2%
*-inverses99.2%
metadata-eval99.2%
distribute-lft-in99.2%
associate-*r/99.2%
metadata-eval99.2%
metadata-eval99.2%
Simplified99.2%
if -6.69999999999999961e-9 < z < 1.80000000000000011e-4Initial program 97.6%
Taylor expanded in z around 0 86.4%
associate-/r*86.4%
Simplified86.4%
Final simplification92.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.05e-84) (not (<= z 0.00018))) (+ (/ x y) (+ (/ 2.0 t) -2.0)) (* 2.0 (/ (+ z 1.0) (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.05e-84) || !(z <= 0.00018)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = 2.0 * ((z + 1.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.05d-84)) .or. (.not. (z <= 0.00018d0))) then
tmp = (x / y) + ((2.0d0 / t) + (-2.0d0))
else
tmp = 2.0d0 * ((z + 1.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.05e-84) || !(z <= 0.00018)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = 2.0 * ((z + 1.0) / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.05e-84) or not (z <= 0.00018): tmp = (x / y) + ((2.0 / t) + -2.0) else: tmp = 2.0 * ((z + 1.0) / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.05e-84) || !(z <= 0.00018)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); else tmp = Float64(2.0 * Float64(Float64(z + 1.0) / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.05e-84) || ~((z <= 0.00018))) tmp = (x / y) + ((2.0 / t) + -2.0); else tmp = 2.0 * ((z + 1.0) / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.05e-84], N[Not[LessEqual[z, 0.00018]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(z + 1.0), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{-84} \lor \neg \left(z \leq 0.00018\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{z + 1}{z \cdot t}\\
\end{array}
\end{array}
if z < -1.04999999999999999e-84 or 1.80000000000000011e-4 < z Initial program 80.0%
Taylor expanded in z around inf 95.6%
div-sub95.6%
sub-neg95.6%
*-inverses95.6%
metadata-eval95.6%
distribute-lft-in95.6%
associate-*r/95.6%
metadata-eval95.6%
metadata-eval95.6%
Simplified95.6%
if -1.04999999999999999e-84 < z < 1.80000000000000011e-4Initial program 97.3%
+-commutative97.3%
remove-double-neg97.3%
distribute-frac-neg97.3%
unsub-neg97.3%
*-commutative97.3%
associate-*r*97.3%
distribute-rgt1-in97.3%
associate-/l*97.3%
fma-neg97.3%
*-commutative97.3%
fma-define97.3%
*-commutative97.3%
distribute-frac-neg97.3%
remove-double-neg97.3%
Simplified97.3%
Taylor expanded in t around 0 73.8%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1.1e+25) (not (<= (/ x y) 1.5e+28))) (/ x y) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1.1e+25) || !((x / y) <= 1.5e+28)) {
tmp = x / y;
} else {
tmp = (2.0 / t) + -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) <= (-1.1d+25)) .or. (.not. ((x / y) <= 1.5d+28))) then
tmp = x / y
else
tmp = (2.0d0 / t) + (-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) <= -1.1e+25) || !((x / y) <= 1.5e+28)) {
tmp = x / y;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1.1e+25) or not ((x / y) <= 1.5e+28): tmp = x / y else: tmp = (2.0 / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1.1e+25) || !(Float64(x / y) <= 1.5e+28)) tmp = Float64(x / y); else tmp = Float64(Float64(2.0 / t) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -1.1e+25) || ~(((x / y) <= 1.5e+28))) tmp = x / y; else tmp = (2.0 / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1.1e+25], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1.5e+28]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.1 \cdot 10^{+25} \lor \neg \left(\frac{x}{y} \leq 1.5 \cdot 10^{+28}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -1.1e25 or 1.5e28 < (/.f64 x y) Initial program 83.8%
Taylor expanded in x around inf 68.1%
if -1.1e25 < (/.f64 x y) < 1.5e28Initial program 91.8%
+-commutative91.8%
associate-/r*79.3%
frac-add65.4%
+-commutative65.4%
fma-define65.4%
*-commutative65.4%
Applied egg-rr65.4%
Taylor expanded in y around -inf 90.3%
Taylor expanded in z around inf 53.8%
div-sub53.8%
sub-neg53.8%
*-inverses53.8%
metadata-eval53.8%
distribute-lft-in53.8%
metadata-eval53.8%
associate-*r/53.8%
metadata-eval53.8%
Simplified53.8%
Final simplification60.4%
(FPCore (x y z t) :precision binary64 (if (<= z -2.7e-85) (- (/ x y) 2.0) (if (<= z 0.00022) (/ (/ 2.0 t) z) (+ (/ 2.0 t) -2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.7e-85) {
tmp = (x / y) - 2.0;
} else if (z <= 0.00022) {
tmp = (2.0 / t) / z;
} else {
tmp = (2.0 / t) + -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 (z <= (-2.7d-85)) then
tmp = (x / y) - 2.0d0
else if (z <= 0.00022d0) then
tmp = (2.0d0 / t) / z
else
tmp = (2.0d0 / t) + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.7e-85) {
tmp = (x / y) - 2.0;
} else if (z <= 0.00022) {
tmp = (2.0 / t) / z;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.7e-85: tmp = (x / y) - 2.0 elif z <= 0.00022: tmp = (2.0 / t) / z else: tmp = (2.0 / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.7e-85) tmp = Float64(Float64(x / y) - 2.0); elseif (z <= 0.00022) tmp = Float64(Float64(2.0 / t) / z); else tmp = Float64(Float64(2.0 / t) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.7e-85) tmp = (x / y) - 2.0; elseif (z <= 0.00022) tmp = (2.0 / t) / z; else tmp = (2.0 / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.7e-85], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], If[LessEqual[z, 0.00022], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-85}:\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{elif}\;z \leq 0.00022:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if z < -2.7000000000000001e-85Initial program 79.4%
Taylor expanded in t around inf 73.0%
if -2.7000000000000001e-85 < z < 2.20000000000000008e-4Initial program 97.3%
+-commutative97.3%
associate-/r*97.3%
frac-add84.1%
+-commutative84.1%
fma-define84.1%
*-commutative84.1%
Applied egg-rr84.1%
Taylor expanded in z around 0 73.2%
associate-*r/73.2%
Simplified73.2%
Taylor expanded in y around inf 73.2%
associate-/r*73.3%
Simplified73.3%
if 2.20000000000000008e-4 < z Initial program 80.9%
+-commutative80.9%
associate-/r*53.0%
frac-add40.5%
+-commutative40.5%
fma-define40.5%
*-commutative40.5%
Applied egg-rr40.5%
Taylor expanded in y around -inf 54.1%
Taylor expanded in z around inf 58.6%
div-sub58.6%
sub-neg58.6%
*-inverses58.6%
metadata-eval58.6%
distribute-lft-in58.6%
metadata-eval58.6%
associate-*r/58.6%
metadata-eval58.6%
Simplified58.6%
(FPCore (x y z t) :precision binary64 (if (<= z -3.2e-84) (- (/ x y) 2.0) (if (<= z 0.00115) (/ 2.0 (* z t)) (+ (/ 2.0 t) -2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.2e-84) {
tmp = (x / y) - 2.0;
} else if (z <= 0.00115) {
tmp = 2.0 / (z * t);
} else {
tmp = (2.0 / t) + -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 (z <= (-3.2d-84)) then
tmp = (x / y) - 2.0d0
else if (z <= 0.00115d0) then
tmp = 2.0d0 / (z * t)
else
tmp = (2.0d0 / t) + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.2e-84) {
tmp = (x / y) - 2.0;
} else if (z <= 0.00115) {
tmp = 2.0 / (z * t);
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.2e-84: tmp = (x / y) - 2.0 elif z <= 0.00115: tmp = 2.0 / (z * t) else: tmp = (2.0 / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.2e-84) tmp = Float64(Float64(x / y) - 2.0); elseif (z <= 0.00115) tmp = Float64(2.0 / Float64(z * t)); else tmp = Float64(Float64(2.0 / t) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.2e-84) tmp = (x / y) - 2.0; elseif (z <= 0.00115) tmp = 2.0 / (z * t); else tmp = (2.0 / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.2e-84], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], If[LessEqual[z, 0.00115], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-84}:\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{elif}\;z \leq 0.00115:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if z < -3.1999999999999999e-84Initial program 79.4%
Taylor expanded in t around inf 73.0%
if -3.1999999999999999e-84 < z < 0.00115Initial program 97.3%
Taylor expanded in z around 0 86.3%
associate-/r*86.4%
Simplified86.4%
Taylor expanded in x around 0 73.2%
if 0.00115 < z Initial program 80.9%
+-commutative80.9%
associate-/r*53.0%
frac-add40.5%
+-commutative40.5%
fma-define40.5%
*-commutative40.5%
Applied egg-rr40.5%
Taylor expanded in y around -inf 54.1%
Taylor expanded in z around inf 58.6%
div-sub58.6%
sub-neg58.6%
*-inverses58.6%
metadata-eval58.6%
distribute-lft-in58.6%
metadata-eval58.6%
associate-*r/58.6%
metadata-eval58.6%
Simplified58.6%
Final simplification70.1%
(FPCore (x y z t) :precision binary64 (if (<= t -1.0) -2.0 (if (<= t 27000000.0) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.0) {
tmp = -2.0;
} else if (t <= 27000000.0) {
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 <= (-1.0d0)) then
tmp = -2.0d0
else if (t <= 27000000.0d0) 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 <= -1.0) {
tmp = -2.0;
} else if (t <= 27000000.0) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.0: tmp = -2.0 elif t <= 27000000.0: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.0) tmp = -2.0; elseif (t <= 27000000.0) 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 <= -1.0) tmp = -2.0; elseif (t <= 27000000.0) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.0], -2.0, If[LessEqual[t, 27000000.0], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 27000000:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -1 or 2.7e7 < t Initial program 76.0%
+-commutative76.0%
associate-/r*81.7%
frac-add62.8%
+-commutative62.8%
fma-define62.8%
*-commutative62.8%
Applied egg-rr62.8%
Taylor expanded in y around -inf 47.3%
Taylor expanded in t around inf 35.2%
if -1 < t < 2.7e7Initial program 97.6%
Taylor expanded in t around 0 76.1%
associate-*r/76.1%
metadata-eval76.1%
Simplified76.1%
Taylor expanded in z around inf 29.8%
(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 88.1%
+-commutative88.1%
associate-/r*77.8%
frac-add63.9%
+-commutative63.9%
fma-define63.9%
*-commutative63.9%
Applied egg-rr63.9%
Taylor expanded in y around -inf 64.1%
Taylor expanded in t around inf 17.0%
(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 2024100
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:alt
(- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))