
(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 (if (or (<= (/ x y) -1e+105) (not (<= (/ x y) 20000000.0))) (+ (/ x y) (/ (+ 2.0 (* 2.0 z)) (* z t))) (/ (+ (+ 2.0 (/ 2.0 z)) (* t (+ (/ x y) -2.0))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e+105) || !((x / y) <= 20000000.0)) {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t));
} else {
tmp = ((2.0 + (2.0 / z)) + (t * ((x / y) + -2.0))) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-1d+105)) .or. (.not. ((x / y) <= 20000000.0d0))) then
tmp = (x / y) + ((2.0d0 + (2.0d0 * z)) / (z * t))
else
tmp = ((2.0d0 + (2.0d0 / z)) + (t * ((x / y) + (-2.0d0)))) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e+105) || !((x / y) <= 20000000.0)) {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t));
} else {
tmp = ((2.0 + (2.0 / z)) + (t * ((x / y) + -2.0))) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1e+105) or not ((x / y) <= 20000000.0): tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t)) else: tmp = ((2.0 + (2.0 / z)) + (t * ((x / y) + -2.0))) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1e+105) || !(Float64(x / y) <= 20000000.0)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(2.0 * z)) / Float64(z * t))); else tmp = Float64(Float64(Float64(2.0 + Float64(2.0 / z)) + Float64(t * Float64(Float64(x / y) + -2.0))) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -1e+105) || ~(((x / y) <= 20000000.0))) tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t)); else tmp = ((2.0 + (2.0 / z)) + (t * ((x / y) + -2.0))) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1e+105], N[Not[LessEqual[N[(x / y), $MachinePrecision], 20000000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] + N[(t * N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+105} \lor \neg \left(\frac{x}{y} \leq 20000000\right):\\
\;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(2 + \frac{2}{z}\right) + t \cdot \left(\frac{x}{y} + -2\right)}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -9.9999999999999994e104 or 2e7 < (/.f64 x y) Initial program 85.4%
Taylor expanded in t around 0 99.9%
if -9.9999999999999994e104 < (/.f64 x y) < 2e7Initial program 81.6%
Taylor expanded in t around 0 99.9%
associate-+r+99.9%
associate-*r/99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (+ 2.0 (* (- 1.0 t) (* 2.0 z))) (* z t)))) (if (<= t_1 INFINITY) (+ t_1 (/ x y)) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double t_1 = (2.0 + ((1.0 - t) * (2.0 * z))) / (z * t);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1 + (x / y);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (2.0 + ((1.0 - t) * (2.0 * z))) / (z * t);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1 + (x / y);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = (2.0 + ((1.0 - t) * (2.0 * z))) / (z * t) tmp = 0 if t_1 <= math.inf: tmp = t_1 + (x / y) else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(2.0 + Float64(Float64(1.0 - t) * Float64(2.0 * z))) / Float64(z * t)) tmp = 0.0 if (t_1 <= Inf) tmp = Float64(t_1 + Float64(x / y)); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (2.0 + ((1.0 - t) * (2.0 * z))) / (z * t); tmp = 0.0; if (t_1 <= Inf) tmp = t_1 + (x / y); else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 + N[(N[(1.0 - t), $MachinePrecision] * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(t$95$1 + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2 + \left(1 - t\right) \cdot \left(2 \cdot z\right)}{z \cdot t}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1 + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.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.9%
if +inf.0 < (/.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.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2000000000.0) (not (<= (/ x y) 0.0005))) (+ (/ x y) (/ (+ 2.0 (* 2.0 z)) (* z t))) (/ (+ (+ 2.0 (/ 2.0 z)) (* t -2.0)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2000000000.0) || !((x / y) <= 0.0005)) {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t));
} else {
tmp = ((2.0 + (2.0 / z)) + (t * -2.0)) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-2000000000.0d0)) .or. (.not. ((x / y) <= 0.0005d0))) then
tmp = (x / y) + ((2.0d0 + (2.0d0 * z)) / (z * t))
else
tmp = ((2.0d0 + (2.0d0 / z)) + (t * (-2.0d0))) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2000000000.0) || !((x / y) <= 0.0005)) {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t));
} else {
tmp = ((2.0 + (2.0 / z)) + (t * -2.0)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2000000000.0) or not ((x / y) <= 0.0005): tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t)) else: tmp = ((2.0 + (2.0 / z)) + (t * -2.0)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2000000000.0) || !(Float64(x / y) <= 0.0005)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(2.0 * z)) / Float64(z * t))); else tmp = Float64(Float64(Float64(2.0 + Float64(2.0 / z)) + Float64(t * -2.0)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2000000000.0) || ~(((x / y) <= 0.0005))) tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t)); else tmp = ((2.0 + (2.0 / z)) + (t * -2.0)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2000000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.0005]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] + N[(t * -2.0), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2000000000 \lor \neg \left(\frac{x}{y} \leq 0.0005\right):\\
\;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(2 + \frac{2}{z}\right) + t \cdot -2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -2e9 or 5.0000000000000001e-4 < (/.f64 x y) Initial program 85.5%
Taylor expanded in t around 0 98.7%
if -2e9 < (/.f64 x y) < 5.0000000000000001e-4Initial program 80.8%
Taylor expanded in t around 0 99.9%
associate-+r+99.9%
associate-*r/99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 99.2%
*-commutative99.2%
Simplified99.2%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+84) (not (<= (/ x y) 5e+40))) (+ (/ x y) (/ 2.0 t)) (/ (+ (+ 2.0 (/ 2.0 z)) (* t -2.0)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+84) || !((x / y) <= 5e+40)) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = ((2.0 + (2.0 / z)) + (t * -2.0)) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-5d+84)) .or. (.not. ((x / y) <= 5d+40))) then
tmp = (x / y) + (2.0d0 / t)
else
tmp = ((2.0d0 + (2.0d0 / z)) + (t * (-2.0d0))) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+84) || !((x / y) <= 5e+40)) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = ((2.0 + (2.0 / z)) + (t * -2.0)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+84) or not ((x / y) <= 5e+40): tmp = (x / y) + (2.0 / t) else: tmp = ((2.0 + (2.0 / z)) + (t * -2.0)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e+84) || !(Float64(x / y) <= 5e+40)) tmp = Float64(Float64(x / y) + Float64(2.0 / t)); else tmp = Float64(Float64(Float64(2.0 + Float64(2.0 / z)) + Float64(t * -2.0)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e+84) || ~(((x / y) <= 5e+40))) tmp = (x / y) + (2.0 / t); else tmp = ((2.0 + (2.0 / z)) + (t * -2.0)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e+84], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e+40]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] + N[(t * -2.0), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+84} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{+40}\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(2 + \frac{2}{z}\right) + t \cdot -2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.0000000000000001e84 or 5.00000000000000003e40 < (/.f64 x y) Initial program 85.6%
Taylor expanded in t around 0 99.9%
Taylor expanded in z around inf 88.5%
associate-*r/88.5%
metadata-eval88.5%
+-commutative88.5%
Simplified88.5%
if -5.0000000000000001e84 < (/.f64 x y) < 5.00000000000000003e40Initial program 81.3%
Taylor expanded in t around 0 99.9%
associate-+r+99.9%
associate-*r/99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 96.2%
*-commutative96.2%
Simplified96.2%
Final simplification93.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5e-32) (not (<= z 5.7e-31))) (+ (/ x y) (/ (* 2.0 (- 1.0 t)) t)) (/ (+ (/ 2.0 z) (* t -2.0)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e-32) || !(z <= 5.7e-31)) {
tmp = (x / y) + ((2.0 * (1.0 - t)) / t);
} else {
tmp = ((2.0 / z) + (t * -2.0)) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5d-32)) .or. (.not. (z <= 5.7d-31))) then
tmp = (x / y) + ((2.0d0 * (1.0d0 - t)) / t)
else
tmp = ((2.0d0 / z) + (t * (-2.0d0))) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e-32) || !(z <= 5.7e-31)) {
tmp = (x / y) + ((2.0 * (1.0 - t)) / t);
} else {
tmp = ((2.0 / z) + (t * -2.0)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5e-32) or not (z <= 5.7e-31): tmp = (x / y) + ((2.0 * (1.0 - t)) / t) else: tmp = ((2.0 / z) + (t * -2.0)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5e-32) || !(z <= 5.7e-31)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 * Float64(1.0 - t)) / t)); else tmp = Float64(Float64(Float64(2.0 / z) + Float64(t * -2.0)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5e-32) || ~((z <= 5.7e-31))) tmp = (x / y) + ((2.0 * (1.0 - t)) / t); else tmp = ((2.0 / z) + (t * -2.0)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5e-32], N[Not[LessEqual[z, 5.7e-31]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 * N[(1.0 - t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / z), $MachinePrecision] + N[(t * -2.0), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-32} \lor \neg \left(z \leq 5.7 \cdot 10^{-31}\right):\\
\;\;\;\;\frac{x}{y} + \frac{2 \cdot \left(1 - t\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{z} + t \cdot -2}{t}\\
\end{array}
\end{array}
if z < -5e-32 or 5.69999999999999995e-31 < z Initial program 74.6%
Taylor expanded in z around inf 97.7%
associate-*r/97.7%
Simplified97.7%
if -5e-32 < z < 5.69999999999999995e-31Initial program 99.9%
Taylor expanded in t around 0 91.1%
associate-+r+91.1%
associate-*r/91.1%
metadata-eval91.1%
sub-neg91.1%
metadata-eval91.1%
Simplified91.1%
Taylor expanded in z around 0 91.1%
Taylor expanded in x around 0 76.9%
*-commutative76.9%
Simplified76.9%
Final simplification90.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -6.4e-10) (not (<= (/ x y) 0.00032))) (- (/ x y) 2.0) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -6.4e-10) || !((x / y) <= 0.00032)) {
tmp = (x / y) - 2.0;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-6.4d-10)) .or. (.not. ((x / y) <= 0.00032d0))) then
tmp = (x / y) - 2.0d0
else
tmp = (-2.0d0) + (2.0d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -6.4e-10) || !((x / y) <= 0.00032)) {
tmp = (x / y) - 2.0;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -6.4e-10) or not ((x / y) <= 0.00032): tmp = (x / y) - 2.0 else: tmp = -2.0 + (2.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -6.4e-10) || !(Float64(x / y) <= 0.00032)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(-2.0 + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -6.4e-10) || ~(((x / y) <= 0.00032))) tmp = (x / y) - 2.0; else tmp = -2.0 + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -6.4e-10], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.00032]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -6.4 \cdot 10^{-10} \lor \neg \left(\frac{x}{y} \leq 0.00032\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -6.39999999999999961e-10 or 3.20000000000000026e-4 < (/.f64 x y) Initial program 85.1%
Taylor expanded in t around inf 67.2%
if -6.39999999999999961e-10 < (/.f64 x y) < 3.20000000000000026e-4Initial program 81.1%
Taylor expanded in z around inf 72.5%
associate-*r/72.5%
Simplified72.5%
Taylor expanded in x around 0 72.5%
Taylor expanded in t around inf 72.5%
sub-neg72.5%
associate-*r/72.5%
metadata-eval72.5%
metadata-eval72.5%
Simplified72.5%
Final simplification69.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1.02e+86) (not (<= (/ x y) 3.4e+40))) (/ x y) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1.02e+86) || !((x / y) <= 3.4e+40)) {
tmp = x / y;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-1.02d+86)) .or. (.not. ((x / y) <= 3.4d+40))) then
tmp = x / y
else
tmp = (-2.0d0) + (2.0d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1.02e+86) || !((x / y) <= 3.4e+40)) {
tmp = x / y;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1.02e+86) or not ((x / y) <= 3.4e+40): tmp = x / y else: tmp = -2.0 + (2.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1.02e+86) || !(Float64(x / y) <= 3.4e+40)) tmp = Float64(x / y); else tmp = Float64(-2.0 + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -1.02e+86) || ~(((x / y) <= 3.4e+40))) tmp = x / y; else tmp = -2.0 + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1.02e+86], N[Not[LessEqual[N[(x / y), $MachinePrecision], 3.4e+40]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.02 \cdot 10^{+86} \lor \neg \left(\frac{x}{y} \leq 3.4 \cdot 10^{+40}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.01999999999999996e86 or 3.39999999999999989e40 < (/.f64 x y) Initial program 85.4%
Taylor expanded in x around inf 75.3%
if -1.01999999999999996e86 < (/.f64 x y) < 3.39999999999999989e40Initial program 81.6%
Taylor expanded in z around inf 69.6%
associate-*r/69.6%
Simplified69.6%
Taylor expanded in x around 0 65.3%
Taylor expanded in t around inf 65.3%
sub-neg65.3%
associate-*r/65.3%
metadata-eval65.3%
metadata-eval65.3%
Simplified65.3%
Final simplification69.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.42e-41) (not (<= t 1.65e-12))) (- (/ x y) 2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.42e-41) || !(t <= 1.65e-12)) {
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 <= (-1.42d-41)) .or. (.not. (t <= 1.65d-12))) 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 <= -1.42e-41) || !(t <= 1.65e-12)) {
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 <= -1.42e-41) or not (t <= 1.65e-12): 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 <= -1.42e-41) || !(t <= 1.65e-12)) 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 <= -1.42e-41) || ~((t <= 1.65e-12))) 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, -1.42e-41], N[Not[LessEqual[t, 1.65e-12]], $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 -1.42 \cdot 10^{-41} \lor \neg \left(t \leq 1.65 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -1.41999999999999995e-41 or 1.65e-12 < t Initial program 69.0%
Taylor expanded in t around inf 84.9%
if -1.41999999999999995e-41 < t < 1.65e-12Initial program 99.8%
Taylor expanded in t around 0 82.1%
associate-*r/82.1%
metadata-eval82.1%
Simplified82.1%
Final simplification83.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -680000000000.0) (not (<= t 14500000.0))) (- (/ x y) 2.0) (+ (/ x y) (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -680000000000.0) || !(t <= 14500000.0)) {
tmp = (x / y) - 2.0;
} else {
tmp = (x / y) + (2.0 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-680000000000.0d0)) .or. (.not. (t <= 14500000.0d0))) then
tmp = (x / y) - 2.0d0
else
tmp = (x / y) + (2.0d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -680000000000.0) || !(t <= 14500000.0)) {
tmp = (x / y) - 2.0;
} else {
tmp = (x / y) + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -680000000000.0) or not (t <= 14500000.0): tmp = (x / y) - 2.0 else: tmp = (x / y) + (2.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -680000000000.0) || !(t <= 14500000.0)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(Float64(x / y) + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -680000000000.0) || ~((t <= 14500000.0))) tmp = (x / y) - 2.0; else tmp = (x / y) + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -680000000000.0], N[Not[LessEqual[t, 14500000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -680000000000 \lor \neg \left(t \leq 14500000\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\end{array}
\end{array}
if t < -6.8e11 or 1.45e7 < t Initial program 64.4%
Taylor expanded in t around inf 89.0%
if -6.8e11 < t < 1.45e7Initial program 99.8%
Taylor expanded in t around 0 98.8%
Taylor expanded in z around inf 65.3%
associate-*r/65.3%
metadata-eval65.3%
+-commutative65.3%
Simplified65.3%
Final simplification76.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2.9e-6) (not (<= (/ x y) 2.0))) (/ x y) -2.0))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2.9e-6) || !((x / y) <= 2.0)) {
tmp = x / y;
} 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 (((x / y) <= (-2.9d-6)) .or. (.not. ((x / y) <= 2.0d0))) then
tmp = x / y
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 (((x / y) <= -2.9e-6) || !((x / y) <= 2.0)) {
tmp = x / y;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2.9e-6) or not ((x / y) <= 2.0): tmp = x / y else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2.9e-6) || !(Float64(x / y) <= 2.0)) tmp = Float64(x / y); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2.9e-6) || ~(((x / y) <= 2.0))) tmp = x / y; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2.9e-6], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], -2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2.9 \cdot 10^{-6} \lor \neg \left(\frac{x}{y} \leq 2\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if (/.f64 x y) < -2.9000000000000002e-6 or 2 < (/.f64 x y) Initial program 85.4%
Taylor expanded in x around inf 66.5%
if -2.9000000000000002e-6 < (/.f64 x y) < 2Initial program 80.9%
Taylor expanded in z around inf 71.8%
associate-*r/71.8%
Simplified71.8%
Taylor expanded in x around 0 71.1%
Taylor expanded in t around inf 42.8%
Final simplification54.3%
(FPCore (x y z t) :precision binary64 (if (<= t -680000000000.0) -2.0 (if (<= t 14500000.0) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -680000000000.0) {
tmp = -2.0;
} else if (t <= 14500000.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 <= (-680000000000.0d0)) then
tmp = -2.0d0
else if (t <= 14500000.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 <= -680000000000.0) {
tmp = -2.0;
} else if (t <= 14500000.0) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -680000000000.0: tmp = -2.0 elif t <= 14500000.0: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -680000000000.0) tmp = -2.0; elseif (t <= 14500000.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 <= -680000000000.0) tmp = -2.0; elseif (t <= 14500000.0) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -680000000000.0], -2.0, If[LessEqual[t, 14500000.0], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -680000000000:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 14500000:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -6.8e11 or 1.45e7 < t Initial program 64.4%
Taylor expanded in z around inf 89.2%
associate-*r/89.2%
Simplified89.2%
Taylor expanded in x around 0 46.5%
Taylor expanded in t around inf 46.3%
if -6.8e11 < t < 1.45e7Initial program 99.8%
Taylor expanded in z around inf 66.3%
associate-*r/66.3%
Simplified66.3%
Taylor expanded in t around 0 42.7%
(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 83.1%
Taylor expanded in z around inf 77.1%
associate-*r/77.1%
Simplified77.1%
Taylor expanded in x around 0 45.0%
Taylor expanded in t around inf 23.2%
(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 2024165
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:alt
(! :herbie-platform default (- (/ (+ (/ 2 z) 2) t) (- 2 (/ x y))))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))