
(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 (+ (/ x y) (+ (/ (/ 2.0 z) t) (+ (/ 2.0 t) -2.0))))
double code(double x, double y, double z, double t) {
return (x / y) + (((2.0 / z) / t) + ((2.0 / 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 / z) / t) + ((2.0d0 / t) + (-2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + (((2.0 / z) / t) + ((2.0 / t) + -2.0));
}
def code(x, y, z, t): return (x / y) + (((2.0 / z) / t) + ((2.0 / t) + -2.0))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(Float64(2.0 / z) / t) + Float64(Float64(2.0 / t) + -2.0))) end
function tmp = code(x, y, z, t) tmp = (x / y) + (((2.0 / z) / t) + ((2.0 / t) + -2.0)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \left(\frac{\frac{2}{z}}{t} + \left(\frac{2}{t} + -2\right)\right)
\end{array}
Initial program 85.0%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-/l/99.9%
associate-*r/99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
associate-*r/99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -400000.0) (not (<= (/ x y) 0.0004))) (+ (/ x y) (/ (+ 2.0 (* 2.0 z)) (* z t))) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -400000.0) || !((x / y) <= 0.0004)) {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t));
} else {
tmp = -2.0 + ((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 (((x / y) <= (-400000.0d0)) .or. (.not. ((x / y) <= 0.0004d0))) then
tmp = (x / y) + ((2.0d0 + (2.0d0 * z)) / (z * t))
else
tmp = (-2.0d0) + ((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 (((x / y) <= -400000.0) || !((x / y) <= 0.0004)) {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t));
} else {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -400000.0) or not ((x / y) <= 0.0004): tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t)) else: tmp = -2.0 + ((2.0 + (2.0 / z)) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -400000.0) || !(Float64(x / y) <= 0.0004)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(2.0 * z)) / Float64(z * t))); else tmp = Float64(-2.0 + 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 (((x / y) <= -400000.0) || ~(((x / y) <= 0.0004))) tmp = (x / y) + ((2.0 + (2.0 * z)) / (z * t)); else tmp = -2.0 + ((2.0 + (2.0 / z)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -400000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.0004]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -400000 \lor \neg \left(\frac{x}{y} \leq 0.0004\right):\\
\;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -4e5 or 4.00000000000000019e-4 < (/.f64 x y) Initial program 85.4%
Taylor expanded in t around 0 98.8%
if -4e5 < (/.f64 x y) < 4.00000000000000019e-4Initial program 84.6%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-/l/99.8%
associate-*r/99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-*r/99.8%
sub-neg99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 98.4%
sub-neg98.4%
associate-*r/98.4%
metadata-eval98.4%
associate-*r/98.4%
metadata-eval98.4%
associate-/r*98.3%
+-commutative98.3%
metadata-eval98.3%
associate-+r+98.3%
+-commutative98.3%
+-commutative98.3%
associate-+l+98.3%
metadata-eval98.3%
associate-*r/98.3%
associate-/r*98.4%
associate-/r*98.3%
metadata-eval98.3%
associate-*r/98.3%
associate-*l/98.4%
distribute-rgt-in98.4%
*-commutative98.4%
Simplified98.3%
Final simplification98.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ 2.0 (/ 2.0 z)) t))
(t_2 (+ (/ x y) (/ 2.0 t)))
(t_3 (- (/ x y) 2.0)))
(if (<= t -1e+38)
t_3
(if (<= t -4.5e-13)
t_1
(if (<= t -2.5e-146)
t_2
(if (<= t 4.3e-113)
t_1
(if (<= t 8e-8) t_2 (if (<= t 5.9e+65) t_1 t_3))))))))
double code(double x, double y, double z, double t) {
double t_1 = (2.0 + (2.0 / z)) / t;
double t_2 = (x / y) + (2.0 / t);
double t_3 = (x / y) - 2.0;
double tmp;
if (t <= -1e+38) {
tmp = t_3;
} else if (t <= -4.5e-13) {
tmp = t_1;
} else if (t <= -2.5e-146) {
tmp = t_2;
} else if (t <= 4.3e-113) {
tmp = t_1;
} else if (t <= 8e-8) {
tmp = t_2;
} else if (t <= 5.9e+65) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (2.0d0 + (2.0d0 / z)) / t
t_2 = (x / y) + (2.0d0 / t)
t_3 = (x / y) - 2.0d0
if (t <= (-1d+38)) then
tmp = t_3
else if (t <= (-4.5d-13)) then
tmp = t_1
else if (t <= (-2.5d-146)) then
tmp = t_2
else if (t <= 4.3d-113) then
tmp = t_1
else if (t <= 8d-8) then
tmp = t_2
else if (t <= 5.9d+65) then
tmp = t_1
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (2.0 + (2.0 / z)) / t;
double t_2 = (x / y) + (2.0 / t);
double t_3 = (x / y) - 2.0;
double tmp;
if (t <= -1e+38) {
tmp = t_3;
} else if (t <= -4.5e-13) {
tmp = t_1;
} else if (t <= -2.5e-146) {
tmp = t_2;
} else if (t <= 4.3e-113) {
tmp = t_1;
} else if (t <= 8e-8) {
tmp = t_2;
} else if (t <= 5.9e+65) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t): t_1 = (2.0 + (2.0 / z)) / t t_2 = (x / y) + (2.0 / t) t_3 = (x / y) - 2.0 tmp = 0 if t <= -1e+38: tmp = t_3 elif t <= -4.5e-13: tmp = t_1 elif t <= -2.5e-146: tmp = t_2 elif t <= 4.3e-113: tmp = t_1 elif t <= 8e-8: tmp = t_2 elif t <= 5.9e+65: tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(2.0 + Float64(2.0 / z)) / t) t_2 = Float64(Float64(x / y) + Float64(2.0 / t)) t_3 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -1e+38) tmp = t_3; elseif (t <= -4.5e-13) tmp = t_1; elseif (t <= -2.5e-146) tmp = t_2; elseif (t <= 4.3e-113) tmp = t_1; elseif (t <= 8e-8) tmp = t_2; elseif (t <= 5.9e+65) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (2.0 + (2.0 / z)) / t; t_2 = (x / y) + (2.0 / t); t_3 = (x / y) - 2.0; tmp = 0.0; if (t <= -1e+38) tmp = t_3; elseif (t <= -4.5e-13) tmp = t_1; elseif (t <= -2.5e-146) tmp = t_2; elseif (t <= 4.3e-113) tmp = t_1; elseif (t <= 8e-8) tmp = t_2; elseif (t <= 5.9e+65) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -1e+38], t$95$3, If[LessEqual[t, -4.5e-13], t$95$1, If[LessEqual[t, -2.5e-146], t$95$2, If[LessEqual[t, 4.3e-113], t$95$1, If[LessEqual[t, 8e-8], t$95$2, If[LessEqual[t, 5.9e+65], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2 + \frac{2}{z}}{t}\\
t_2 := \frac{x}{y} + \frac{2}{t}\\
t_3 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -1 \cdot 10^{+38}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq -4.5 \cdot 10^{-13}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{-146}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 4.3 \cdot 10^{-113}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 8 \cdot 10^{-8}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 5.9 \cdot 10^{+65}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if t < -9.99999999999999977e37 or 5.9000000000000003e65 < t Initial program 63.1%
Taylor expanded in t around inf 91.7%
if -9.99999999999999977e37 < t < -4.5e-13 or -2.49999999999999979e-146 < t < 4.3e-113 or 8.0000000000000002e-8 < t < 5.9000000000000003e65Initial program 99.7%
Taylor expanded in t around 0 77.3%
associate-*r/77.3%
metadata-eval77.3%
Simplified77.3%
if -4.5e-13 < t < -2.49999999999999979e-146 or 4.3e-113 < t < 8.0000000000000002e-8Initial program 99.8%
Taylor expanded in t around 0 99.3%
Taylor expanded in z around inf 77.4%
associate-*r/77.4%
metadata-eval77.4%
+-commutative77.4%
Simplified77.4%
Final simplification83.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ x y) (/ 2.0 t))))
(if (<= (/ x y) -2.55e+106)
t_1
(if (<= (/ x y) -0.16)
(/ (/ 2.0 t) z)
(if (<= (/ x y) 2.0) (+ (/ 2.0 t) -2.0) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) + (2.0 / t);
double tmp;
if ((x / y) <= -2.55e+106) {
tmp = t_1;
} else if ((x / y) <= -0.16) {
tmp = (2.0 / t) / z;
} else if ((x / y) <= 2.0) {
tmp = (2.0 / t) + -2.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x / y) + (2.0d0 / t)
if ((x / y) <= (-2.55d+106)) then
tmp = t_1
else if ((x / y) <= (-0.16d0)) then
tmp = (2.0d0 / t) / z
else if ((x / y) <= 2.0d0) then
tmp = (2.0d0 / t) + (-2.0d0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) + (2.0 / t);
double tmp;
if ((x / y) <= -2.55e+106) {
tmp = t_1;
} else if ((x / y) <= -0.16) {
tmp = (2.0 / t) / z;
} else if ((x / y) <= 2.0) {
tmp = (2.0 / t) + -2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) + (2.0 / t) tmp = 0 if (x / y) <= -2.55e+106: tmp = t_1 elif (x / y) <= -0.16: tmp = (2.0 / t) / z elif (x / y) <= 2.0: tmp = (2.0 / t) + -2.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) + Float64(2.0 / t)) tmp = 0.0 if (Float64(x / y) <= -2.55e+106) tmp = t_1; elseif (Float64(x / y) <= -0.16) tmp = Float64(Float64(2.0 / t) / z); elseif (Float64(x / y) <= 2.0) tmp = Float64(Float64(2.0 / t) + -2.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) + (2.0 / t); tmp = 0.0; if ((x / y) <= -2.55e+106) tmp = t_1; elseif ((x / y) <= -0.16) tmp = (2.0 / t) / z; elseif ((x / y) <= 2.0) tmp = (2.0 / t) + -2.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -2.55e+106], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -0.16], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2.0], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + \frac{2}{t}\\
\mathbf{if}\;\frac{x}{y} \leq -2.55 \cdot 10^{+106}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq -0.16:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\
\mathbf{elif}\;\frac{x}{y} \leq 2:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 x y) < -2.54999999999999986e106 or 2 < (/.f64 x y) Initial program 83.1%
Taylor expanded in t around 0 99.7%
Taylor expanded in z around inf 84.6%
associate-*r/84.6%
metadata-eval84.6%
+-commutative84.6%
Simplified84.6%
if -2.54999999999999986e106 < (/.f64 x y) < -0.160000000000000003Initial program 99.4%
Taylor expanded in z around 0 81.4%
associate-/r*81.7%
Simplified81.7%
+-commutative81.7%
associate-/l/81.4%
*-commutative81.4%
associate-/l/81.7%
frac-add57.9%
Applied egg-rr57.9%
Taylor expanded in z around 0 66.7%
associate-/r*67.0%
Simplified67.0%
if -0.160000000000000003 < (/.f64 x y) < 2Initial program 84.5%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-/l/99.8%
associate-*r/99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-*r/99.8%
sub-neg99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 98.4%
sub-neg98.4%
associate-*r/98.4%
metadata-eval98.4%
associate-*r/98.4%
metadata-eval98.4%
associate-/r*98.3%
+-commutative98.3%
metadata-eval98.3%
associate-+r+98.3%
+-commutative98.3%
+-commutative98.3%
associate-+l+98.3%
metadata-eval98.3%
associate-*r/98.3%
associate-/r*98.4%
associate-/r*98.3%
metadata-eval98.3%
associate-*r/98.3%
associate-*l/98.4%
distribute-rgt-in98.4%
*-commutative98.4%
Simplified98.3%
Taylor expanded in z around inf 69.4%
Final simplification75.9%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -2.55e+106)
(/ x y)
(if (<= (/ x y) -0.15)
(/ 2.0 (* z t))
(if (<= (/ x y) 1.6e-6) (+ (/ 2.0 t) -2.0) (- (/ x y) 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2.55e+106) {
tmp = x / y;
} else if ((x / y) <= -0.15) {
tmp = 2.0 / (z * t);
} else if ((x / y) <= 1.6e-6) {
tmp = (2.0 / t) + -2.0;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x / y) <= (-2.55d+106)) then
tmp = x / y
else if ((x / y) <= (-0.15d0)) then
tmp = 2.0d0 / (z * t)
else if ((x / y) <= 1.6d-6) then
tmp = (2.0d0 / t) + (-2.0d0)
else
tmp = (x / y) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2.55e+106) {
tmp = x / y;
} else if ((x / y) <= -0.15) {
tmp = 2.0 / (z * t);
} else if ((x / y) <= 1.6e-6) {
tmp = (2.0 / t) + -2.0;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2.55e+106: tmp = x / y elif (x / y) <= -0.15: tmp = 2.0 / (z * t) elif (x / y) <= 1.6e-6: tmp = (2.0 / t) + -2.0 else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2.55e+106) tmp = Float64(x / y); elseif (Float64(x / y) <= -0.15) tmp = Float64(2.0 / Float64(z * t)); elseif (Float64(x / y) <= 1.6e-6) tmp = Float64(Float64(2.0 / t) + -2.0); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -2.55e+106) tmp = x / y; elseif ((x / y) <= -0.15) tmp = 2.0 / (z * t); elseif ((x / y) <= 1.6e-6) tmp = (2.0 / t) + -2.0; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2.55e+106], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -0.15], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.6e-6], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2.55 \cdot 10^{+106}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -0.15:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\mathbf{elif}\;\frac{x}{y} \leq 1.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -2.54999999999999986e106Initial program 80.0%
Taylor expanded in x around inf 85.5%
if -2.54999999999999986e106 < (/.f64 x y) < -0.149999999999999994Initial program 99.4%
Taylor expanded in z around 0 81.4%
associate-/r*81.7%
Simplified81.7%
+-commutative81.7%
associate-/l/81.4%
*-commutative81.4%
associate-/l/81.7%
frac-add57.9%
Applied egg-rr57.9%
Taylor expanded in z around 0 66.7%
if -0.149999999999999994 < (/.f64 x y) < 1.5999999999999999e-6Initial program 85.0%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-/l/99.8%
associate-*r/99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-*r/99.8%
sub-neg99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 99.3%
sub-neg99.3%
associate-*r/99.3%
metadata-eval99.3%
associate-*r/99.3%
metadata-eval99.3%
associate-/r*99.2%
+-commutative99.2%
metadata-eval99.2%
associate-+r+99.2%
+-commutative99.2%
+-commutative99.2%
associate-+l+99.2%
metadata-eval99.2%
associate-*r/99.2%
associate-/r*99.3%
associate-/r*99.2%
metadata-eval99.2%
associate-*r/99.2%
associate-*l/99.3%
distribute-rgt-in99.3%
*-commutative99.3%
Simplified99.2%
Taylor expanded in z around inf 69.8%
if 1.5999999999999999e-6 < (/.f64 x y) Initial program 83.9%
Taylor expanded in t around inf 78.4%
Final simplification74.5%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -2.55e+106)
(/ x y)
(if (<= (/ x y) -0.21)
(/ (/ 2.0 t) z)
(if (<= (/ x y) 4.7e-7) (+ (/ 2.0 t) -2.0) (- (/ x y) 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2.55e+106) {
tmp = x / y;
} else if ((x / y) <= -0.21) {
tmp = (2.0 / t) / z;
} else if ((x / y) <= 4.7e-7) {
tmp = (2.0 / t) + -2.0;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x / y) <= (-2.55d+106)) then
tmp = x / y
else if ((x / y) <= (-0.21d0)) then
tmp = (2.0d0 / t) / z
else if ((x / y) <= 4.7d-7) then
tmp = (2.0d0 / t) + (-2.0d0)
else
tmp = (x / y) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2.55e+106) {
tmp = x / y;
} else if ((x / y) <= -0.21) {
tmp = (2.0 / t) / z;
} else if ((x / y) <= 4.7e-7) {
tmp = (2.0 / t) + -2.0;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2.55e+106: tmp = x / y elif (x / y) <= -0.21: tmp = (2.0 / t) / z elif (x / y) <= 4.7e-7: tmp = (2.0 / t) + -2.0 else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2.55e+106) tmp = Float64(x / y); elseif (Float64(x / y) <= -0.21) tmp = Float64(Float64(2.0 / t) / z); elseif (Float64(x / y) <= 4.7e-7) tmp = Float64(Float64(2.0 / t) + -2.0); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -2.55e+106) tmp = x / y; elseif ((x / y) <= -0.21) tmp = (2.0 / t) / z; elseif ((x / y) <= 4.7e-7) tmp = (2.0 / t) + -2.0; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2.55e+106], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -0.21], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 4.7e-7], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2.55 \cdot 10^{+106}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -0.21:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\
\mathbf{elif}\;\frac{x}{y} \leq 4.7 \cdot 10^{-7}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -2.54999999999999986e106Initial program 80.0%
Taylor expanded in x around inf 85.5%
if -2.54999999999999986e106 < (/.f64 x y) < -0.209999999999999992Initial program 99.4%
Taylor expanded in z around 0 81.4%
associate-/r*81.7%
Simplified81.7%
+-commutative81.7%
associate-/l/81.4%
*-commutative81.4%
associate-/l/81.7%
frac-add57.9%
Applied egg-rr57.9%
Taylor expanded in z around 0 66.7%
associate-/r*67.0%
Simplified67.0%
if -0.209999999999999992 < (/.f64 x y) < 4.7e-7Initial program 85.0%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-/l/99.8%
associate-*r/99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-*r/99.8%
sub-neg99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 99.3%
sub-neg99.3%
associate-*r/99.3%
metadata-eval99.3%
associate-*r/99.3%
metadata-eval99.3%
associate-/r*99.2%
+-commutative99.2%
metadata-eval99.2%
associate-+r+99.2%
+-commutative99.2%
+-commutative99.2%
associate-+l+99.2%
metadata-eval99.2%
associate-*r/99.2%
associate-/r*99.3%
associate-/r*99.2%
metadata-eval99.2%
associate-*r/99.2%
associate-*l/99.3%
distribute-rgt-in99.3%
*-commutative99.3%
Simplified99.2%
Taylor expanded in z around inf 69.8%
if 4.7e-7 < (/.f64 x y) Initial program 83.9%
Taylor expanded in t around inf 78.4%
Final simplification74.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2.55e+106) (not (<= (/ x y) 4500000000.0))) (+ (/ x y) (/ 2.0 t)) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2.55e+106) || !((x / y) <= 4500000000.0)) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = -2.0 + ((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 (((x / y) <= (-2.55d+106)) .or. (.not. ((x / y) <= 4500000000.0d0))) then
tmp = (x / y) + (2.0d0 / t)
else
tmp = (-2.0d0) + ((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 (((x / y) <= -2.55e+106) || !((x / y) <= 4500000000.0)) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2.55e+106) or not ((x / y) <= 4500000000.0): tmp = (x / y) + (2.0 / t) else: tmp = -2.0 + ((2.0 + (2.0 / z)) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2.55e+106) || !(Float64(x / y) <= 4500000000.0)) tmp = Float64(Float64(x / y) + Float64(2.0 / t)); else tmp = Float64(-2.0 + 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 (((x / y) <= -2.55e+106) || ~(((x / y) <= 4500000000.0))) tmp = (x / y) + (2.0 / t); else tmp = -2.0 + ((2.0 + (2.0 / z)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2.55e+106], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4500000000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2.55 \cdot 10^{+106} \lor \neg \left(\frac{x}{y} \leq 4500000000\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -2.54999999999999986e106 or 4.5e9 < (/.f64 x y) Initial program 83.1%
Taylor expanded in t around 0 99.7%
Taylor expanded in z around inf 84.6%
associate-*r/84.6%
metadata-eval84.6%
+-commutative84.6%
Simplified84.6%
if -2.54999999999999986e106 < (/.f64 x y) < 4.5e9Initial program 86.5%
Taylor expanded in t around 0 99.8%
associate--l+99.8%
associate-/l/99.8%
associate-*r/99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-*r/99.8%
sub-neg99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 96.0%
sub-neg96.0%
associate-*r/96.0%
metadata-eval96.0%
associate-*r/96.0%
metadata-eval96.0%
associate-/r*96.0%
+-commutative96.0%
metadata-eval96.0%
associate-+r+96.0%
+-commutative96.0%
+-commutative96.0%
associate-+l+96.0%
metadata-eval96.0%
associate-*r/96.0%
associate-/r*96.0%
associate-/r*96.0%
metadata-eval96.0%
associate-*r/96.0%
associate-*l/96.1%
distribute-rgt-in96.0%
*-commutative96.0%
Simplified96.0%
Final simplification91.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -480000.0) (not (<= (/ x y) 1300000.0))) (+ (/ x y) (/ 2.0 (* z t))) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -480000.0) || !((x / y) <= 1300000.0)) {
tmp = (x / y) + (2.0 / (z * t));
} else {
tmp = -2.0 + ((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 (((x / y) <= (-480000.0d0)) .or. (.not. ((x / y) <= 1300000.0d0))) then
tmp = (x / y) + (2.0d0 / (z * t))
else
tmp = (-2.0d0) + ((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 (((x / y) <= -480000.0) || !((x / y) <= 1300000.0)) {
tmp = (x / y) + (2.0 / (z * t));
} else {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -480000.0) or not ((x / y) <= 1300000.0): tmp = (x / y) + (2.0 / (z * t)) else: tmp = -2.0 + ((2.0 + (2.0 / z)) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -480000.0) || !(Float64(x / y) <= 1300000.0)) tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(z * t))); else tmp = Float64(-2.0 + 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 (((x / y) <= -480000.0) || ~(((x / y) <= 1300000.0))) tmp = (x / y) + (2.0 / (z * t)); else tmp = -2.0 + ((2.0 + (2.0 / z)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -480000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1300000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -480000 \lor \neg \left(\frac{x}{y} \leq 1300000\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -4.8e5 or 1.3e6 < (/.f64 x y) Initial program 85.4%
Taylor expanded in z around 0 93.1%
if -4.8e5 < (/.f64 x y) < 1.3e6Initial program 84.6%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-/l/99.8%
associate-*r/99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-*r/99.8%
sub-neg99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 98.4%
sub-neg98.4%
associate-*r/98.4%
metadata-eval98.4%
associate-*r/98.4%
metadata-eval98.4%
associate-/r*98.3%
+-commutative98.3%
metadata-eval98.3%
associate-+r+98.3%
+-commutative98.3%
+-commutative98.3%
associate-+l+98.3%
metadata-eval98.3%
associate-*r/98.3%
associate-/r*98.4%
associate-/r*98.3%
metadata-eval98.3%
associate-*r/98.3%
associate-*l/98.4%
distribute-rgt-in98.4%
*-commutative98.4%
Simplified98.3%
Final simplification95.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -400000.0) (not (<= (/ x y) 0.0004))) (+ (/ x y) (/ (/ 2.0 t) z)) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -400000.0) || !((x / y) <= 0.0004)) {
tmp = (x / y) + ((2.0 / t) / z);
} else {
tmp = -2.0 + ((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 (((x / y) <= (-400000.0d0)) .or. (.not. ((x / y) <= 0.0004d0))) then
tmp = (x / y) + ((2.0d0 / t) / z)
else
tmp = (-2.0d0) + ((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 (((x / y) <= -400000.0) || !((x / y) <= 0.0004)) {
tmp = (x / y) + ((2.0 / t) / z);
} else {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -400000.0) or not ((x / y) <= 0.0004): tmp = (x / y) + ((2.0 / t) / z) else: tmp = -2.0 + ((2.0 + (2.0 / z)) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -400000.0) || !(Float64(x / y) <= 0.0004)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z)); else tmp = Float64(-2.0 + 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 (((x / y) <= -400000.0) || ~(((x / y) <= 0.0004))) tmp = (x / y) + ((2.0 / t) / z); else tmp = -2.0 + ((2.0 + (2.0 / z)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -400000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.0004]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -400000 \lor \neg \left(\frac{x}{y} \leq 0.0004\right):\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -4e5 or 4.00000000000000019e-4 < (/.f64 x y) Initial program 85.4%
Taylor expanded in z around 0 93.1%
associate-/r*93.1%
Simplified93.1%
if -4e5 < (/.f64 x y) < 4.00000000000000019e-4Initial program 84.6%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-/l/99.8%
associate-*r/99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-*r/99.8%
sub-neg99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 98.4%
sub-neg98.4%
associate-*r/98.4%
metadata-eval98.4%
associate-*r/98.4%
metadata-eval98.4%
associate-/r*98.3%
+-commutative98.3%
metadata-eval98.3%
associate-+r+98.3%
+-commutative98.3%
+-commutative98.3%
associate-+l+98.3%
metadata-eval98.3%
associate-*r/98.3%
associate-/r*98.4%
associate-/r*98.3%
metadata-eval98.3%
associate-*r/98.3%
associate-*l/98.4%
distribute-rgt-in98.4%
*-commutative98.4%
Simplified98.3%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -480000.0) (not (<= (/ x y) 92000000.0))) (/ x y) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -480000.0) || !((x / y) <= 92000000.0)) {
tmp = x / y;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-480000.0d0)) .or. (.not. ((x / y) <= 92000000.0d0))) then
tmp = x / y
else
tmp = (2.0d0 / t) + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -480000.0) || !((x / y) <= 92000000.0)) {
tmp = x / y;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -480000.0) or not ((x / y) <= 92000000.0): tmp = x / y else: tmp = (2.0 / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -480000.0) || !(Float64(x / y) <= 92000000.0)) tmp = Float64(x / y); else tmp = Float64(Float64(2.0 / t) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -480000.0) || ~(((x / y) <= 92000000.0))) tmp = x / y; else tmp = (2.0 / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -480000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 92000000.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -480000 \lor \neg \left(\frac{x}{y} \leq 92000000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -4.8e5 or 9.2e7 < (/.f64 x y) Initial program 85.4%
Taylor expanded in x around inf 72.0%
if -4.8e5 < (/.f64 x y) < 9.2e7Initial program 84.6%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-/l/99.8%
associate-*r/99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-*r/99.8%
sub-neg99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 98.4%
sub-neg98.4%
associate-*r/98.4%
metadata-eval98.4%
associate-*r/98.4%
metadata-eval98.4%
associate-/r*98.3%
+-commutative98.3%
metadata-eval98.3%
associate-+r+98.3%
+-commutative98.3%
+-commutative98.3%
associate-+l+98.3%
metadata-eval98.3%
associate-*r/98.3%
associate-/r*98.4%
associate-/r*98.3%
metadata-eval98.3%
associate-*r/98.3%
associate-*l/98.4%
distribute-rgt-in98.4%
*-commutative98.4%
Simplified98.3%
Taylor expanded in z around inf 68.9%
Final simplification70.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -0.2) (not (<= (/ x y) 1.1e-6))) (- (/ x y) 2.0) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -0.2) || !((x / y) <= 1.1e-6)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-0.2d0)) .or. (.not. ((x / y) <= 1.1d-6))) then
tmp = (x / y) - 2.0d0
else
tmp = (2.0d0 / t) + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -0.2) || !((x / y) <= 1.1e-6)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -0.2) or not ((x / y) <= 1.1e-6): tmp = (x / y) - 2.0 else: tmp = (2.0 / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -0.2) || !(Float64(x / y) <= 1.1e-6)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(Float64(2.0 / t) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -0.2) || ~(((x / y) <= 1.1e-6))) tmp = (x / y) - 2.0; else tmp = (2.0 / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -0.2], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1.1e-6]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -0.2 \lor \neg \left(\frac{x}{y} \leq 1.1 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -0.20000000000000001 or 1.1000000000000001e-6 < (/.f64 x y) Initial program 84.9%
Taylor expanded in t around inf 72.9%
if -0.20000000000000001 < (/.f64 x y) < 1.1000000000000001e-6Initial program 85.0%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-/l/99.8%
associate-*r/99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
associate-*r/99.8%
sub-neg99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 99.3%
sub-neg99.3%
associate-*r/99.3%
metadata-eval99.3%
associate-*r/99.3%
metadata-eval99.3%
associate-/r*99.2%
+-commutative99.2%
metadata-eval99.2%
associate-+r+99.2%
+-commutative99.2%
+-commutative99.2%
associate-+l+99.2%
metadata-eval99.2%
associate-*r/99.2%
associate-/r*99.3%
associate-/r*99.2%
metadata-eval99.2%
associate-*r/99.2%
associate-*l/99.3%
distribute-rgt-in99.3%
*-commutative99.3%
Simplified99.2%
Taylor expanded in z around inf 69.8%
Final simplification71.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -0.245) (not (<= (/ x y) 11500000000.0))) (/ x y) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -0.245) || !((x / y) <= 11500000000.0)) {
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.245d0)) .or. (.not. ((x / y) <= 11500000000.0d0))) 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.245) || !((x / y) <= 11500000000.0)) {
tmp = x / y;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -0.245) or not ((x / y) <= 11500000000.0): tmp = x / y else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -0.245) || !(Float64(x / y) <= 11500000000.0)) 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.245) || ~(((x / y) <= 11500000000.0))) 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.245], N[Not[LessEqual[N[(x / y), $MachinePrecision], 11500000000.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -0.245 \lor \neg \left(\frac{x}{y} \leq 11500000000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -0.245 or 1.15e10 < (/.f64 x y) Initial program 85.5%
Taylor expanded in x around inf 71.4%
if -0.245 < (/.f64 x y) < 1.15e10Initial program 84.5%
Taylor expanded in t around 0 60.6%
associate-*r/60.6%
metadata-eval60.6%
Simplified60.6%
Taylor expanded in z around inf 31.4%
Final simplification52.1%
(FPCore (x y z t) :precision binary64 (/ 2.0 t))
double code(double x, double y, double z, double t) {
return 2.0 / t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 2.0d0 / t
end function
public static double code(double x, double y, double z, double t) {
return 2.0 / t;
}
def code(x, y, z, t): return 2.0 / t
function code(x, y, z, t) return Float64(2.0 / t) end
function tmp = code(x, y, z, t) tmp = 2.0 / t; end
code[x_, y_, z_, t_] := N[(2.0 / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{t}
\end{array}
Initial program 85.0%
Taylor expanded in t around 0 45.3%
associate-*r/45.3%
metadata-eval45.3%
Simplified45.3%
Taylor expanded in z around inf 19.0%
Final simplification19.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 2023311
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:herbie-target
(- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))