
(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 (+ (/ 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 86.5%
+-commutative86.5%
remove-double-neg86.5%
distribute-frac-neg86.5%
unsub-neg86.5%
*-commutative86.5%
associate-*r*86.5%
distribute-rgt1-in86.5%
associate-/l*86.5%
fma-neg86.5%
*-commutative86.5%
fma-define86.5%
*-commutative86.5%
distribute-frac-neg86.5%
remove-double-neg86.5%
Simplified86.5%
Taylor expanded in t around inf 98.8%
sub-neg98.8%
metadata-eval98.8%
+-commutative98.8%
+-commutative98.8%
associate-*r/98.8%
distribute-lft-in98.8%
metadata-eval98.8%
associate-*r/98.8%
metadata-eval98.8%
Simplified98.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)) (t_2 (+ -2.0 (/ 2.0 t))))
(if (<= (/ x y) -7.4e-9)
t_1
(if (<= (/ x y) -4.7e-209)
t_2
(if (<= (/ x y) -4e-323)
(+ -2.0 (/ 2.0 (* z t)))
(if (<= (/ x y) 6e-272)
t_2
(if (<= (/ x y) 6.2e-85)
(+ -2.0 (/ (/ 2.0 t) z))
(if (<= (/ x y) 61.0) t_2 t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double t_2 = -2.0 + (2.0 / t);
double tmp;
if ((x / y) <= -7.4e-9) {
tmp = t_1;
} else if ((x / y) <= -4.7e-209) {
tmp = t_2;
} else if ((x / y) <= -4e-323) {
tmp = -2.0 + (2.0 / (z * t));
} else if ((x / y) <= 6e-272) {
tmp = t_2;
} else if ((x / y) <= 6.2e-85) {
tmp = -2.0 + ((2.0 / t) / z);
} else if ((x / y) <= 61.0) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = (x / y) - 2.0d0
t_2 = (-2.0d0) + (2.0d0 / t)
if ((x / y) <= (-7.4d-9)) then
tmp = t_1
else if ((x / y) <= (-4.7d-209)) then
tmp = t_2
else if ((x / y) <= (-4d-323)) then
tmp = (-2.0d0) + (2.0d0 / (z * t))
else if ((x / y) <= 6d-272) then
tmp = t_2
else if ((x / y) <= 6.2d-85) then
tmp = (-2.0d0) + ((2.0d0 / t) / z)
else if ((x / y) <= 61.0d0) then
tmp = t_2
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;
double t_2 = -2.0 + (2.0 / t);
double tmp;
if ((x / y) <= -7.4e-9) {
tmp = t_1;
} else if ((x / y) <= -4.7e-209) {
tmp = t_2;
} else if ((x / y) <= -4e-323) {
tmp = -2.0 + (2.0 / (z * t));
} else if ((x / y) <= 6e-272) {
tmp = t_2;
} else if ((x / y) <= 6.2e-85) {
tmp = -2.0 + ((2.0 / t) / z);
} else if ((x / y) <= 61.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 t_2 = -2.0 + (2.0 / t) tmp = 0 if (x / y) <= -7.4e-9: tmp = t_1 elif (x / y) <= -4.7e-209: tmp = t_2 elif (x / y) <= -4e-323: tmp = -2.0 + (2.0 / (z * t)) elif (x / y) <= 6e-272: tmp = t_2 elif (x / y) <= 6.2e-85: tmp = -2.0 + ((2.0 / t) / z) elif (x / y) <= 61.0: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) t_2 = Float64(-2.0 + Float64(2.0 / t)) tmp = 0.0 if (Float64(x / y) <= -7.4e-9) tmp = t_1; elseif (Float64(x / y) <= -4.7e-209) tmp = t_2; elseif (Float64(x / y) <= -4e-323) tmp = Float64(-2.0 + Float64(2.0 / Float64(z * t))); elseif (Float64(x / y) <= 6e-272) tmp = t_2; elseif (Float64(x / y) <= 6.2e-85) tmp = Float64(-2.0 + Float64(Float64(2.0 / t) / z)); elseif (Float64(x / y) <= 61.0) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; t_2 = -2.0 + (2.0 / t); tmp = 0.0; if ((x / y) <= -7.4e-9) tmp = t_1; elseif ((x / y) <= -4.7e-209) tmp = t_2; elseif ((x / y) <= -4e-323) tmp = -2.0 + (2.0 / (z * t)); elseif ((x / y) <= 6e-272) tmp = t_2; elseif ((x / y) <= 6.2e-85) tmp = -2.0 + ((2.0 / t) / z); elseif ((x / y) <= 61.0) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -7.4e-9], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -4.7e-209], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], -4e-323], N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 6e-272], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], 6.2e-85], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 61.0], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
t_2 := -2 + \frac{2}{t}\\
\mathbf{if}\;\frac{x}{y} \leq -7.4 \cdot 10^{-9}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq -4.7 \cdot 10^{-209}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\frac{x}{y} \leq -4 \cdot 10^{-323}:\\
\;\;\;\;-2 + \frac{2}{z \cdot t}\\
\mathbf{elif}\;\frac{x}{y} \leq 6 \cdot 10^{-272}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\frac{x}{y} \leq 6.2 \cdot 10^{-85}:\\
\;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\
\mathbf{elif}\;\frac{x}{y} \leq 61:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -7.4e-9 or 61 < (/.f64 x y) Initial program 86.3%
Taylor expanded in t around inf 73.2%
if -7.4e-9 < (/.f64 x y) < -4.7000000000000001e-209 or -3.95253e-323 < (/.f64 x y) < 6.0000000000000006e-272 or 6.2000000000000005e-85 < (/.f64 x y) < 61Initial program 91.1%
Taylor expanded in z around inf 80.1%
div-sub80.1%
sub-neg80.1%
*-inverses80.1%
metadata-eval80.1%
distribute-lft-in80.1%
metadata-eval80.1%
associate-*r/80.1%
metadata-eval80.1%
Simplified80.1%
Taylor expanded in x around 0 80.1%
sub-neg80.1%
associate-*r/80.1%
metadata-eval80.1%
metadata-eval80.1%
Simplified80.1%
if -4.7000000000000001e-209 < (/.f64 x y) < -3.95253e-323Initial program 78.5%
+-commutative78.5%
remove-double-neg78.5%
distribute-frac-neg78.5%
unsub-neg78.5%
*-commutative78.5%
associate-*r*78.5%
distribute-rgt1-in78.5%
associate-/l*78.2%
fma-neg78.2%
*-commutative78.2%
fma-define78.2%
*-commutative78.2%
distribute-frac-neg78.2%
remove-double-neg78.2%
Simplified78.2%
Taylor expanded in t around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-*r/100.0%
distribute-lft-in100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 93.2%
if 6.0000000000000006e-272 < (/.f64 x y) < 6.2000000000000005e-85Initial program 79.8%
+-commutative79.8%
remove-double-neg79.8%
distribute-frac-neg79.8%
unsub-neg79.8%
*-commutative79.8%
associate-*r*79.8%
distribute-rgt1-in79.8%
associate-/l*79.6%
fma-neg79.6%
*-commutative79.6%
fma-define79.6%
*-commutative79.6%
distribute-frac-neg79.6%
remove-double-neg79.6%
Simplified79.6%
Taylor expanded in t around inf 99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-*r/99.9%
distribute-lft-in99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
+-commutative99.9%
frac-add72.9%
Applied egg-rr72.9%
Taylor expanded in z around 0 60.7%
Taylor expanded in y around 0 83.9%
sub-neg83.9%
metadata-eval83.9%
associate-*r/83.9%
metadata-eval83.9%
associate-/r*84.0%
Simplified84.0%
Final simplification77.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ -2.0 (/ 2.0 (* z t))))
(t_2 (- (/ x y) 2.0))
(t_3 (+ -2.0 (/ 2.0 t))))
(if (<= (/ x y) -5.8e-10)
t_2
(if (<= (/ x y) -5.5e-219)
t_3
(if (<= (/ x y) -4e-323)
t_1
(if (<= (/ x y) 5.4e-282)
t_3
(if (<= (/ x y) 4e-85) t_1 (if (<= (/ x y) 48.0) t_3 t_2))))))))
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;
double t_3 = -2.0 + (2.0 / t);
double tmp;
if ((x / y) <= -5.8e-10) {
tmp = t_2;
} else if ((x / y) <= -5.5e-219) {
tmp = t_3;
} else if ((x / y) <= -4e-323) {
tmp = t_1;
} else if ((x / y) <= 5.4e-282) {
tmp = t_3;
} else if ((x / y) <= 4e-85) {
tmp = t_1;
} else if ((x / y) <= 48.0) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (-2.0d0) + (2.0d0 / (z * t))
t_2 = (x / y) - 2.0d0
t_3 = (-2.0d0) + (2.0d0 / t)
if ((x / y) <= (-5.8d-10)) then
tmp = t_2
else if ((x / y) <= (-5.5d-219)) then
tmp = t_3
else if ((x / y) <= (-4d-323)) then
tmp = t_1
else if ((x / y) <= 5.4d-282) then
tmp = t_3
else if ((x / y) <= 4d-85) then
tmp = t_1
else if ((x / y) <= 48.0d0) then
tmp = t_3
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -2.0 + (2.0 / (z * t));
double t_2 = (x / y) - 2.0;
double t_3 = -2.0 + (2.0 / t);
double tmp;
if ((x / y) <= -5.8e-10) {
tmp = t_2;
} else if ((x / y) <= -5.5e-219) {
tmp = t_3;
} else if ((x / y) <= -4e-323) {
tmp = t_1;
} else if ((x / y) <= 5.4e-282) {
tmp = t_3;
} else if ((x / y) <= 4e-85) {
tmp = t_1;
} else if ((x / y) <= 48.0) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = -2.0 + (2.0 / (z * t)) t_2 = (x / y) - 2.0 t_3 = -2.0 + (2.0 / t) tmp = 0 if (x / y) <= -5.8e-10: tmp = t_2 elif (x / y) <= -5.5e-219: tmp = t_3 elif (x / y) <= -4e-323: tmp = t_1 elif (x / y) <= 5.4e-282: tmp = t_3 elif (x / y) <= 4e-85: tmp = t_1 elif (x / y) <= 48.0: tmp = t_3 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(-2.0 + Float64(2.0 / Float64(z * t))) t_2 = Float64(Float64(x / y) - 2.0) t_3 = Float64(-2.0 + Float64(2.0 / t)) tmp = 0.0 if (Float64(x / y) <= -5.8e-10) tmp = t_2; elseif (Float64(x / y) <= -5.5e-219) tmp = t_3; elseif (Float64(x / y) <= -4e-323) tmp = t_1; elseif (Float64(x / y) <= 5.4e-282) tmp = t_3; elseif (Float64(x / y) <= 4e-85) tmp = t_1; elseif (Float64(x / y) <= 48.0) tmp = t_3; else tmp = t_2; 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_3 = -2.0 + (2.0 / t); tmp = 0.0; if ((x / y) <= -5.8e-10) tmp = t_2; elseif ((x / y) <= -5.5e-219) tmp = t_3; elseif ((x / y) <= -4e-323) tmp = t_1; elseif ((x / y) <= 5.4e-282) tmp = t_3; elseif ((x / y) <= 4e-85) tmp = t_1; elseif ((x / y) <= 48.0) tmp = t_3; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, Block[{t$95$3 = N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -5.8e-10], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], -5.5e-219], t$95$3, If[LessEqual[N[(x / y), $MachinePrecision], -4e-323], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 5.4e-282], t$95$3, If[LessEqual[N[(x / y), $MachinePrecision], 4e-85], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 48.0], t$95$3, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -2 + \frac{2}{z \cdot t}\\
t_2 := \frac{x}{y} - 2\\
t_3 := -2 + \frac{2}{t}\\
\mathbf{if}\;\frac{x}{y} \leq -5.8 \cdot 10^{-10}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\frac{x}{y} \leq -5.5 \cdot 10^{-219}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;\frac{x}{y} \leq -4 \cdot 10^{-323}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 5.4 \cdot 10^{-282}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 48:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 x y) < -5.79999999999999962e-10 or 48 < (/.f64 x y) Initial program 86.3%
Taylor expanded in t around inf 73.2%
if -5.79999999999999962e-10 < (/.f64 x y) < -5.50000000000000017e-219 or -3.95253e-323 < (/.f64 x y) < 5.39999999999999964e-282 or 3.9999999999999999e-85 < (/.f64 x y) < 48Initial program 91.1%
Taylor expanded in z around inf 80.1%
div-sub80.1%
sub-neg80.1%
*-inverses80.1%
metadata-eval80.1%
distribute-lft-in80.1%
metadata-eval80.1%
associate-*r/80.1%
metadata-eval80.1%
Simplified80.1%
Taylor expanded in x around 0 80.1%
sub-neg80.1%
associate-*r/80.1%
metadata-eval80.1%
metadata-eval80.1%
Simplified80.1%
if -5.50000000000000017e-219 < (/.f64 x y) < -3.95253e-323 or 5.39999999999999964e-282 < (/.f64 x y) < 3.9999999999999999e-85Initial program 79.3%
+-commutative79.3%
remove-double-neg79.3%
distribute-frac-neg79.3%
unsub-neg79.3%
*-commutative79.3%
associate-*r*79.3%
distribute-rgt1-in79.3%
associate-/l*79.1%
fma-neg79.1%
*-commutative79.1%
fma-define79.1%
*-commutative79.1%
distribute-frac-neg79.1%
remove-double-neg79.1%
Simplified79.1%
Taylor expanded in t around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-*r/100.0%
distribute-lft-in100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 87.2%
Final simplification77.2%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -2.0)
(/ x y)
(if (<= (/ x y) -2e-321)
-2.0
(if (<= (/ x y) 5e-270)
(/ 2.0 t)
(if (<= (/ x y) 8.2e-79)
-2.0
(if (<= (/ x y) 4e+50) (/ 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) <= -2e-321) {
tmp = -2.0;
} else if ((x / y) <= 5e-270) {
tmp = 2.0 / t;
} else if ((x / y) <= 8.2e-79) {
tmp = -2.0;
} else if ((x / y) <= 4e+50) {
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) <= (-2d-321)) then
tmp = -2.0d0
else if ((x / y) <= 5d-270) then
tmp = 2.0d0 / t
else if ((x / y) <= 8.2d-79) then
tmp = -2.0d0
else if ((x / y) <= 4d+50) 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) <= -2e-321) {
tmp = -2.0;
} else if ((x / y) <= 5e-270) {
tmp = 2.0 / t;
} else if ((x / y) <= 8.2e-79) {
tmp = -2.0;
} else if ((x / y) <= 4e+50) {
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) <= -2e-321: tmp = -2.0 elif (x / y) <= 5e-270: tmp = 2.0 / t elif (x / y) <= 8.2e-79: tmp = -2.0 elif (x / y) <= 4e+50: 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) <= -2e-321) tmp = -2.0; elseif (Float64(x / y) <= 5e-270) tmp = Float64(2.0 / t); elseif (Float64(x / y) <= 8.2e-79) tmp = -2.0; elseif (Float64(x / y) <= 4e+50) 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) <= -2e-321) tmp = -2.0; elseif ((x / y) <= 5e-270) tmp = 2.0 / t; elseif ((x / y) <= 8.2e-79) tmp = -2.0; elseif ((x / y) <= 4e+50) 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], -2e-321], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 5e-270], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 8.2e-79], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 4e+50], 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 -2 \cdot 10^{-321}:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-270}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 8.2 \cdot 10^{-79}:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{+50}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -2 or 4.0000000000000003e50 < (/.f64 x y) Initial program 85.4%
Taylor expanded in x around inf 74.4%
if -2 < (/.f64 x y) < -2.00097e-321 or 4.9999999999999998e-270 < (/.f64 x y) < 8.19999999999999987e-79Initial program 82.0%
+-commutative82.0%
remove-double-neg82.0%
distribute-frac-neg82.0%
unsub-neg82.0%
*-commutative82.0%
associate-*r*82.0%
distribute-rgt1-in82.0%
associate-/l*81.8%
fma-neg81.8%
*-commutative81.8%
fma-define81.8%
*-commutative81.8%
distribute-frac-neg81.8%
remove-double-neg81.8%
Simplified81.8%
Taylor expanded in t around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-*r/100.0%
distribute-lft-in100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 73.8%
Taylor expanded in t around inf 47.9%
if -2.00097e-321 < (/.f64 x y) < 4.9999999999999998e-270 or 8.19999999999999987e-79 < (/.f64 x y) < 4.0000000000000003e50Initial program 97.4%
Taylor expanded in z around inf 68.3%
div-sub68.3%
sub-neg68.3%
*-inverses68.3%
metadata-eval68.3%
distribute-lft-in68.3%
metadata-eval68.3%
associate-*r/68.3%
metadata-eval68.3%
Simplified68.3%
Taylor expanded in y around 0 43.0%
sub-neg43.0%
associate-*r/43.0%
metadata-eval43.0%
metadata-eval43.0%
Simplified43.0%
Taylor expanded in t around 0 52.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ x y) (+ -2.0 (/ 2.0 t)))))
(if (<= z -1.18e-105)
t_1
(if (<= z -1.8e-145)
(+ -2.0 (/ 2.0 (* z t)))
(if (<= z -2.8e-198)
(- (/ x y) 2.0)
(if (<= z 5.2e-74) (+ -2.0 (/ (/ 2.0 t) z)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) + (-2.0 + (2.0 / t));
double tmp;
if (z <= -1.18e-105) {
tmp = t_1;
} else if (z <= -1.8e-145) {
tmp = -2.0 + (2.0 / (z * t));
} else if (z <= -2.8e-198) {
tmp = (x / y) - 2.0;
} else if (z <= 5.2e-74) {
tmp = -2.0 + ((2.0 / t) / z);
} 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) + (2.0d0 / t))
if (z <= (-1.18d-105)) then
tmp = t_1
else if (z <= (-1.8d-145)) then
tmp = (-2.0d0) + (2.0d0 / (z * t))
else if (z <= (-2.8d-198)) then
tmp = (x / y) - 2.0d0
else if (z <= 5.2d-74) then
tmp = (-2.0d0) + ((2.0d0 / t) / z)
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 + (2.0 / t));
double tmp;
if (z <= -1.18e-105) {
tmp = t_1;
} else if (z <= -1.8e-145) {
tmp = -2.0 + (2.0 / (z * t));
} else if (z <= -2.8e-198) {
tmp = (x / y) - 2.0;
} else if (z <= 5.2e-74) {
tmp = -2.0 + ((2.0 / t) / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) + (-2.0 + (2.0 / t)) tmp = 0 if z <= -1.18e-105: tmp = t_1 elif z <= -1.8e-145: tmp = -2.0 + (2.0 / (z * t)) elif z <= -2.8e-198: tmp = (x / y) - 2.0 elif z <= 5.2e-74: tmp = -2.0 + ((2.0 / t) / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))) tmp = 0.0 if (z <= -1.18e-105) tmp = t_1; elseif (z <= -1.8e-145) tmp = Float64(-2.0 + Float64(2.0 / Float64(z * t))); elseif (z <= -2.8e-198) tmp = Float64(Float64(x / y) - 2.0); elseif (z <= 5.2e-74) tmp = Float64(-2.0 + Float64(Float64(2.0 / t) / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) + (-2.0 + (2.0 / t)); tmp = 0.0; if (z <= -1.18e-105) tmp = t_1; elseif (z <= -1.8e-145) tmp = -2.0 + (2.0 / (z * t)); elseif (z <= -2.8e-198) tmp = (x / y) - 2.0; elseif (z <= 5.2e-74) tmp = -2.0 + ((2.0 / t) / z); 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 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.18e-105], t$95$1, If[LessEqual[z, -1.8e-145], N[(-2.0 + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.8e-198], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], If[LessEqual[z, 5.2e-74], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{if}\;z \leq -1.18 \cdot 10^{-105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-145}:\\
\;\;\;\;-2 + \frac{2}{z \cdot t}\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-198}:\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-74}:\\
\;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.1799999999999999e-105 or 5.2000000000000002e-74 < z Initial program 82.9%
Taylor expanded in z around inf 93.7%
div-sub93.7%
sub-neg93.7%
*-inverses93.7%
metadata-eval93.7%
distribute-lft-in93.7%
metadata-eval93.7%
associate-*r/93.7%
metadata-eval93.7%
Simplified93.7%
if -1.1799999999999999e-105 < z < -1.8e-145Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt1-in100.0%
associate-/l*100.0%
fma-neg100.0%
*-commutative100.0%
fma-define100.0%
*-commutative100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in t around inf 99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
+-commutative99.7%
associate-*r/99.7%
distribute-lft-in99.7%
metadata-eval99.7%
associate-*r/99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 100.0%
if -1.8e-145 < z < -2.7999999999999999e-198Initial program 100.0%
Taylor expanded in t around inf 100.0%
if -2.7999999999999999e-198 < z < 5.2000000000000002e-74Initial program 94.9%
+-commutative94.9%
remove-double-neg94.9%
distribute-frac-neg94.9%
unsub-neg94.9%
*-commutative94.9%
associate-*r*94.9%
distribute-rgt1-in94.9%
associate-/l*94.8%
fma-neg94.8%
*-commutative94.8%
fma-define94.8%
*-commutative94.8%
distribute-frac-neg94.8%
remove-double-neg94.8%
Simplified94.8%
Taylor expanded in t around inf 94.9%
sub-neg94.9%
metadata-eval94.9%
+-commutative94.9%
+-commutative94.9%
associate-*r/94.9%
distribute-lft-in94.9%
metadata-eval94.9%
associate-*r/94.9%
metadata-eval94.9%
Simplified94.9%
+-commutative94.9%
frac-add77.9%
Applied egg-rr77.9%
Taylor expanded in z around 0 57.0%
Taylor expanded in y around 0 75.2%
sub-neg75.2%
metadata-eval75.2%
associate-*r/75.2%
metadata-eval75.2%
associate-/r*75.2%
Simplified75.2%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.22e-26) (not (<= z 4.3e-11))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (/ (- (* x (/ z y)) (/ -2.0 t)) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.22e-26) || !(z <= 4.3e-11)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = ((x * (z / 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 <= (-1.22d-26)) .or. (.not. (z <= 4.3d-11))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
else
tmp = ((x * (z / 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 <= -1.22e-26) || !(z <= 4.3e-11)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = ((x * (z / y)) - (-2.0 / t)) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.22e-26) or not (z <= 4.3e-11): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = ((x * (z / y)) - (-2.0 / t)) / z return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.22e-26) || !(z <= 4.3e-11)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); else tmp = Float64(Float64(Float64(x * Float64(z / y)) - Float64(-2.0 / t)) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.22e-26) || ~((z <= 4.3e-11))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = ((x * (z / y)) - (-2.0 / t)) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.22e-26], N[Not[LessEqual[z, 4.3e-11]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision] - N[(-2.0 / t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.22 \cdot 10^{-26} \lor \neg \left(z \leq 4.3 \cdot 10^{-11}\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{z}{y} - \frac{-2}{t}}{z}\\
\end{array}
\end{array}
if z < -1.22e-26 or 4.30000000000000001e-11 < z Initial program 79.8%
Taylor expanded in z around inf 99.3%
div-sub99.3%
sub-neg99.3%
*-inverses99.3%
metadata-eval99.3%
distribute-lft-in99.3%
metadata-eval99.3%
associate-*r/99.3%
metadata-eval99.3%
Simplified99.3%
if -1.22e-26 < z < 4.30000000000000001e-11Initial program 96.8%
Taylor expanded in z around 0 97.8%
Taylor expanded in x around inf 88.8%
associate-/l*90.9%
Simplified90.9%
div-inv90.9%
frac-2neg90.9%
metadata-eval90.9%
Applied egg-rr90.9%
Final simplification96.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2e-26) (not (<= z 7.8e-13))) (+ (/ 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 <= -2e-26) || !(z <= 7.8e-13)) {
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 <= (-2d-26)) .or. (.not. (z <= 7.8d-13))) 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 <= -2e-26) || !(z <= 7.8e-13)) {
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 <= -2e-26) or not (z <= 7.8e-13): 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 <= -2e-26) || !(z <= 7.8e-13)) 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 <= -2e-26) || ~((z <= 7.8e-13))) 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, -2e-26], N[Not[LessEqual[z, 7.8e-13]], $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 -2 \cdot 10^{-26} \lor \neg \left(z \leq 7.8 \cdot 10^{-13}\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 < -2.0000000000000001e-26 or 7.80000000000000009e-13 < z Initial program 79.8%
Taylor expanded in z around inf 99.3%
div-sub99.3%
sub-neg99.3%
*-inverses99.3%
metadata-eval99.3%
distribute-lft-in99.3%
metadata-eval99.3%
associate-*r/99.3%
metadata-eval99.3%
Simplified99.3%
if -2.0000000000000001e-26 < z < 7.80000000000000009e-13Initial program 96.8%
Taylor expanded in z around 0 88.1%
associate-/r*88.1%
Simplified88.1%
Final simplification94.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.65e-26) (not (<= z 1.38e-11))) (+ (/ 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 <= -1.65e-26) || !(z <= 1.38e-11)) {
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 <= (-1.65d-26)) .or. (.not. (z <= 1.38d-11))) 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 <= -1.65e-26) || !(z <= 1.38e-11)) {
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 <= -1.65e-26) or not (z <= 1.38e-11): 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 <= -1.65e-26) || !(z <= 1.38e-11)) 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 <= -1.65e-26) || ~((z <= 1.38e-11))) 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, -1.65e-26], N[Not[LessEqual[z, 1.38e-11]], $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 -1.65 \cdot 10^{-26} \lor \neg \left(z \leq 1.38 \cdot 10^{-11}\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 < -1.6499999999999999e-26 or 1.38e-11 < z Initial program 79.8%
Taylor expanded in z around inf 99.3%
div-sub99.3%
sub-neg99.3%
*-inverses99.3%
metadata-eval99.3%
distribute-lft-in99.3%
metadata-eval99.3%
associate-*r/99.3%
metadata-eval99.3%
Simplified99.3%
if -1.6499999999999999e-26 < z < 1.38e-11Initial program 96.8%
Taylor expanded in z around 0 88.1%
Final simplification94.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -6e-9) (not (<= (/ x y) 53.0))) (- (/ x y) 2.0) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -6e-9) || !((x / y) <= 53.0)) {
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) <= (-6d-9)) .or. (.not. ((x / y) <= 53.0d0))) 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) <= -6e-9) || !((x / y) <= 53.0)) {
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) <= -6e-9) or not ((x / y) <= 53.0): 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) <= -6e-9) || !(Float64(x / y) <= 53.0)) 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) <= -6e-9) || ~(((x / y) <= 53.0))) 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], -6e-9], N[Not[LessEqual[N[(x / y), $MachinePrecision], 53.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -6 \cdot 10^{-9} \lor \neg \left(\frac{x}{y} \leq 53\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.99999999999999996e-9 or 53 < (/.f64 x y) Initial program 86.3%
Taylor expanded in t around inf 73.2%
if -5.99999999999999996e-9 < (/.f64 x y) < 53Initial program 86.9%
Taylor expanded in z around inf 72.3%
div-sub72.4%
sub-neg72.4%
*-inverses72.4%
metadata-eval72.4%
distribute-lft-in72.4%
metadata-eval72.4%
associate-*r/72.4%
metadata-eval72.4%
Simplified72.4%
Taylor expanded in x around 0 72.4%
sub-neg72.4%
associate-*r/72.4%
metadata-eval72.4%
metadata-eval72.4%
Simplified72.4%
Final simplification72.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+36) (not (<= (/ x y) 4e+50))) (/ x y) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+36) || !((x / y) <= 4e+50)) {
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) <= (-2d+36)) .or. (.not. ((x / y) <= 4d+50))) 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) <= -2e+36) || !((x / y) <= 4e+50)) {
tmp = x / y;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+36) or not ((x / y) <= 4e+50): 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) <= -2e+36) || !(Float64(x / y) <= 4e+50)) 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) <= -2e+36) || ~(((x / y) <= 4e+50))) 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], -2e+36], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e+50]], $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 -2 \cdot 10^{+36} \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+50}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -2.00000000000000008e36 or 4.0000000000000003e50 < (/.f64 x y) Initial program 85.7%
Taylor expanded in x around inf 78.2%
if -2.00000000000000008e36 < (/.f64 x y) < 4.0000000000000003e50Initial program 87.3%
Taylor expanded in z around inf 72.1%
div-sub72.2%
sub-neg72.2%
*-inverses72.2%
metadata-eval72.2%
distribute-lft-in72.2%
metadata-eval72.2%
associate-*r/72.2%
metadata-eval72.2%
Simplified72.2%
Taylor expanded in x around 0 66.7%
sub-neg66.7%
associate-*r/66.7%
metadata-eval66.7%
metadata-eval66.7%
Simplified66.7%
Final simplification72.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.8e-106) (not (<= t 3.8e-114))) (- (/ x y) 2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.8e-106) || !(t <= 3.8e-114)) {
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 <= (-3.8d-106)) .or. (.not. (t <= 3.8d-114))) 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 <= -3.8e-106) || !(t <= 3.8e-114)) {
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 <= -3.8e-106) or not (t <= 3.8e-114): 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 <= -3.8e-106) || !(t <= 3.8e-114)) 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 <= -3.8e-106) || ~((t <= 3.8e-114))) 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, -3.8e-106], N[Not[LessEqual[t, 3.8e-114]], $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 -3.8 \cdot 10^{-106} \lor \neg \left(t \leq 3.8 \cdot 10^{-114}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -3.7999999999999999e-106 or 3.7999999999999998e-114 < t Initial program 81.0%
Taylor expanded in t around inf 77.1%
if -3.7999999999999999e-106 < t < 3.7999999999999998e-114Initial program 97.4%
Taylor expanded in t around 0 86.3%
associate-*r/86.3%
metadata-eval86.3%
Simplified86.3%
Final simplification80.2%
(FPCore (x y z t) :precision binary64 (if (<= t -1.0) -2.0 (if (<= t 1.0) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.0) {
tmp = -2.0;
} else if (t <= 1.0) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-1.0d0)) then
tmp = -2.0d0
else if (t <= 1.0d0) then
tmp = 2.0d0 / t
else
tmp = -2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.0) {
tmp = -2.0;
} else if (t <= 1.0) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.0: tmp = -2.0 elif t <= 1.0: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.0) tmp = -2.0; elseif (t <= 1.0) tmp = Float64(2.0 / t); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.0) tmp = -2.0; elseif (t <= 1.0) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.0], -2.0, If[LessEqual[t, 1.0], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 1:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -1 or 1 < t Initial program 75.9%
+-commutative75.9%
remove-double-neg75.9%
distribute-frac-neg75.9%
unsub-neg75.9%
*-commutative75.9%
associate-*r*75.9%
distribute-rgt1-in75.9%
associate-/l*75.8%
fma-neg75.8%
*-commutative75.8%
fma-define75.8%
*-commutative75.8%
distribute-frac-neg75.8%
remove-double-neg75.8%
Simplified75.8%
Taylor expanded in t around inf 99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-*r/99.9%
distribute-lft-in99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 46.0%
Taylor expanded in t around inf 31.6%
if -1 < t < 1Initial program 97.4%
Taylor expanded in z around inf 71.1%
div-sub71.1%
sub-neg71.1%
*-inverses71.1%
metadata-eval71.1%
distribute-lft-in71.1%
metadata-eval71.1%
associate-*r/71.1%
metadata-eval71.1%
Simplified71.1%
Taylor expanded in y around 0 57.0%
sub-neg57.0%
associate-*r/57.0%
metadata-eval57.0%
metadata-eval57.0%
Simplified57.0%
Taylor expanded in t around 0 42.0%
(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 86.5%
+-commutative86.5%
remove-double-neg86.5%
distribute-frac-neg86.5%
unsub-neg86.5%
*-commutative86.5%
associate-*r*86.5%
distribute-rgt1-in86.5%
associate-/l*86.5%
fma-neg86.5%
*-commutative86.5%
fma-define86.5%
*-commutative86.5%
distribute-frac-neg86.5%
remove-double-neg86.5%
Simplified86.5%
Taylor expanded in t around inf 98.8%
sub-neg98.8%
metadata-eval98.8%
+-commutative98.8%
+-commutative98.8%
associate-*r/98.8%
distribute-lft-in98.8%
metadata-eval98.8%
associate-*r/98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in z around 0 40.2%
Taylor expanded in t around inf 17.2%
(FPCore (x y z t) :precision binary64 (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y))))
double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((2.0d0 / z) + 2.0d0) / t) - (2.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
def code(x, y, z, t): return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(2.0 / z) + 2.0) / t) - Float64(2.0 - Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = (((2.0 / z) + 2.0) / t) - (2.0 - (x / y)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(2.0 / z), $MachinePrecision] + 2.0), $MachinePrecision] / t), $MachinePrecision] - N[(2.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{z} + 2}{t} - \left(2 - \frac{x}{y}\right)
\end{array}
herbie shell --seed 2024108
(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))))