
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x / y) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x / y) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
(FPCore (x y z t) :precision binary64 (- (+ (* 2.0 (/ 1.0 t)) (+ (/ 2.0 (* t z)) (/ x y))) 2.0))
double code(double x, double y, double z, double t) {
return ((2.0 * (1.0 / t)) + ((2.0 / (t * z)) + (x / y))) - 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 * (1.0d0 / t)) + ((2.0d0 / (t * z)) + (x / y))) - 2.0d0
end function
public static double code(double x, double y, double z, double t) {
return ((2.0 * (1.0 / t)) + ((2.0 / (t * z)) + (x / y))) - 2.0;
}
def code(x, y, z, t): return ((2.0 * (1.0 / t)) + ((2.0 / (t * z)) + (x / y))) - 2.0
function code(x, y, z, t) return Float64(Float64(Float64(2.0 * Float64(1.0 / t)) + Float64(Float64(2.0 / Float64(t * z)) + Float64(x / y))) - 2.0) end
function tmp = code(x, y, z, t) tmp = ((2.0 * (1.0 / t)) + ((2.0 / (t * z)) + (x / y))) - 2.0; end
code[x_, y_, z_, t_] := N[(N[(N[(2.0 * N[(1.0 / t), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]
\begin{array}{l}
\\
\left(2 \cdot \frac{1}{t} + \left(\frac{2}{t \cdot z} + \frac{x}{y}\right)\right) - 2
\end{array}
Initial program 83.8%
Taylor expanded in t around 0 98.3%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= t -7.8e+97)
t_1
(if (<= t -2.2e+35)
(/ (+ 2.0 (/ 2.0 z)) t)
(if (or (<= t -1.7e+25) (not (<= t 3.2e-20)))
t_1
(+ (/ 2.0 (* t z)) (/ 2.0 t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (t <= -7.8e+97) {
tmp = t_1;
} else if (t <= -2.2e+35) {
tmp = (2.0 + (2.0 / z)) / t;
} else if ((t <= -1.7e+25) || !(t <= 3.2e-20)) {
tmp = t_1;
} else {
tmp = (2.0 / (t * z)) + (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) :: t_1
real(8) :: tmp
t_1 = (x / y) - 2.0d0
if (t <= (-7.8d+97)) then
tmp = t_1
else if (t <= (-2.2d+35)) then
tmp = (2.0d0 + (2.0d0 / z)) / t
else if ((t <= (-1.7d+25)) .or. (.not. (t <= 3.2d-20))) then
tmp = t_1
else
tmp = (2.0d0 / (t * z)) + (2.0d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (t <= -7.8e+97) {
tmp = t_1;
} else if (t <= -2.2e+35) {
tmp = (2.0 + (2.0 / z)) / t;
} else if ((t <= -1.7e+25) || !(t <= 3.2e-20)) {
tmp = t_1;
} else {
tmp = (2.0 / (t * z)) + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if t <= -7.8e+97: tmp = t_1 elif t <= -2.2e+35: tmp = (2.0 + (2.0 / z)) / t elif (t <= -1.7e+25) or not (t <= 3.2e-20): tmp = t_1 else: tmp = (2.0 / (t * z)) + (2.0 / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -7.8e+97) tmp = t_1; elseif (t <= -2.2e+35) tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); elseif ((t <= -1.7e+25) || !(t <= 3.2e-20)) tmp = t_1; else tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (t <= -7.8e+97) tmp = t_1; elseif (t <= -2.2e+35) tmp = (2.0 + (2.0 / z)) / t; elseif ((t <= -1.7e+25) || ~((t <= 3.2e-20))) tmp = t_1; else tmp = (2.0 / (t * z)) + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -7.8e+97], t$95$1, If[LessEqual[t, -2.2e+35], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[t, -1.7e+25], N[Not[LessEqual[t, 3.2e-20]], $MachinePrecision]], t$95$1, N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -7.8 \cdot 10^{+97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2.2 \cdot 10^{+35}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\mathbf{elif}\;t \leq -1.7 \cdot 10^{+25} \lor \neg \left(t \leq 3.2 \cdot 10^{-20}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{2}{t}\\
\end{array}
\end{array}
if t < -7.7999999999999999e97 or -2.1999999999999999e35 < t < -1.69999999999999992e25 or 3.1999999999999997e-20 < t Initial program 68.3%
Taylor expanded in t around inf 84.4%
if -7.7999999999999999e97 < t < -2.1999999999999999e35Initial program 99.7%
Taylor expanded in t around 0 74.5%
associate-*r/74.5%
metadata-eval74.5%
Simplified74.5%
if -1.69999999999999992e25 < t < 3.1999999999999997e-20Initial program 96.6%
Taylor expanded in t around 0 76.0%
associate-*r/76.0%
metadata-eval76.0%
Simplified76.0%
div-inv76.0%
Applied egg-rr76.0%
Taylor expanded in z around 0 76.0%
associate-*r/76.0%
metadata-eval76.0%
associate-*r/76.0%
metadata-eval76.0%
Simplified76.0%
Final simplification79.8%
(FPCore (x y z t)
:precision binary64
(if (or (<= t -7.8e+97)
(not (or (<= t -2e+35) (and (not (<= t -6.5e+25)) (<= t 7.4e-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 <= -7.8e+97) || !((t <= -2e+35) || (!(t <= -6.5e+25) && (t <= 7.4e-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 <= (-7.8d+97)) .or. (.not. (t <= (-2d+35)) .or. (.not. (t <= (-6.5d+25))) .and. (t <= 7.4d-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 <= -7.8e+97) || !((t <= -2e+35) || (!(t <= -6.5e+25) && (t <= 7.4e-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 <= -7.8e+97) or not ((t <= -2e+35) or (not (t <= -6.5e+25) and (t <= 7.4e-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 <= -7.8e+97) || !((t <= -2e+35) || (!(t <= -6.5e+25) && (t <= 7.4e-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 <= -7.8e+97) || ~(((t <= -2e+35) || (~((t <= -6.5e+25)) && (t <= 7.4e-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, -7.8e+97], N[Not[Or[LessEqual[t, -2e+35], And[N[Not[LessEqual[t, -6.5e+25]], $MachinePrecision], LessEqual[t, 7.4e-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 -7.8 \cdot 10^{+97} \lor \neg \left(t \leq -2 \cdot 10^{+35} \lor \neg \left(t \leq -6.5 \cdot 10^{+25}\right) \land t \leq 7.4 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -7.7999999999999999e97 or -1.9999999999999999e35 < t < -6.50000000000000005e25 or 7.40000000000000011e-19 < t Initial program 68.3%
Taylor expanded in t around inf 84.4%
if -7.7999999999999999e97 < t < -1.9999999999999999e35 or -6.50000000000000005e25 < t < 7.40000000000000011e-19Initial program 96.8%
Taylor expanded in t around 0 75.9%
associate-*r/75.9%
metadata-eval75.9%
Simplified75.9%
Final simplification79.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+19) (not (<= (/ x y) 2000000.0))) (+ (/ 2.0 (* t z)) (/ x y)) (- (+ (/ 2.0 t) (/ (/ 2.0 t) z)) 2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+19) || !((x / y) <= 2000000.0)) {
tmp = (2.0 / (t * z)) + (x / y);
} else {
tmp = ((2.0 / t) + ((2.0 / t) / z)) - 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) <= (-2d+19)) .or. (.not. ((x / y) <= 2000000.0d0))) then
tmp = (2.0d0 / (t * z)) + (x / y)
else
tmp = ((2.0d0 / t) + ((2.0d0 / t) / z)) - 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) <= -2e+19) || !((x / y) <= 2000000.0)) {
tmp = (2.0 / (t * z)) + (x / y);
} else {
tmp = ((2.0 / t) + ((2.0 / t) / z)) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+19) or not ((x / y) <= 2000000.0): tmp = (2.0 / (t * z)) + (x / y) else: tmp = ((2.0 / t) + ((2.0 / t) / z)) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e+19) || !(Float64(x / y) <= 2000000.0)) tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(x / y)); else tmp = Float64(Float64(Float64(2.0 / t) + Float64(Float64(2.0 / t) / z)) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2e+19) || ~(((x / y) <= 2000000.0))) tmp = (2.0 / (t * z)) + (x / y); else tmp = ((2.0 / t) + ((2.0 / t) / z)) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e+19], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2000000.0]], $MachinePrecision]], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / t), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+19} \lor \neg \left(\frac{x}{y} \leq 2000000\right):\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{2}{t} + \frac{\frac{2}{t}}{z}\right) - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -2e19 or 2e6 < (/.f64 x y) Initial program 83.6%
Taylor expanded in z around 0 88.9%
if -2e19 < (/.f64 x y) < 2e6Initial program 83.9%
Taylor expanded in t around 0 99.8%
Taylor expanded in x around 0 97.7%
associate-*r/97.7%
metadata-eval97.7%
associate-*r/97.7%
metadata-eval97.7%
+-commutative97.7%
associate-/r*97.7%
Simplified97.7%
Final simplification93.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+19) (not (<= (/ x y) 2000000.0))) (+ (/ 2.0 (* t z)) (/ x y)) (- (/ (+ 2.0 (/ 2.0 z)) t) 2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+19) || !((x / y) <= 2000000.0)) {
tmp = (2.0 / (t * z)) + (x / y);
} else {
tmp = ((2.0 + (2.0 / z)) / t) - 2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-2d+19)) .or. (.not. ((x / y) <= 2000000.0d0))) then
tmp = (2.0d0 / (t * z)) + (x / y)
else
tmp = ((2.0d0 + (2.0d0 / z)) / t) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+19) || !((x / y) <= 2000000.0)) {
tmp = (2.0 / (t * z)) + (x / y);
} else {
tmp = ((2.0 + (2.0 / z)) / t) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+19) or not ((x / y) <= 2000000.0): tmp = (2.0 / (t * z)) + (x / y) else: tmp = ((2.0 + (2.0 / z)) / t) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e+19) || !(Float64(x / y) <= 2000000.0)) tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(x / y)); else tmp = Float64(Float64(Float64(2.0 + Float64(2.0 / z)) / t) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2e+19) || ~(((x / y) <= 2000000.0))) tmp = (2.0 / (t * z)) + (x / y); else tmp = ((2.0 + (2.0 / z)) / t) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e+19], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2000000.0]], $MachinePrecision]], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] - 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+19} \lor \neg \left(\frac{x}{y} \leq 2000000\right):\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -2e19 or 2e6 < (/.f64 x y) Initial program 83.6%
Taylor expanded in z around 0 88.9%
if -2e19 < (/.f64 x y) < 2e6Initial program 83.9%
Taylor expanded in t around 0 99.8%
Taylor expanded in t around 0 97.7%
associate-*r/97.7%
metadata-eval97.7%
Simplified97.7%
Final simplification93.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -58000.0) (not (<= (/ x y) 9.5e+20))) (/ x y) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -58000.0) || !((x / y) <= 9.5e+20)) {
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) <= (-58000.0d0)) .or. (.not. ((x / y) <= 9.5d+20))) 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) <= -58000.0) || !((x / y) <= 9.5e+20)) {
tmp = x / y;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -58000.0) or not ((x / y) <= 9.5e+20): 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) <= -58000.0) || !(Float64(x / y) <= 9.5e+20)) 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) <= -58000.0) || ~(((x / y) <= 9.5e+20))) 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], -58000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 9.5e+20]], $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 -58000 \lor \neg \left(\frac{x}{y} \leq 9.5 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -58000 or 9.5e20 < (/.f64 x y) Initial program 82.1%
Taylor expanded in x around inf 70.2%
if -58000 < (/.f64 x y) < 9.5e20Initial program 85.5%
Taylor expanded in z around inf 58.8%
div-sub58.8%
sub-neg58.8%
*-inverses58.8%
metadata-eval58.8%
distribute-lft-in58.8%
associate-*r/58.8%
metadata-eval58.8%
metadata-eval58.8%
Simplified58.8%
Taylor expanded in x around 0 58.1%
sub-neg58.1%
associate-*r/58.1%
metadata-eval58.1%
metadata-eval58.1%
Simplified58.1%
Final simplification64.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -0.11) (not (<= (/ x y) 9.2e+20))) (- (/ x y) 2.0) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -0.11) || !((x / y) <= 9.2e+20)) {
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) <= (-0.11d0)) .or. (.not. ((x / y) <= 9.2d+20))) 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) <= -0.11) || !((x / y) <= 9.2e+20)) {
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) <= -0.11) or not ((x / y) <= 9.2e+20): 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) <= -0.11) || !(Float64(x / y) <= 9.2e+20)) 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) <= -0.11) || ~(((x / y) <= 9.2e+20))) 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], -0.11], N[Not[LessEqual[N[(x / y), $MachinePrecision], 9.2e+20]], $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 -0.11 \lor \neg \left(\frac{x}{y} \leq 9.2 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -0.110000000000000001 or 9.2e20 < (/.f64 x y) Initial program 81.6%
Taylor expanded in t around inf 70.5%
if -0.110000000000000001 < (/.f64 x y) < 9.2e20Initial program 86.1%
Taylor expanded in z around inf 58.9%
div-sub58.9%
sub-neg58.9%
*-inverses58.9%
metadata-eval58.9%
distribute-lft-in58.9%
associate-*r/58.9%
metadata-eval58.9%
metadata-eval58.9%
Simplified58.9%
Taylor expanded in x around 0 58.8%
sub-neg58.8%
associate-*r/58.8%
metadata-eval58.8%
metadata-eval58.8%
Simplified58.8%
Final simplification64.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.75e-189) (not (<= z 8.6e-38))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (+ (/ 2.0 (* t z)) (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.75e-189) || !(z <= 8.6e-38)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (2.0 / (t * z)) + (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 <= (-1.75d-189)) .or. (.not. (z <= 8.6d-38))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
else
tmp = (2.0d0 / (t * z)) + (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 <= -1.75e-189) || !(z <= 8.6e-38)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (2.0 / (t * z)) + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.75e-189) or not (z <= 8.6e-38): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = (2.0 / (t * z)) + (2.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.75e-189) || !(z <= 8.6e-38)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); else tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.75e-189) || ~((z <= 8.6e-38))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = (2.0 / (t * z)) + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.75e-189], N[Not[LessEqual[z, 8.6e-38]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{-189} \lor \neg \left(z \leq 8.6 \cdot 10^{-38}\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{2}{t}\\
\end{array}
\end{array}
if z < -1.7500000000000001e-189 or 8.6000000000000004e-38 < z Initial program 76.1%
Taylor expanded in z around inf 89.6%
div-sub89.6%
sub-neg89.6%
*-inverses89.6%
metadata-eval89.6%
distribute-lft-in89.6%
associate-*r/89.6%
metadata-eval89.6%
metadata-eval89.6%
Simplified89.6%
if -1.7500000000000001e-189 < z < 8.6000000000000004e-38Initial program 96.7%
Taylor expanded in t around 0 69.6%
associate-*r/69.6%
metadata-eval69.6%
Simplified69.6%
div-inv69.6%
Applied egg-rr69.6%
Taylor expanded in z around 0 69.6%
associate-*r/69.6%
metadata-eval69.6%
associate-*r/69.6%
metadata-eval69.6%
Simplified69.6%
Final simplification82.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.8e-33) (not (<= z 8.5e-9))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (+ (/ 2.0 (* t z)) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.8e-33) || !(z <= 8.5e-9)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} 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 <= (-8.8d-33)) .or. (.not. (z <= 8.5d-9))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
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 <= -8.8e-33) || !(z <= 8.5e-9)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (2.0 / (t * z)) + (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.8e-33) or not (z <= 8.5e-9): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = (2.0 / (t * z)) + (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.8e-33) || !(z <= 8.5e-9)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); 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 <= -8.8e-33) || ~((z <= 8.5e-9))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = (2.0 / (t * z)) + (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.8e-33], N[Not[LessEqual[z, 8.5e-9]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $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 -8.8 \cdot 10^{-33} \lor \neg \left(z \leq 8.5 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{x}{y}\\
\end{array}
\end{array}
if z < -8.80000000000000022e-33 or 8.5e-9 < z Initial program 69.9%
Taylor expanded in z around inf 97.4%
div-sub97.4%
sub-neg97.4%
*-inverses97.4%
metadata-eval97.4%
distribute-lft-in97.4%
associate-*r/97.4%
metadata-eval97.4%
metadata-eval97.4%
Simplified97.4%
if -8.80000000000000022e-33 < z < 8.5e-9Initial program 97.5%
Taylor expanded in z around 0 87.3%
Final simplification92.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.2e-31)
(+ (/ x y) (+ -2.0 (/ 2.0 t)))
(if (<= z 7.2e-8)
(+ (/ 2.0 (* t z)) (/ x y))
(- (+ (/ x y) (/ 2.0 t)) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.2e-31) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else if (z <= 7.2e-8) {
tmp = (2.0 / (t * z)) + (x / y);
} else {
tmp = ((x / y) + (2.0 / t)) - 2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-4.2d-31)) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
else if (z <= 7.2d-8) then
tmp = (2.0d0 / (t * z)) + (x / y)
else
tmp = ((x / y) + (2.0d0 / t)) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.2e-31) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else if (z <= 7.2e-8) {
tmp = (2.0 / (t * z)) + (x / y);
} else {
tmp = ((x / y) + (2.0 / t)) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.2e-31: tmp = (x / y) + (-2.0 + (2.0 / t)) elif z <= 7.2e-8: tmp = (2.0 / (t * z)) + (x / y) else: tmp = ((x / y) + (2.0 / t)) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.2e-31) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); elseif (z <= 7.2e-8) tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(x / y)); else tmp = Float64(Float64(Float64(x / y) + Float64(2.0 / t)) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.2e-31) tmp = (x / y) + (-2.0 + (2.0 / t)); elseif (z <= 7.2e-8) tmp = (2.0 / (t * z)) + (x / y); else tmp = ((x / y) + (2.0 / t)) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.2e-31], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e-8], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-31}:\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-8}:\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{y} + \frac{2}{t}\right) - 2\\
\end{array}
\end{array}
if z < -4.19999999999999982e-31Initial program 66.4%
Taylor expanded in z around inf 95.5%
div-sub95.5%
sub-neg95.5%
*-inverses95.5%
metadata-eval95.5%
distribute-lft-in95.5%
associate-*r/95.5%
metadata-eval95.5%
metadata-eval95.5%
Simplified95.5%
if -4.19999999999999982e-31 < z < 7.19999999999999962e-8Initial program 97.5%
Taylor expanded in z around 0 87.3%
if 7.19999999999999962e-8 < z Initial program 73.0%
Taylor expanded in t around 0 100.0%
Taylor expanded in z around inf 99.1%
associate-*r/99.1%
metadata-eval99.1%
+-commutative99.1%
Simplified99.1%
Final simplification92.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -0.13) (not (<= (/ x y) 8.8e+20))) (/ x y) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -0.13) || !((x / y) <= 8.8e+20)) {
tmp = x / y;
} 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 (((x / y) <= (-0.13d0)) .or. (.not. ((x / y) <= 8.8d+20))) then
tmp = x / y
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 (((x / y) <= -0.13) || !((x / y) <= 8.8e+20)) {
tmp = x / y;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -0.13) or not ((x / y) <= 8.8e+20): tmp = x / y else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -0.13) || !(Float64(x / y) <= 8.8e+20)) tmp = Float64(x / y); else tmp = Float64(2.0 / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -0.13) || ~(((x / y) <= 8.8e+20))) tmp = x / y; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -0.13], N[Not[LessEqual[N[(x / y), $MachinePrecision], 8.8e+20]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -0.13 \lor \neg \left(\frac{x}{y} \leq 8.8 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -0.13 or 8.8e20 < (/.f64 x y) Initial program 81.6%
Taylor expanded in x around inf 69.2%
if -0.13 < (/.f64 x y) < 8.8e20Initial program 86.1%
Taylor expanded in z around inf 58.9%
div-sub58.9%
sub-neg58.9%
*-inverses58.9%
metadata-eval58.9%
distribute-lft-in58.9%
associate-*r/58.9%
metadata-eval58.9%
metadata-eval58.9%
Simplified58.9%
Taylor expanded in t around 0 26.7%
Final simplification48.5%
(FPCore (x y z t) :precision binary64 (+ -2.0 (+ (/ x y) (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
return -2.0 + ((x / y) + ((2.0 + (2.0 / z)) / t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (-2.0d0) + ((x / y) + ((2.0d0 + (2.0d0 / z)) / t))
end function
public static double code(double x, double y, double z, double t) {
return -2.0 + ((x / y) + ((2.0 + (2.0 / z)) / t));
}
def code(x, y, z, t): return -2.0 + ((x / y) + ((2.0 + (2.0 / z)) / t))
function code(x, y, z, t) return Float64(-2.0 + Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(2.0 / z)) / t))) end
function tmp = code(x, y, z, t) tmp = -2.0 + ((x / y) + ((2.0 + (2.0 / z)) / t)); end
code[x_, y_, z_, t_] := N[(-2.0 + N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-2 + \left(\frac{x}{y} + \frac{2 + \frac{2}{z}}{t}\right)
\end{array}
Initial program 83.8%
+-commutative83.8%
remove-double-neg83.8%
distribute-frac-neg83.8%
unsub-neg83.8%
*-commutative83.8%
associate-*r*83.8%
distribute-rgt1-in83.8%
associate-/l*83.7%
fma-neg83.7%
*-commutative83.7%
fma-define83.7%
*-commutative83.7%
distribute-frac-neg83.7%
remove-double-neg83.7%
Simplified83.7%
Taylor expanded in t around inf 98.3%
sub-neg98.3%
metadata-eval98.3%
+-commutative98.3%
+-commutative98.3%
associate-*r/98.3%
distribute-lft-in98.3%
metadata-eval98.3%
associate-*r/98.3%
metadata-eval98.3%
Simplified98.3%
Final simplification98.3%
(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 83.8%
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 18.0%
Final simplification18.0%
(FPCore (x y z t) :precision binary64 (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y))))
double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((2.0d0 / z) + 2.0d0) / t) - (2.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
def code(x, y, z, t): return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(2.0 / z) + 2.0) / t) - Float64(2.0 - Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = (((2.0 / z) + 2.0) / t) - (2.0 - (x / y)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(2.0 / z), $MachinePrecision] + 2.0), $MachinePrecision] / t), $MachinePrecision] - N[(2.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{z} + 2}{t} - \left(2 - \frac{x}{y}\right)
\end{array}
herbie shell --seed 2024053
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:alt
(- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))