
(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 12 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 t) -2.0) (/ 2.0 (* t z)))))
double code(double x, double y, double z, double t) {
return fma(x, (1.0 / y), (((2.0 / t) + -2.0) + (2.0 / (t * z))));
}
function code(x, y, z, t) return fma(x, Float64(1.0 / y), Float64(Float64(Float64(2.0 / t) + -2.0) + Float64(2.0 / Float64(t * z)))) end
code[x_, y_, z_, t_] := N[(x * N[(1.0 / y), $MachinePrecision] + N[(N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision] + N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \frac{1}{y}, \left(\frac{2}{t} + -2\right) + \frac{2}{t \cdot z}\right)
\end{array}
Initial program 85.7%
Taylor expanded in z around 0 98.3%
div-sub98.3%
sub-neg98.3%
*-inverses98.3%
metadata-eval98.3%
distribute-lft-in98.3%
associate-*r/98.3%
metadata-eval98.3%
metadata-eval98.3%
associate-*r/98.3%
metadata-eval98.3%
Simplified98.3%
div-inv98.2%
fma-def99.0%
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -100000000.0) (not (<= (/ x y) 0.05))) (+ (/ x y) (/ (+ 2.0 (* 2.0 z)) (* t z))) (+ (+ (/ 2.0 t) -2.0) (/ 2.0 (* t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -100000000.0) || !((x / y) <= 0.05)) {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (t * z));
} else {
tmp = ((2.0 / t) + -2.0) + (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 (((x / y) <= (-100000000.0d0)) .or. (.not. ((x / y) <= 0.05d0))) then
tmp = (x / y) + ((2.0d0 + (2.0d0 * z)) / (t * z))
else
tmp = ((2.0d0 / t) + (-2.0d0)) + (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 (((x / y) <= -100000000.0) || !((x / y) <= 0.05)) {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (t * z));
} else {
tmp = ((2.0 / t) + -2.0) + (2.0 / (t * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -100000000.0) or not ((x / y) <= 0.05): tmp = (x / y) + ((2.0 + (2.0 * z)) / (t * z)) else: tmp = ((2.0 / t) + -2.0) + (2.0 / (t * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -100000000.0) || !(Float64(x / y) <= 0.05)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(2.0 * z)) / Float64(t * z))); else tmp = Float64(Float64(Float64(2.0 / t) + -2.0) + Float64(2.0 / Float64(t * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -100000000.0) || ~(((x / y) <= 0.05))) tmp = (x / y) + ((2.0 + (2.0 * z)) / (t * z)); else tmp = ((2.0 / t) + -2.0) + (2.0 / (t * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -100000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.05]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision] + N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -100000000 \lor \neg \left(\frac{x}{y} \leq 0.05\right):\\
\;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{2}{t} + -2\right) + \frac{2}{t \cdot z}\\
\end{array}
\end{array}
if (/.f64 x y) < -1e8 or 0.050000000000000003 < (/.f64 x y) Initial program 83.8%
Taylor expanded in t around 0 96.3%
if -1e8 < (/.f64 x y) < 0.050000000000000003Initial program 87.8%
Taylor expanded in z around 0 99.9%
div-sub99.9%
sub-neg99.9%
*-inverses99.9%
metadata-eval99.9%
distribute-lft-in99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 98.4%
sub-neg98.4%
associate-*r/98.4%
metadata-eval98.4%
associate-*r/98.4%
metadata-eval98.4%
metadata-eval98.4%
+-commutative98.4%
associate-+r+98.4%
+-commutative98.4%
Simplified98.4%
Final simplification97.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)) (t_2 (+ (/ 2.0 t) -2.0)))
(if (<= z -1.2e+77)
t_2
(if (<= z -1.4e-59)
t_1
(if (<= z 8.5e-169)
(/ 2.0 (* t z))
(if (or (<= z 4.4e+82) (and (not (<= z 3.3e+134)) (<= z 1.25e+196)))
t_1
t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double t_2 = (2.0 / t) + -2.0;
double tmp;
if (z <= -1.2e+77) {
tmp = t_2;
} else if (z <= -1.4e-59) {
tmp = t_1;
} else if (z <= 8.5e-169) {
tmp = 2.0 / (t * z);
} else if ((z <= 4.4e+82) || (!(z <= 3.3e+134) && (z <= 1.25e+196))) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (x / y) - 2.0d0
t_2 = (2.0d0 / t) + (-2.0d0)
if (z <= (-1.2d+77)) then
tmp = t_2
else if (z <= (-1.4d-59)) then
tmp = t_1
else if (z <= 8.5d-169) then
tmp = 2.0d0 / (t * z)
else if ((z <= 4.4d+82) .or. (.not. (z <= 3.3d+134)) .and. (z <= 1.25d+196)) then
tmp = t_1
else
tmp = t_2
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 t_2 = (2.0 / t) + -2.0;
double tmp;
if (z <= -1.2e+77) {
tmp = t_2;
} else if (z <= -1.4e-59) {
tmp = t_1;
} else if (z <= 8.5e-169) {
tmp = 2.0 / (t * z);
} else if ((z <= 4.4e+82) || (!(z <= 3.3e+134) && (z <= 1.25e+196))) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 t_2 = (2.0 / t) + -2.0 tmp = 0 if z <= -1.2e+77: tmp = t_2 elif z <= -1.4e-59: tmp = t_1 elif z <= 8.5e-169: tmp = 2.0 / (t * z) elif (z <= 4.4e+82) or (not (z <= 3.3e+134) and (z <= 1.25e+196)): tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) t_2 = Float64(Float64(2.0 / t) + -2.0) tmp = 0.0 if (z <= -1.2e+77) tmp = t_2; elseif (z <= -1.4e-59) tmp = t_1; elseif (z <= 8.5e-169) tmp = Float64(2.0 / Float64(t * z)); elseif ((z <= 4.4e+82) || (!(z <= 3.3e+134) && (z <= 1.25e+196))) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; t_2 = (2.0 / t) + -2.0; tmp = 0.0; if (z <= -1.2e+77) tmp = t_2; elseif (z <= -1.4e-59) tmp = t_1; elseif (z <= 8.5e-169) tmp = 2.0 / (t * z); elseif ((z <= 4.4e+82) || (~((z <= 3.3e+134)) && (z <= 1.25e+196))) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]}, If[LessEqual[z, -1.2e+77], t$95$2, If[LessEqual[z, -1.4e-59], t$95$1, If[LessEqual[z, 8.5e-169], N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 4.4e+82], And[N[Not[LessEqual[z, 3.3e+134]], $MachinePrecision], LessEqual[z, 1.25e+196]]], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
t_2 := \frac{2}{t} + -2\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+77}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -1.4 \cdot 10^{-59}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-169}:\\
\;\;\;\;\frac{2}{t \cdot z}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+82} \lor \neg \left(z \leq 3.3 \cdot 10^{+134}\right) \land z \leq 1.25 \cdot 10^{+196}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -1.1999999999999999e77 or 4.4000000000000002e82 < z < 3.3e134 or 1.2499999999999999e196 < z Initial program 70.7%
Taylor expanded in z around inf 100.0%
div-sub100.0%
sub-neg100.0%
*-inverses100.0%
metadata-eval100.0%
distribute-lft-in100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
div-inv99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 76.2%
sub-neg76.2%
associate-*r/76.2%
metadata-eval76.2%
metadata-eval76.2%
Simplified76.2%
if -1.1999999999999999e77 < z < -1.3999999999999999e-59 or 8.50000000000000054e-169 < z < 4.4000000000000002e82 or 3.3e134 < z < 1.2499999999999999e196Initial program 89.3%
Taylor expanded in t around inf 67.2%
if -1.3999999999999999e-59 < z < 8.50000000000000054e-169Initial program 96.4%
Taylor expanded in z around 0 96.4%
div-sub96.4%
sub-neg96.4%
*-inverses96.4%
metadata-eval96.4%
distribute-lft-in96.4%
associate-*r/96.4%
metadata-eval96.4%
metadata-eval96.4%
associate-*r/96.4%
metadata-eval96.4%
Simplified96.4%
Taylor expanded in z around 0 75.0%
Final simplification72.8%
(FPCore (x y z t) :precision binary64 (+ (+ (+ (/ 2.0 t) -2.0) (/ 2.0 (* t z))) (/ x y)))
double code(double x, double y, double z, double t) {
return (((2.0 / t) + -2.0) + (2.0 / (t * z))) + (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 / t) + (-2.0d0)) + (2.0d0 / (t * z))) + (x / y)
end function
public static double code(double x, double y, double z, double t) {
return (((2.0 / t) + -2.0) + (2.0 / (t * z))) + (x / y);
}
def code(x, y, z, t): return (((2.0 / t) + -2.0) + (2.0 / (t * z))) + (x / y)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(2.0 / t) + -2.0) + Float64(2.0 / Float64(t * z))) + Float64(x / y)) end
function tmp = code(x, y, z, t) tmp = (((2.0 / t) + -2.0) + (2.0 / (t * z))) + (x / y); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision] + N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{2}{t} + -2\right) + \frac{2}{t \cdot z}\right) + \frac{x}{y}
\end{array}
Initial program 85.7%
Taylor expanded in z around 0 98.3%
div-sub98.3%
sub-neg98.3%
*-inverses98.3%
metadata-eval98.3%
distribute-lft-in98.3%
associate-*r/98.3%
metadata-eval98.3%
metadata-eval98.3%
associate-*r/98.3%
metadata-eval98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ 2.0 t) (/ x y))))
(if (<= z -1.4e-58)
t_1
(if (<= z 8e-169)
(/ 2.0 (* t z))
(if (<= z 3.6e+16) (- (/ x y) 2.0) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (2.0 / t) + (x / y);
double tmp;
if (z <= -1.4e-58) {
tmp = t_1;
} else if (z <= 8e-169) {
tmp = 2.0 / (t * z);
} else if (z <= 3.6e+16) {
tmp = (x / y) - 2.0;
} 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 = (2.0d0 / t) + (x / y)
if (z <= (-1.4d-58)) then
tmp = t_1
else if (z <= 8d-169) then
tmp = 2.0d0 / (t * z)
else if (z <= 3.6d+16) then
tmp = (x / y) - 2.0d0
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 = (2.0 / t) + (x / y);
double tmp;
if (z <= -1.4e-58) {
tmp = t_1;
} else if (z <= 8e-169) {
tmp = 2.0 / (t * z);
} else if (z <= 3.6e+16) {
tmp = (x / y) - 2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (2.0 / t) + (x / y) tmp = 0 if z <= -1.4e-58: tmp = t_1 elif z <= 8e-169: tmp = 2.0 / (t * z) elif z <= 3.6e+16: tmp = (x / y) - 2.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(2.0 / t) + Float64(x / y)) tmp = 0.0 if (z <= -1.4e-58) tmp = t_1; elseif (z <= 8e-169) tmp = Float64(2.0 / Float64(t * z)); elseif (z <= 3.6e+16) tmp = Float64(Float64(x / y) - 2.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (2.0 / t) + (x / y); tmp = 0.0; if (z <= -1.4e-58) tmp = t_1; elseif (z <= 8e-169) tmp = 2.0 / (t * z); elseif (z <= 3.6e+16) tmp = (x / y) - 2.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 / t), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.4e-58], t$95$1, If[LessEqual[z, 8e-169], N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e+16], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2}{t} + \frac{x}{y}\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{-58}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-169}:\\
\;\;\;\;\frac{2}{t \cdot z}\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.4e-58 or 3.6e16 < z Initial program 75.9%
Taylor expanded in t around 0 80.1%
Taylor expanded in z around inf 77.5%
associate-*r/77.5%
metadata-eval77.5%
+-commutative77.5%
Simplified77.5%
if -1.4e-58 < z < 8.00000000000000016e-169Initial program 96.4%
Taylor expanded in z around 0 96.4%
div-sub96.4%
sub-neg96.4%
*-inverses96.4%
metadata-eval96.4%
distribute-lft-in96.4%
associate-*r/96.4%
metadata-eval96.4%
metadata-eval96.4%
associate-*r/96.4%
metadata-eval96.4%
Simplified96.4%
Taylor expanded in z around 0 75.0%
if 8.00000000000000016e-169 < z < 3.6e16Initial program 97.0%
Taylor expanded in t around inf 62.6%
Final simplification74.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.2e-59) (not (<= z 2.8e-169))) (+ (+ (/ 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 <= -5.2e-59) || !(z <= 2.8e-169)) {
tmp = ((2.0 / t) + -2.0) + (x / y);
} 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) :: tmp
if ((z <= (-5.2d-59)) .or. (.not. (z <= 2.8d-169))) then
tmp = ((2.0d0 / t) + (-2.0d0)) + (x / y)
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 tmp;
if ((z <= -5.2e-59) || !(z <= 2.8e-169)) {
tmp = ((2.0 / t) + -2.0) + (x / y);
} else {
tmp = 2.0 / (t * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.2e-59) or not (z <= 2.8e-169): tmp = ((2.0 / t) + -2.0) + (x / y) else: tmp = 2.0 / (t * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.2e-59) || !(z <= 2.8e-169)) tmp = Float64(Float64(Float64(2.0 / t) + -2.0) + Float64(x / y)); else tmp = Float64(2.0 / Float64(t * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.2e-59) || ~((z <= 2.8e-169))) tmp = ((2.0 / t) + -2.0) + (x / y); else tmp = 2.0 / (t * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.2e-59], N[Not[LessEqual[z, 2.8e-169]], $MachinePrecision]], N[(N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-59} \lor \neg \left(z \leq 2.8 \cdot 10^{-169}\right):\\
\;\;\;\;\left(\frac{2}{t} + -2\right) + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z}\\
\end{array}
\end{array}
if z < -5.19999999999999996e-59 or 2.79999999999999988e-169 < z Initial program 80.1%
Taylor expanded in z around inf 90.6%
div-sub90.6%
sub-neg90.6%
*-inverses90.6%
metadata-eval90.6%
distribute-lft-in90.6%
associate-*r/90.6%
metadata-eval90.6%
metadata-eval90.6%
Simplified90.6%
if -5.19999999999999996e-59 < z < 2.79999999999999988e-169Initial program 96.4%
Taylor expanded in z around 0 96.4%
div-sub96.4%
sub-neg96.4%
*-inverses96.4%
metadata-eval96.4%
distribute-lft-in96.4%
associate-*r/96.4%
metadata-eval96.4%
metadata-eval96.4%
associate-*r/96.4%
metadata-eval96.4%
Simplified96.4%
Taylor expanded in z around 0 75.0%
Final simplification85.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.5e-7) (not (<= z 2.7e-87))) (+ (+ (/ 2.0 t) -2.0) (/ x y)) (+ (/ 2.0 (* t z)) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e-7) || !(z <= 2.7e-87)) {
tmp = ((2.0 / t) + -2.0) + (x / y);
} else {
tmp = (2.0 / (t * z)) + (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 ((z <= (-7.5d-7)) .or. (.not. (z <= 2.7d-87))) then
tmp = ((2.0d0 / t) + (-2.0d0)) + (x / y)
else
tmp = (2.0d0 / (t * z)) + (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e-7) || !(z <= 2.7e-87)) {
tmp = ((2.0 / t) + -2.0) + (x / y);
} else {
tmp = (2.0 / (t * z)) + (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.5e-7) or not (z <= 2.7e-87): tmp = ((2.0 / t) + -2.0) + (x / y) else: tmp = (2.0 / (t * z)) + (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.5e-7) || !(z <= 2.7e-87)) tmp = Float64(Float64(Float64(2.0 / t) + -2.0) + Float64(x / y)); else tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.5e-7) || ~((z <= 2.7e-87))) tmp = ((2.0 / t) + -2.0) + (x / y); else tmp = (2.0 / (t * z)) + (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.5e-7], N[Not[LessEqual[z, 2.7e-87]], $MachinePrecision]], N[(N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-7} \lor \neg \left(z \leq 2.7 \cdot 10^{-87}\right):\\
\;\;\;\;\left(\frac{2}{t} + -2\right) + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{x}{y}\\
\end{array}
\end{array}
if z < -7.5000000000000002e-7 or 2.69999999999999984e-87 < z Initial program 77.4%
Taylor expanded in z around inf 96.4%
div-sub96.4%
sub-neg96.4%
*-inverses96.4%
metadata-eval96.4%
distribute-lft-in96.4%
associate-*r/96.4%
metadata-eval96.4%
metadata-eval96.4%
Simplified96.4%
if -7.5000000000000002e-7 < z < 2.69999999999999984e-87Initial program 96.3%
Taylor expanded in z around 0 88.2%
Final simplification92.8%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -1.85e+23) (/ x y) (if (<= (/ x y) 4150000000.0) (+ (/ 2.0 t) -2.0) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.85e+23) {
tmp = x / y;
} else if ((x / y) <= 4150000000.0) {
tmp = (2.0 / t) + -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) <= (-1.85d+23)) then
tmp = x / y
else if ((x / y) <= 4150000000.0d0) then
tmp = (2.0d0 / t) + (-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) <= -1.85e+23) {
tmp = x / y;
} else if ((x / y) <= 4150000000.0) {
tmp = (2.0 / t) + -2.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1.85e+23: tmp = x / y elif (x / y) <= 4150000000.0: tmp = (2.0 / t) + -2.0 else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1.85e+23) tmp = Float64(x / y); elseif (Float64(x / y) <= 4150000000.0) tmp = Float64(Float64(2.0 / t) + -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) <= -1.85e+23) tmp = x / y; elseif ((x / y) <= 4150000000.0) tmp = (2.0 / t) + -2.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1.85e+23], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 4150000000.0], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.85 \cdot 10^{+23}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 4150000000:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.85000000000000006e23 or 4.15e9 < (/.f64 x y) Initial program 83.6%
Taylor expanded in x around inf 65.4%
if -1.85000000000000006e23 < (/.f64 x y) < 4.15e9Initial program 87.7%
Taylor expanded in z around inf 62.5%
div-sub62.5%
sub-neg62.5%
*-inverses62.5%
metadata-eval62.5%
distribute-lft-in62.5%
associate-*r/62.5%
metadata-eval62.5%
metadata-eval62.5%
Simplified62.5%
div-inv62.5%
fma-def62.5%
Applied egg-rr62.5%
Taylor expanded in x around 0 60.4%
sub-neg60.4%
associate-*r/60.4%
metadata-eval60.4%
metadata-eval60.4%
Simplified60.4%
Final simplification62.8%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -1.8e+23) (/ x y) (if (<= (/ x y) 3.5e-7) (+ (/ 2.0 t) -2.0) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.8e+23) {
tmp = x / y;
} else if ((x / y) <= 3.5e-7) {
tmp = (2.0 / t) + -2.0;
} 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) <= (-1.8d+23)) then
tmp = x / y
else if ((x / y) <= 3.5d-7) then
tmp = (2.0d0 / t) + (-2.0d0)
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) <= -1.8e+23) {
tmp = x / y;
} else if ((x / y) <= 3.5e-7) {
tmp = (2.0 / t) + -2.0;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1.8e+23: tmp = x / y elif (x / y) <= 3.5e-7: tmp = (2.0 / t) + -2.0 else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1.8e+23) tmp = Float64(x / y); elseif (Float64(x / y) <= 3.5e-7) tmp = Float64(Float64(2.0 / t) + -2.0); 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) <= -1.8e+23) tmp = x / y; elseif ((x / y) <= 3.5e-7) tmp = (2.0 / t) + -2.0; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1.8e+23], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 3.5e-7], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.8 \cdot 10^{+23}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 3.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -1.7999999999999999e23Initial program 88.2%
Taylor expanded in x around inf 62.1%
if -1.7999999999999999e23 < (/.f64 x y) < 3.49999999999999984e-7Initial program 87.1%
Taylor expanded in z around inf 63.7%
div-sub63.7%
sub-neg63.7%
*-inverses63.7%
metadata-eval63.7%
distribute-lft-in63.7%
associate-*r/63.7%
metadata-eval63.7%
metadata-eval63.7%
Simplified63.7%
div-inv63.7%
fma-def63.7%
Applied egg-rr63.7%
Taylor expanded in x around 0 62.6%
sub-neg62.6%
associate-*r/62.6%
metadata-eval62.6%
metadata-eval62.6%
Simplified62.6%
if 3.49999999999999984e-7 < (/.f64 x y) Initial program 81.0%
Taylor expanded in t around inf 66.1%
Final simplification63.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -11.0) (not (<= t 0.00088))) (- (/ x y) 2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -11.0) || !(t <= 0.00088)) {
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 <= (-11.0d0)) .or. (.not. (t <= 0.00088d0))) 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 <= -11.0) || !(t <= 0.00088)) {
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 <= -11.0) or not (t <= 0.00088): 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 <= -11.0) || !(t <= 0.00088)) 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 <= -11.0) || ~((t <= 0.00088))) 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, -11.0], N[Not[LessEqual[t, 0.00088]], $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 -11 \lor \neg \left(t \leq 0.00088\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -11 or 8.80000000000000031e-4 < t Initial program 74.1%
Taylor expanded in t around inf 79.5%
if -11 < t < 8.80000000000000031e-4Initial program 96.7%
Taylor expanded in t around 0 86.4%
associate-*r/86.4%
metadata-eval86.4%
Simplified86.4%
Final simplification83.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -1.65e+23) (/ x y) (if (<= (/ x y) 16800000000.0) (/ 2.0 t) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.65e+23) {
tmp = x / y;
} else if ((x / y) <= 16800000000.0) {
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) <= (-1.65d+23)) then
tmp = x / y
else if ((x / y) <= 16800000000.0d0) 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) <= -1.65e+23) {
tmp = x / y;
} else if ((x / y) <= 16800000000.0) {
tmp = 2.0 / t;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1.65e+23: tmp = x / y elif (x / y) <= 16800000000.0: tmp = 2.0 / t else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1.65e+23) tmp = Float64(x / y); elseif (Float64(x / y) <= 16800000000.0) 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) <= -1.65e+23) tmp = x / y; elseif ((x / y) <= 16800000000.0) tmp = 2.0 / t; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1.65e+23], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 16800000000.0], N[(2.0 / t), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.65 \cdot 10^{+23}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 16800000000:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.65000000000000015e23 or 1.68e10 < (/.f64 x y) Initial program 83.6%
Taylor expanded in x around inf 65.4%
if -1.65000000000000015e23 < (/.f64 x y) < 1.68e10Initial program 87.7%
Taylor expanded in z around inf 62.5%
div-sub62.5%
sub-neg62.5%
*-inverses62.5%
metadata-eval62.5%
distribute-lft-in62.5%
associate-*r/62.5%
metadata-eval62.5%
metadata-eval62.5%
Simplified62.5%
Taylor expanded in t around 0 33.4%
Final simplification48.8%
(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 85.7%
Taylor expanded in z around inf 69.0%
div-sub69.0%
sub-neg69.0%
*-inverses69.0%
metadata-eval69.0%
distribute-lft-in69.0%
associate-*r/69.0%
metadata-eval69.0%
metadata-eval69.0%
Simplified69.0%
Taylor expanded in t around 0 23.3%
Final simplification23.3%
(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 2023290
(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))))