
(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 (+ (/ x y) (+ (/ (+ 2.0 (/ 2.0 z)) t) -2.0)))
double code(double x, double y, double z, double t) {
return (x / y) + (((2.0 + (2.0 / z)) / t) + -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 = (x / y) + (((2.0d0 + (2.0d0 / z)) / t) + (-2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + (((2.0 + (2.0 / z)) / t) + -2.0);
}
def code(x, y, z, t): return (x / y) + (((2.0 + (2.0 / z)) / t) + -2.0)
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(Float64(2.0 + Float64(2.0 / z)) / t) + -2.0)) end
function tmp = code(x, y, z, t) tmp = (x / y) + (((2.0 + (2.0 / z)) / t) + -2.0); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \left(\frac{2 + \frac{2}{z}}{t} + -2\right)
\end{array}
Initial program 81.1%
+-commutative81.1%
remove-double-neg81.1%
distribute-frac-neg81.1%
unsub-neg81.1%
*-commutative81.1%
associate-*r*81.1%
distribute-rgt1-in81.1%
associate-/l*81.0%
fma-neg81.0%
*-commutative81.0%
fma-define81.0%
*-commutative81.0%
distribute-frac-neg81.0%
remove-double-neg81.0%
Simplified81.0%
Taylor expanded in t around inf 99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
associate-+l+99.9%
associate-*r/99.9%
distribute-lft-in99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -2.0)
(/ x y)
(if (<= (/ x y) 3.5e-127)
-2.0
(if (<= (/ x y) 9500000000.0) (/ 2.0 t) (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2.0) {
tmp = x / y;
} else if ((x / y) <= 3.5e-127) {
tmp = -2.0;
} else if ((x / y) <= 9500000000.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) <= (-2.0d0)) then
tmp = x / y
else if ((x / y) <= 3.5d-127) then
tmp = -2.0d0
else if ((x / y) <= 9500000000.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) <= -2.0) {
tmp = x / y;
} else if ((x / y) <= 3.5e-127) {
tmp = -2.0;
} else if ((x / y) <= 9500000000.0) {
tmp = 2.0 / t;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2.0: tmp = x / y elif (x / y) <= 3.5e-127: tmp = -2.0 elif (x / y) <= 9500000000.0: tmp = 2.0 / t else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2.0) tmp = Float64(x / y); elseif (Float64(x / y) <= 3.5e-127) tmp = -2.0; elseif (Float64(x / y) <= 9500000000.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) <= -2.0) tmp = x / y; elseif ((x / y) <= 3.5e-127) tmp = -2.0; elseif ((x / y) <= 9500000000.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], -2.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 3.5e-127], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 9500000000.0], N[(2.0 / t), $MachinePrecision], N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 3.5 \cdot 10^{-127}:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq 9500000000:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -2 or 9.5e9 < (/.f64 x y) Initial program 82.6%
Taylor expanded in x around inf 64.7%
if -2 < (/.f64 x y) < 3.49999999999999989e-127Initial program 76.7%
Taylor expanded in t around inf 46.3%
Taylor expanded in x around 0 45.2%
if 3.49999999999999989e-127 < (/.f64 x y) < 9.5e9Initial program 87.8%
Taylor expanded in t around 0 81.3%
associate-*r/81.3%
metadata-eval81.3%
Simplified81.3%
Taylor expanded in z around inf 44.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -620000.0) (not (<= z 0.0042))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (+ (/ x y) (+ -2.0 (/ (/ 2.0 z) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -620000.0) || !(z <= 0.0042)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} 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 <= (-620000.0d0)) .or. (.not. (z <= 0.0042d0))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
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 <= -620000.0) || !(z <= 0.0042)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (x / y) + (-2.0 + ((2.0 / z) / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -620000.0) or not (z <= 0.0042): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = (x / y) + (-2.0 + ((2.0 / z) / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -620000.0) || !(z <= 0.0042)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); else tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(Float64(2.0 / z) / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -620000.0) || ~((z <= 0.0042))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = (x / y) + (-2.0 + ((2.0 / z) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -620000.0], N[Not[LessEqual[z, 0.0042]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -620000 \lor \neg \left(z \leq 0.0042\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{\frac{2}{z}}{t}\right)\\
\end{array}
\end{array}
if z < -6.2e5 or 0.00419999999999999974 < z Initial program 63.2%
Taylor expanded in z around inf 98.1%
div-sub98.1%
sub-neg98.1%
*-inverses98.1%
metadata-eval98.1%
distribute-lft-in98.1%
metadata-eval98.1%
associate-*r/98.1%
metadata-eval98.1%
Simplified98.1%
if -6.2e5 < z < 0.00419999999999999974Initial program 99.8%
+-commutative99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*r*99.8%
distribute-rgt1-in99.8%
associate-/l*99.8%
fma-neg99.8%
*-commutative99.8%
fma-define99.8%
*-commutative99.8%
distribute-frac-neg99.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in t around inf 99.8%
sub-neg99.8%
+-commutative99.8%
metadata-eval99.8%
associate-+l+99.8%
associate-*r/99.8%
distribute-lft-in99.8%
metadata-eval99.8%
associate-*r/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 98.8%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1.2e+22) (not (<= (/ x y) 1.75e+94))) (/ x y) (+ -2.0 (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1.2e+22) || !((x / y) <= 1.75e+94)) {
tmp = x / y;
} else {
tmp = -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) <= (-1.2d+22)) .or. (.not. ((x / y) <= 1.75d+94))) then
tmp = x / y
else
tmp = (-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) <= -1.2e+22) || !((x / y) <= 1.75e+94)) {
tmp = x / y;
} else {
tmp = -2.0 + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1.2e+22) or not ((x / y) <= 1.75e+94): tmp = x / y else: tmp = -2.0 + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1.2e+22) || !(Float64(x / y) <= 1.75e+94)) tmp = Float64(x / y); else tmp = Float64(-2.0 + Float64(Float64(2.0 / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -1.2e+22) || ~(((x / y) <= 1.75e+94))) tmp = x / y; else tmp = -2.0 + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1.2e+22], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1.75e+94]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.2 \cdot 10^{+22} \lor \neg \left(\frac{x}{y} \leq 1.75 \cdot 10^{+94}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.2e22 or 1.7499999999999999e94 < (/.f64 x y) Initial program 78.4%
Taylor expanded in x around inf 80.8%
if -1.2e22 < (/.f64 x y) < 1.7499999999999999e94Initial program 82.6%
Taylor expanded in z around inf 99.9%
+-commutative99.9%
associate-*r/99.9%
metadata-eval99.9%
*-commutative99.9%
div-sub99.9%
sub-neg99.9%
*-inverses99.9%
metadata-eval99.9%
distribute-lft-in99.9%
metadata-eval99.9%
associate-+l+99.9%
+-commutative99.9%
*-commutative99.9%
+-commutative99.9%
associate-/l/99.9%
metadata-eval99.9%
associate-*r/99.9%
*-rgt-identity99.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in z around 0 77.2%
Taylor expanded in x around 0 72.0%
sub-neg72.0%
associate-*r/72.0%
metadata-eval72.0%
associate-/r*72.0%
metadata-eval72.0%
Simplified72.0%
Final simplification75.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -620000.0) (not (<= z 4.4e-72))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (+ (/ x y) (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -620000.0) || !(z <= 4.4e-72)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} 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 <= (-620000.0d0)) .or. (.not. (z <= 4.4d-72))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
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 <= -620000.0) || !(z <= 4.4e-72)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -620000.0) or not (z <= 4.4e-72): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = (x / y) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -620000.0) || !(z <= 4.4e-72)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); 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 <= -620000.0) || ~((z <= 4.4e-72))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = (x / y) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -620000.0], N[Not[LessEqual[z, 4.4e-72]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $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 -620000 \lor \neg \left(z \leq 4.4 \cdot 10^{-72}\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if z < -6.2e5 or 4.40000000000000005e-72 < z Initial program 67.6%
Taylor expanded in z around inf 95.1%
div-sub95.1%
sub-neg95.1%
*-inverses95.1%
metadata-eval95.1%
distribute-lft-in95.1%
metadata-eval95.1%
associate-*r/95.1%
metadata-eval95.1%
Simplified95.1%
if -6.2e5 < z < 4.40000000000000005e-72Initial program 99.8%
Taylor expanded in z around 0 93.3%
Taylor expanded in x around 0 93.3%
associate-*r/93.3%
metadata-eval93.3%
associate-/r*93.3%
Simplified93.3%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -620000.0) (not (<= z 4.6e-71))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (+ (/ x y) (/ 2.0 (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -620000.0) || !(z <= 4.6e-71)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} 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 <= (-620000.0d0)) .or. (.not. (z <= 4.6d-71))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
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 <= -620000.0) || !(z <= 4.6e-71)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (x / y) + (2.0 / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -620000.0) or not (z <= 4.6e-71): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = (x / y) + (2.0 / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -620000.0) || !(z <= 4.6e-71)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); 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 <= -620000.0) || ~((z <= 4.6e-71))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = (x / y) + (2.0 / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -620000.0], N[Not[LessEqual[z, 4.6e-71]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $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 -620000 \lor \neg \left(z \leq 4.6 \cdot 10^{-71}\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -6.2e5 or 4.5999999999999997e-71 < z Initial program 67.6%
Taylor expanded in z around inf 95.1%
div-sub95.1%
sub-neg95.1%
*-inverses95.1%
metadata-eval95.1%
distribute-lft-in95.1%
metadata-eval95.1%
associate-*r/95.1%
metadata-eval95.1%
Simplified95.1%
if -6.2e5 < z < 4.5999999999999997e-71Initial program 99.8%
Taylor expanded in z around 0 93.3%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.8e-13) (not (<= z 8.8e-69))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (+ -2.0 (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.8e-13) || !(z <= 8.8e-69)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = -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 ((z <= (-2.8d-13)) .or. (.not. (z <= 8.8d-69))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
else
tmp = (-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 ((z <= -2.8e-13) || !(z <= 8.8e-69)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = -2.0 + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.8e-13) or not (z <= 8.8e-69): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = -2.0 + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.8e-13) || !(z <= 8.8e-69)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); else tmp = Float64(-2.0 + Float64(Float64(2.0 / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.8e-13) || ~((z <= 8.8e-69))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = -2.0 + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.8e-13], N[Not[LessEqual[z, 8.8e-69]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-13} \lor \neg \left(z \leq 8.8 \cdot 10^{-69}\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if z < -2.8000000000000002e-13 or 8.8000000000000001e-69 < z Initial program 67.8%
Taylor expanded in z around inf 95.7%
div-sub95.7%
sub-neg95.7%
*-inverses95.7%
metadata-eval95.7%
distribute-lft-in95.7%
metadata-eval95.7%
associate-*r/95.7%
metadata-eval95.7%
Simplified95.7%
if -2.8000000000000002e-13 < z < 8.8000000000000001e-69Initial program 99.8%
Taylor expanded in z around inf 99.8%
+-commutative99.8%
associate-*r/99.8%
metadata-eval99.8%
*-commutative99.8%
div-sub99.8%
sub-neg99.8%
*-inverses99.8%
metadata-eval99.8%
distribute-lft-in99.8%
metadata-eval99.8%
associate-+l+99.8%
+-commutative99.8%
*-commutative99.8%
+-commutative99.8%
associate-/l/99.8%
metadata-eval99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in z around 0 99.7%
Taylor expanded in x around 0 81.6%
sub-neg81.6%
associate-*r/81.6%
metadata-eval81.6%
associate-/r*81.6%
metadata-eval81.6%
Simplified81.6%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3300000000.0) (not (<= t 2.7e+19))) (- (/ x y) 2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3300000000.0) || !(t <= 2.7e+19)) {
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 <= (-3300000000.0d0)) .or. (.not. (t <= 2.7d+19))) 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 <= -3300000000.0) || !(t <= 2.7e+19)) {
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 <= -3300000000.0) or not (t <= 2.7e+19): 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 <= -3300000000.0) || !(t <= 2.7e+19)) 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 <= -3300000000.0) || ~((t <= 2.7e+19))) 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, -3300000000.0], N[Not[LessEqual[t, 2.7e+19]], $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 -3300000000 \lor \neg \left(t \leq 2.7 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -3.3e9 or 2.7e19 < t Initial program 61.5%
Taylor expanded in t around inf 85.0%
if -3.3e9 < t < 2.7e19Initial program 99.7%
Taylor expanded in t around 0 81.2%
associate-*r/81.2%
metadata-eval81.2%
Simplified81.2%
Final simplification83.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.1e-70) (not (<= z 8e-69))) (- (/ x y) 2.0) (/ 2.0 (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.1e-70) || !(z <= 8e-69)) {
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 ((z <= (-5.1d-70)) .or. (.not. (z <= 8d-69))) 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 ((z <= -5.1e-70) || !(z <= 8e-69)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.1e-70) or not (z <= 8e-69): tmp = (x / y) - 2.0 else: tmp = 2.0 / (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.1e-70) || !(z <= 8e-69)) 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 ((z <= -5.1e-70) || ~((z <= 8e-69))) tmp = (x / y) - 2.0; else tmp = 2.0 / (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.1e-70], N[Not[LessEqual[z, 8e-69]], $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}\;z \leq -5.1 \cdot 10^{-70} \lor \neg \left(z \leq 8 \cdot 10^{-69}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -5.10000000000000025e-70 or 7.9999999999999997e-69 < z Initial program 69.5%
Taylor expanded in t around inf 68.5%
if -5.10000000000000025e-70 < z < 7.9999999999999997e-69Initial program 99.8%
Taylor expanded in t around 0 76.4%
associate-*r/76.4%
metadata-eval76.4%
Simplified76.4%
Taylor expanded in z around 0 76.4%
Final simplification71.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.02e-5) (not (<= t 8e-168))) (- (/ x y) 2.0) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.02e-5) || !(t <= 8e-168)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.02d-5)) .or. (.not. (t <= 8d-168))) then
tmp = (x / y) - 2.0d0
else
tmp = 2.0d0 / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.02e-5) || !(t <= 8e-168)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.02e-5) or not (t <= 8e-168): tmp = (x / y) - 2.0 else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.02e-5) || !(t <= 8e-168)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(2.0 / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.02e-5) || ~((t <= 8e-168))) tmp = (x / y) - 2.0; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.02e-5], N[Not[LessEqual[t, 8e-168]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.02 \cdot 10^{-5} \lor \neg \left(t \leq 8 \cdot 10^{-168}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if t < -1.0200000000000001e-5 or 8.0000000000000004e-168 < t Initial program 72.1%
Taylor expanded in t around inf 70.4%
if -1.0200000000000001e-5 < t < 8.0000000000000004e-168Initial program 99.7%
Taylor expanded in t around 0 88.8%
associate-*r/88.8%
metadata-eval88.8%
Simplified88.8%
Taylor expanded in z around inf 38.5%
Final simplification60.1%
(FPCore (x y z t) :precision binary64 (if (<= t -0.0039) -2.0 (if (<= t 0.98) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -0.0039) {
tmp = -2.0;
} else if (t <= 0.98) {
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 <= (-0.0039d0)) then
tmp = -2.0d0
else if (t <= 0.98d0) 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 <= -0.0039) {
tmp = -2.0;
} else if (t <= 0.98) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -0.0039: tmp = -2.0 elif t <= 0.98: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -0.0039) tmp = -2.0; elseif (t <= 0.98) 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 <= -0.0039) tmp = -2.0; elseif (t <= 0.98) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -0.0039], -2.0, If[LessEqual[t, 0.98], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.0039:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 0.98:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -0.0038999999999999998 or 0.97999999999999998 < t Initial program 64.4%
Taylor expanded in t around inf 80.3%
Taylor expanded in x around 0 37.1%
if -0.0038999999999999998 < t < 0.97999999999999998Initial program 99.7%
Taylor expanded in t around 0 81.9%
associate-*r/81.9%
metadata-eval81.9%
Simplified81.9%
Taylor expanded in z around inf 34.6%
(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 81.1%
Taylor expanded in t around inf 52.3%
Taylor expanded in x around 0 20.8%
(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 2024118
(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))))