
(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(Float64(-2.0 + 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[(N[(-2.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-2 + \frac{x}{y}\right) + \frac{2 + \frac{2}{z}}{t}
\end{array}
Initial program 87.7%
+-commutative87.7%
remove-double-neg87.7%
distribute-frac-neg87.7%
unsub-neg87.7%
*-commutative87.7%
associate-*r*87.7%
distribute-rgt1-in87.7%
associate-/l*87.6%
fma-neg87.6%
*-commutative87.6%
fma-define87.6%
*-commutative87.6%
distribute-frac-neg87.6%
remove-double-neg87.6%
Simplified87.6%
Taylor expanded in t around inf 99.1%
associate--l+99.1%
+-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
associate-*r/99.1%
distribute-lft-in99.1%
metadata-eval99.1%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -1.45e+21)
(/ x y)
(if (<= (/ x y) -2.15e-176)
(/ 2.0 t)
(if (<= (/ x y) -4.3e-308)
-2.0
(if (<= (/ x y) 4.5e-204)
(/ 2.0 t)
(if (<= (/ x y) 6.6e-15)
-2.0
(if (<= (/ x y) 3.9e+24) (/ 2.0 t) (/ x y))))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.45e+21) {
tmp = x / y;
} else if ((x / y) <= -2.15e-176) {
tmp = 2.0 / t;
} else if ((x / y) <= -4.3e-308) {
tmp = -2.0;
} else if ((x / y) <= 4.5e-204) {
tmp = 2.0 / t;
} else if ((x / y) <= 6.6e-15) {
tmp = -2.0;
} else if ((x / y) <= 3.9e+24) {
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) <= (-1.45d+21)) then
tmp = x / y
else if ((x / y) <= (-2.15d-176)) then
tmp = 2.0d0 / t
else if ((x / y) <= (-4.3d-308)) then
tmp = -2.0d0
else if ((x / y) <= 4.5d-204) then
tmp = 2.0d0 / t
else if ((x / y) <= 6.6d-15) then
tmp = -2.0d0
else if ((x / y) <= 3.9d+24) 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) <= -1.45e+21) {
tmp = x / y;
} else if ((x / y) <= -2.15e-176) {
tmp = 2.0 / t;
} else if ((x / y) <= -4.3e-308) {
tmp = -2.0;
} else if ((x / y) <= 4.5e-204) {
tmp = 2.0 / t;
} else if ((x / y) <= 6.6e-15) {
tmp = -2.0;
} else if ((x / y) <= 3.9e+24) {
tmp = 2.0 / t;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1.45e+21: tmp = x / y elif (x / y) <= -2.15e-176: tmp = 2.0 / t elif (x / y) <= -4.3e-308: tmp = -2.0 elif (x / y) <= 4.5e-204: tmp = 2.0 / t elif (x / y) <= 6.6e-15: tmp = -2.0 elif (x / y) <= 3.9e+24: tmp = 2.0 / t else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1.45e+21) tmp = Float64(x / y); elseif (Float64(x / y) <= -2.15e-176) tmp = Float64(2.0 / t); elseif (Float64(x / y) <= -4.3e-308) tmp = -2.0; elseif (Float64(x / y) <= 4.5e-204) tmp = Float64(2.0 / t); elseif (Float64(x / y) <= 6.6e-15) tmp = -2.0; elseif (Float64(x / y) <= 3.9e+24) 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) <= -1.45e+21) tmp = x / y; elseif ((x / y) <= -2.15e-176) tmp = 2.0 / t; elseif ((x / y) <= -4.3e-308) tmp = -2.0; elseif ((x / y) <= 4.5e-204) tmp = 2.0 / t; elseif ((x / y) <= 6.6e-15) tmp = -2.0; elseif ((x / y) <= 3.9e+24) tmp = 2.0 / t; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1.45e+21], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -2.15e-176], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -4.3e-308], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 4.5e-204], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 6.6e-15], -2.0, If[LessEqual[N[(x / y), $MachinePrecision], 3.9e+24], N[(2.0 / t), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.45 \cdot 10^{+21}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -2.15 \cdot 10^{-176}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq -4.3 \cdot 10^{-308}:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq 4.5 \cdot 10^{-204}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 6.6 \cdot 10^{-15}:\\
\;\;\;\;-2\\
\mathbf{elif}\;\frac{x}{y} \leq 3.9 \cdot 10^{+24}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.45e21 or 3.8999999999999998e24 < (/.f64 x y) Initial program 81.6%
Taylor expanded in x around inf 70.1%
if -1.45e21 < (/.f64 x y) < -2.15000000000000006e-176 or -4.3000000000000002e-308 < (/.f64 x y) < 4.49999999999999974e-204 or 6.6e-15 < (/.f64 x y) < 3.8999999999999998e24Initial program 93.0%
Taylor expanded in t around 0 76.4%
associate-*r/76.4%
metadata-eval76.4%
Simplified76.4%
Taylor expanded in z around inf 36.8%
if -2.15000000000000006e-176 < (/.f64 x y) < -4.3000000000000002e-308 or 4.49999999999999974e-204 < (/.f64 x y) < 6.6e-15Initial program 89.7%
+-commutative89.7%
remove-double-neg89.7%
distribute-frac-neg89.7%
unsub-neg89.7%
*-commutative89.7%
associate-*r*89.7%
distribute-rgt1-in89.7%
associate-/l*89.6%
fma-neg89.6%
*-commutative89.6%
fma-define89.6%
*-commutative89.6%
distribute-frac-neg89.6%
remove-double-neg89.6%
Simplified89.6%
Taylor expanded in t around inf 100.0%
associate--l+100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.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 x around 0 99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-/r*99.9%
associate-*r/99.9%
associate-*l/99.9%
distribute-rgt-in99.9%
associate-*l/100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in z around 0 78.8%
Taylor expanded in z around inf 51.7%
Final simplification53.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)) (t_2 (+ -2.0 (/ 2.0 t))))
(if (<= z -6.5e+212)
t_2
(if (<= z -2.4e+182)
t_1
(if (<= z -7.6e+27)
t_2
(if (<= z -1.05e-28)
t_1
(if (<= z 5.9e-13)
(/ 2.0 (* z t))
(if (<= z 3.8e+221) 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 (z <= -6.5e+212) {
tmp = t_2;
} else if (z <= -2.4e+182) {
tmp = t_1;
} else if (z <= -7.6e+27) {
tmp = t_2;
} else if (z <= -1.05e-28) {
tmp = t_1;
} else if (z <= 5.9e-13) {
tmp = 2.0 / (z * t);
} else if (z <= 3.8e+221) {
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 (z <= (-6.5d+212)) then
tmp = t_2
else if (z <= (-2.4d+182)) then
tmp = t_1
else if (z <= (-7.6d+27)) then
tmp = t_2
else if (z <= (-1.05d-28)) then
tmp = t_1
else if (z <= 5.9d-13) then
tmp = 2.0d0 / (z * t)
else if (z <= 3.8d+221) 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 (z <= -6.5e+212) {
tmp = t_2;
} else if (z <= -2.4e+182) {
tmp = t_1;
} else if (z <= -7.6e+27) {
tmp = t_2;
} else if (z <= -1.05e-28) {
tmp = t_1;
} else if (z <= 5.9e-13) {
tmp = 2.0 / (z * t);
} else if (z <= 3.8e+221) {
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 z <= -6.5e+212: tmp = t_2 elif z <= -2.4e+182: tmp = t_1 elif z <= -7.6e+27: tmp = t_2 elif z <= -1.05e-28: tmp = t_1 elif z <= 5.9e-13: tmp = 2.0 / (z * t) elif z <= 3.8e+221: 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 (z <= -6.5e+212) tmp = t_2; elseif (z <= -2.4e+182) tmp = t_1; elseif (z <= -7.6e+27) tmp = t_2; elseif (z <= -1.05e-28) tmp = t_1; elseif (z <= 5.9e-13) tmp = Float64(2.0 / Float64(z * t)); elseif (z <= 3.8e+221) 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 (z <= -6.5e+212) tmp = t_2; elseif (z <= -2.4e+182) tmp = t_1; elseif (z <= -7.6e+27) tmp = t_2; elseif (z <= -1.05e-28) tmp = t_1; elseif (z <= 5.9e-13) tmp = 2.0 / (z * t); elseif (z <= 3.8e+221) 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[z, -6.5e+212], t$95$2, If[LessEqual[z, -2.4e+182], t$95$1, If[LessEqual[z, -7.6e+27], t$95$2, If[LessEqual[z, -1.05e-28], t$95$1, If[LessEqual[z, 5.9e-13], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e+221], 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}\;z \leq -6.5 \cdot 10^{+212}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -2.4 \cdot 10^{+182}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7.6 \cdot 10^{+27}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.9 \cdot 10^{-13}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+221}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.49999999999999997e212 or -2.4000000000000001e182 < z < -7.60000000000000043e27 or 5.9000000000000001e-13 < z < 3.80000000000000034e221Initial program 84.3%
Taylor expanded in z around inf 99.4%
div-sub99.5%
sub-neg99.5%
*-inverses99.5%
metadata-eval99.5%
distribute-lft-in99.5%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 73.3%
sub-neg73.3%
associate-*r/73.3%
metadata-eval73.3%
metadata-eval73.3%
Simplified73.3%
if -6.49999999999999997e212 < z < -2.4000000000000001e182 or -7.60000000000000043e27 < z < -1.05000000000000003e-28 or 3.80000000000000034e221 < z Initial program 63.7%
Taylor expanded in t around inf 83.7%
if -1.05000000000000003e-28 < z < 5.9000000000000001e-13Initial program 98.2%
+-commutative98.2%
remove-double-neg98.2%
distribute-frac-neg98.2%
unsub-neg98.2%
*-commutative98.2%
associate-*r*98.2%
distribute-rgt1-in98.2%
associate-/l*98.2%
fma-neg98.1%
*-commutative98.1%
fma-define98.1%
*-commutative98.1%
distribute-frac-neg98.1%
remove-double-neg98.1%
Simplified98.1%
Taylor expanded in t around inf 98.1%
associate--l+98.1%
+-commutative98.1%
sub-neg98.1%
metadata-eval98.1%
+-commutative98.1%
associate-*r/98.1%
distribute-lft-in98.1%
metadata-eval98.1%
associate-*r/98.1%
metadata-eval98.1%
Simplified98.1%
Taylor expanded in z around 0 68.4%
Final simplification72.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)) (t_2 (+ -2.0 (/ 2.0 t))))
(if (<= z -1.6e+212)
t_2
(if (<= z -2.4e+182)
t_1
(if (<= z -1.95e+24)
t_2
(if (<= z -1.3e-15)
t_1
(if (<= z 6.6e-13)
(+ -2.0 (/ (/ 2.0 z) t))
(if (<= z 1.95e+222) 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 (z <= -1.6e+212) {
tmp = t_2;
} else if (z <= -2.4e+182) {
tmp = t_1;
} else if (z <= -1.95e+24) {
tmp = t_2;
} else if (z <= -1.3e-15) {
tmp = t_1;
} else if (z <= 6.6e-13) {
tmp = -2.0 + ((2.0 / z) / t);
} else if (z <= 1.95e+222) {
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 (z <= (-1.6d+212)) then
tmp = t_2
else if (z <= (-2.4d+182)) then
tmp = t_1
else if (z <= (-1.95d+24)) then
tmp = t_2
else if (z <= (-1.3d-15)) then
tmp = t_1
else if (z <= 6.6d-13) then
tmp = (-2.0d0) + ((2.0d0 / z) / t)
else if (z <= 1.95d+222) 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 (z <= -1.6e+212) {
tmp = t_2;
} else if (z <= -2.4e+182) {
tmp = t_1;
} else if (z <= -1.95e+24) {
tmp = t_2;
} else if (z <= -1.3e-15) {
tmp = t_1;
} else if (z <= 6.6e-13) {
tmp = -2.0 + ((2.0 / z) / t);
} else if (z <= 1.95e+222) {
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 z <= -1.6e+212: tmp = t_2 elif z <= -2.4e+182: tmp = t_1 elif z <= -1.95e+24: tmp = t_2 elif z <= -1.3e-15: tmp = t_1 elif z <= 6.6e-13: tmp = -2.0 + ((2.0 / z) / t) elif z <= 1.95e+222: 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 (z <= -1.6e+212) tmp = t_2; elseif (z <= -2.4e+182) tmp = t_1; elseif (z <= -1.95e+24) tmp = t_2; elseif (z <= -1.3e-15) tmp = t_1; elseif (z <= 6.6e-13) tmp = Float64(-2.0 + Float64(Float64(2.0 / z) / t)); elseif (z <= 1.95e+222) 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 (z <= -1.6e+212) tmp = t_2; elseif (z <= -2.4e+182) tmp = t_1; elseif (z <= -1.95e+24) tmp = t_2; elseif (z <= -1.3e-15) tmp = t_1; elseif (z <= 6.6e-13) tmp = -2.0 + ((2.0 / z) / t); elseif (z <= 1.95e+222) 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[z, -1.6e+212], t$95$2, If[LessEqual[z, -2.4e+182], t$95$1, If[LessEqual[z, -1.95e+24], t$95$2, If[LessEqual[z, -1.3e-15], t$95$1, If[LessEqual[z, 6.6e-13], N[(-2.0 + N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.95e+222], 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}\;z \leq -1.6 \cdot 10^{+212}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -2.4 \cdot 10^{+182}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.95 \cdot 10^{+24}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-13}:\\
\;\;\;\;-2 + \frac{\frac{2}{z}}{t}\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{+222}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.5999999999999999e212 or -2.4000000000000001e182 < z < -1.9499999999999999e24 or 6.6000000000000001e-13 < z < 1.9499999999999999e222Initial program 84.3%
Taylor expanded in z around inf 99.4%
div-sub99.5%
sub-neg99.5%
*-inverses99.5%
metadata-eval99.5%
distribute-lft-in99.5%
associate-*r/99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around 0 73.3%
sub-neg73.3%
associate-*r/73.3%
metadata-eval73.3%
metadata-eval73.3%
Simplified73.3%
if -1.5999999999999999e212 < z < -2.4000000000000001e182 or -1.9499999999999999e24 < z < -1.30000000000000002e-15 or 1.9499999999999999e222 < z Initial program 62.7%
Taylor expanded in t around inf 83.3%
if -1.30000000000000002e-15 < z < 6.6000000000000001e-13Initial program 98.2%
+-commutative98.2%
remove-double-neg98.2%
distribute-frac-neg98.2%
unsub-neg98.2%
*-commutative98.2%
associate-*r*98.2%
distribute-rgt1-in98.2%
associate-/l*98.2%
fma-neg98.2%
*-commutative98.2%
fma-define98.2%
*-commutative98.2%
distribute-frac-neg98.2%
remove-double-neg98.2%
Simplified98.2%
Taylor expanded in t around inf 98.1%
associate--l+98.1%
+-commutative98.1%
sub-neg98.1%
metadata-eval98.1%
+-commutative98.1%
associate-*r/98.1%
distribute-lft-in98.1%
metadata-eval98.1%
associate-*r/98.1%
metadata-eval98.1%
Simplified98.1%
Taylor expanded in x around 0 77.9%
sub-neg77.9%
metadata-eval77.9%
+-commutative77.9%
associate-/r*77.9%
associate-*r/77.9%
associate-*l/77.9%
distribute-rgt-in77.9%
associate-*l/77.9%
*-lft-identity77.9%
Simplified77.9%
Taylor expanded in z around 0 77.9%
Final simplification76.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2.15e+22) (not (<= (/ x y) 5.2e+49))) (+ (/ 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.15e+22) || !((x / y) <= 5.2e+49)) {
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.15d+22)) .or. (.not. ((x / y) <= 5.2d+49))) 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.15e+22) || !((x / y) <= 5.2e+49)) {
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.15e+22) or not ((x / y) <= 5.2e+49): 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.15e+22) || !(Float64(x / y) <= 5.2e+49)) 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.15e+22) || ~(((x / y) <= 5.2e+49))) 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.15e+22], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5.2e+49]], $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.15 \cdot 10^{+22} \lor \neg \left(\frac{x}{y} \leq 5.2 \cdot 10^{+49}\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.1500000000000001e22 or 5.19999999999999977e49 < (/.f64 x y) Initial program 80.7%
Taylor expanded in t around 0 97.9%
Taylor expanded in z around inf 78.5%
associate-*r/78.5%
metadata-eval78.5%
Simplified78.5%
if -2.1500000000000001e22 < (/.f64 x y) < 5.19999999999999977e49Initial program 92.1%
+-commutative92.1%
remove-double-neg92.1%
distribute-frac-neg92.1%
unsub-neg92.1%
*-commutative92.1%
associate-*r*92.1%
distribute-rgt1-in92.1%
associate-/l*92.0%
fma-neg92.0%
*-commutative92.0%
fma-define92.0%
*-commutative92.0%
distribute-frac-neg92.0%
remove-double-neg92.0%
Simplified92.0%
Taylor expanded in t around inf 99.9%
associate--l+99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.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 x around 0 96.9%
sub-neg96.9%
metadata-eval96.9%
+-commutative96.9%
associate-/r*96.9%
associate-*r/96.9%
associate-*l/96.9%
distribute-rgt-in96.9%
associate-*l/96.9%
*-lft-identity96.9%
Simplified96.9%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -3.65e+22) (not (<= (/ x y) 3.6e+19))) (+ (/ 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) <= -3.65e+22) || !((x / y) <= 3.6e+19)) {
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) <= (-3.65d+22)) .or. (.not. ((x / y) <= 3.6d+19))) 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) <= -3.65e+22) || !((x / y) <= 3.6e+19)) {
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) <= -3.65e+22) or not ((x / y) <= 3.6e+19): 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) <= -3.65e+22) || !(Float64(x / y) <= 3.6e+19)) 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) <= -3.65e+22) || ~(((x / y) <= 3.6e+19))) 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], -3.65e+22], N[Not[LessEqual[N[(x / y), $MachinePrecision], 3.6e+19]], $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 -3.65 \cdot 10^{+22} \lor \neg \left(\frac{x}{y} \leq 3.6 \cdot 10^{+19}\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) < -3.6499999999999999e22 or 3.6e19 < (/.f64 x y) Initial program 82.0%
Taylor expanded in z around 0 91.5%
if -3.6499999999999999e22 < (/.f64 x y) < 3.6e19Initial program 91.8%
+-commutative91.8%
remove-double-neg91.8%
distribute-frac-neg91.8%
unsub-neg91.8%
*-commutative91.8%
associate-*r*91.8%
distribute-rgt1-in91.8%
associate-/l*91.7%
fma-neg91.6%
*-commutative91.6%
fma-define91.6%
*-commutative91.6%
distribute-frac-neg91.6%
remove-double-neg91.6%
Simplified91.6%
Taylor expanded in t around inf 99.9%
associate--l+99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.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 x around 0 98.1%
sub-neg98.1%
metadata-eval98.1%
+-commutative98.1%
associate-/r*98.1%
associate-*r/98.1%
associate-*l/98.1%
distribute-rgt-in98.1%
associate-*l/98.1%
*-lft-identity98.1%
Simplified98.1%
Final simplification95.4%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -2e+23)
(+ (/ x y) (/ 2.0 (* z t)))
(if (<= (/ x y) 2e+19)
(+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))
(+ (/ x y) (/ (/ 2.0 t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2e+23) {
tmp = (x / y) + (2.0 / (z * t));
} else if ((x / y) <= 2e+19) {
tmp = -2.0 + ((2.0 + (2.0 / z)) / 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 ((x / y) <= (-2d+23)) then
tmp = (x / y) + (2.0d0 / (z * t))
else if ((x / y) <= 2d+19) then
tmp = (-2.0d0) + ((2.0d0 + (2.0d0 / z)) / 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 ((x / y) <= -2e+23) {
tmp = (x / y) + (2.0 / (z * t));
} else if ((x / y) <= 2e+19) {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2e+23: tmp = (x / y) + (2.0 / (z * t)) elif (x / y) <= 2e+19: tmp = -2.0 + ((2.0 + (2.0 / z)) / t) else: tmp = (x / y) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2e+23) tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(z * t))); elseif (Float64(x / y) <= 2e+19) tmp = Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / 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 ((x / y) <= -2e+23) tmp = (x / y) + (2.0 / (z * t)); elseif ((x / y) <= 2e+19) tmp = -2.0 + ((2.0 + (2.0 / z)) / t); else tmp = (x / y) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2e+23], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e+19], N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+23}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+19}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.9999999999999998e23Initial program 88.2%
Taylor expanded in z around 0 89.0%
if -1.9999999999999998e23 < (/.f64 x y) < 2e19Initial program 91.8%
+-commutative91.8%
remove-double-neg91.8%
distribute-frac-neg91.8%
unsub-neg91.8%
*-commutative91.8%
associate-*r*91.8%
distribute-rgt1-in91.8%
associate-/l*91.7%
fma-neg91.6%
*-commutative91.6%
fma-define91.6%
*-commutative91.6%
distribute-frac-neg91.6%
remove-double-neg91.6%
Simplified91.6%
Taylor expanded in t around inf 99.9%
associate--l+99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.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 x around 0 98.1%
sub-neg98.1%
metadata-eval98.1%
+-commutative98.1%
associate-/r*98.1%
associate-*r/98.1%
associate-*l/98.1%
distribute-rgt-in98.1%
associate-*l/98.1%
*-lft-identity98.1%
Simplified98.1%
if 2e19 < (/.f64 x y) Initial program 76.2%
Taylor expanded in z around 0 93.7%
associate-/r*93.8%
Simplified93.8%
Final simplification95.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ x y) (/ 2.0 t))))
(if (<= z -3.5e-12)
t_1
(if (<= z 5.5e-42)
(+ -2.0 (/ (/ 2.0 z) t))
(if (<= z 3.95e+59) (- (/ x y) 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 (z <= -3.5e-12) {
tmp = t_1;
} else if (z <= 5.5e-42) {
tmp = -2.0 + ((2.0 / z) / t);
} else if (z <= 3.95e+59) {
tmp = (x / y) - 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 (z <= (-3.5d-12)) then
tmp = t_1
else if (z <= 5.5d-42) then
tmp = (-2.0d0) + ((2.0d0 / z) / t)
else if (z <= 3.95d+59) then
tmp = (x / y) - 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 (z <= -3.5e-12) {
tmp = t_1;
} else if (z <= 5.5e-42) {
tmp = -2.0 + ((2.0 / z) / t);
} else if (z <= 3.95e+59) {
tmp = (x / y) - 2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) + (2.0 / t) tmp = 0 if z <= -3.5e-12: tmp = t_1 elif z <= 5.5e-42: tmp = -2.0 + ((2.0 / z) / t) elif z <= 3.95e+59: tmp = (x / y) - 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 (z <= -3.5e-12) tmp = t_1; elseif (z <= 5.5e-42) tmp = Float64(-2.0 + Float64(Float64(2.0 / z) / t)); elseif (z <= 3.95e+59) tmp = Float64(Float64(x / y) - 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 (z <= -3.5e-12) tmp = t_1; elseif (z <= 5.5e-42) tmp = -2.0 + ((2.0 / z) / t); elseif (z <= 3.95e+59) tmp = (x / y) - 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[z, -3.5e-12], t$95$1, If[LessEqual[z, 5.5e-42], N[(-2.0 + N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.95e+59], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + \frac{2}{t}\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-42}:\\
\;\;\;\;-2 + \frac{\frac{2}{z}}{t}\\
\mathbf{elif}\;z \leq 3.95 \cdot 10^{+59}:\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.5e-12 or 3.95e59 < z Initial program 76.2%
Taylor expanded in t around 0 76.5%
Taylor expanded in z around inf 76.4%
associate-*r/76.4%
metadata-eval76.4%
Simplified76.4%
if -3.5e-12 < z < 5.5e-42Initial program 98.1%
+-commutative98.1%
remove-double-neg98.1%
distribute-frac-neg98.1%
unsub-neg98.1%
*-commutative98.1%
associate-*r*98.1%
distribute-rgt1-in98.1%
associate-/l*98.1%
fma-neg98.1%
*-commutative98.1%
fma-define98.1%
*-commutative98.1%
distribute-frac-neg98.1%
remove-double-neg98.1%
Simplified98.1%
Taylor expanded in t around inf 98.1%
associate--l+98.1%
+-commutative98.1%
sub-neg98.1%
metadata-eval98.1%
+-commutative98.1%
associate-*r/98.1%
distribute-lft-in98.1%
metadata-eval98.1%
associate-*r/98.1%
metadata-eval98.1%
Simplified98.1%
Taylor expanded in x around 0 78.9%
sub-neg78.9%
metadata-eval78.9%
+-commutative78.9%
associate-/r*78.9%
associate-*r/78.9%
associate-*l/78.9%
distribute-rgt-in78.9%
associate-*l/78.9%
*-lft-identity78.9%
Simplified78.9%
Taylor expanded in z around 0 78.9%
if 5.5e-42 < z < 3.95e59Initial program 100.0%
Taylor expanded in t around inf 76.0%
Final simplification77.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -4e+21) (not (<= (/ x y) 7.8e+27))) (/ x y) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4e+21) || !((x / y) <= 7.8e+27)) {
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) <= (-4d+21)) .or. (.not. ((x / y) <= 7.8d+27))) 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) <= -4e+21) || !((x / y) <= 7.8e+27)) {
tmp = x / y;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -4e+21) or not ((x / y) <= 7.8e+27): 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) <= -4e+21) || !(Float64(x / y) <= 7.8e+27)) 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) <= -4e+21) || ~(((x / y) <= 7.8e+27))) 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], -4e+21], N[Not[LessEqual[N[(x / y), $MachinePrecision], 7.8e+27]], $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 -4 \cdot 10^{+21} \lor \neg \left(\frac{x}{y} \leq 7.8 \cdot 10^{+27}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -4e21 or 7.7999999999999997e27 < (/.f64 x y) Initial program 81.6%
Taylor expanded in x around inf 70.1%
if -4e21 < (/.f64 x y) < 7.7999999999999997e27Initial program 91.9%
Taylor expanded in z around inf 64.5%
div-sub64.5%
sub-neg64.5%
*-inverses64.5%
metadata-eval64.5%
distribute-lft-in64.5%
associate-*r/64.5%
metadata-eval64.5%
metadata-eval64.5%
Simplified64.5%
Taylor expanded in x around 0 62.7%
sub-neg62.7%
associate-*r/62.7%
metadata-eval62.7%
metadata-eval62.7%
Simplified62.7%
Final simplification65.7%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5.7e+21) (/ x y) (if (<= (/ x y) 1.7e+26) (+ -2.0 (/ 2.0 t)) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5.7e+21) {
tmp = x / y;
} else if ((x / y) <= 1.7e+26) {
tmp = -2.0 + (2.0 / t);
} 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) <= (-5.7d+21)) then
tmp = x / y
else if ((x / y) <= 1.7d+26) then
tmp = (-2.0d0) + (2.0d0 / t)
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) <= -5.7e+21) {
tmp = x / y;
} else if ((x / y) <= 1.7e+26) {
tmp = -2.0 + (2.0 / t);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5.7e+21: tmp = x / y elif (x / y) <= 1.7e+26: tmp = -2.0 + (2.0 / t) else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5.7e+21) tmp = Float64(x / y); elseif (Float64(x / y) <= 1.7e+26) tmp = Float64(-2.0 + Float64(2.0 / t)); 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) <= -5.7e+21) tmp = x / y; elseif ((x / y) <= 1.7e+26) tmp = -2.0 + (2.0 / t); else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5.7e+21], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.7e+26], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5.7 \cdot 10^{+21}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 1.7 \cdot 10^{+26}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -5.7e21Initial program 88.2%
Taylor expanded in x around inf 71.8%
if -5.7e21 < (/.f64 x y) < 1.7000000000000001e26Initial program 91.9%
Taylor expanded in z around inf 64.5%
div-sub64.5%
sub-neg64.5%
*-inverses64.5%
metadata-eval64.5%
distribute-lft-in64.5%
associate-*r/64.5%
metadata-eval64.5%
metadata-eval64.5%
Simplified64.5%
Taylor expanded in x around 0 62.7%
sub-neg62.7%
associate-*r/62.7%
metadata-eval62.7%
metadata-eval62.7%
Simplified62.7%
if 1.7000000000000001e26 < (/.f64 x y) Initial program 75.3%
Taylor expanded in t around inf 68.5%
Final simplification65.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.2e-27) (not (<= t 9.0))) (- (/ 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.2e-27) || !(t <= 9.0)) {
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.2d-27)) .or. (.not. (t <= 9.0d0))) 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.2e-27) || !(t <= 9.0)) {
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.2e-27) or not (t <= 9.0): 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.2e-27) || !(t <= 9.0)) 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.2e-27) || ~((t <= 9.0))) 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.2e-27], N[Not[LessEqual[t, 9.0]], $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.2 \cdot 10^{-27} \lor \neg \left(t \leq 9\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -7.1999999999999997e-27 or 9 < t Initial program 75.6%
Taylor expanded in t around inf 83.0%
if -7.1999999999999997e-27 < t < 9Initial program 98.3%
Taylor expanded in t around 0 83.0%
associate-*r/83.0%
metadata-eval83.0%
Simplified83.0%
Final simplification83.0%
(FPCore (x y z t) :precision binary64 (if (<= t -7500000.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 <= -7500000.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 <= (-7500000.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 <= -7500000.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 <= -7500000.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 <= -7500000.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 <= -7500000.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, -7500000.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 -7500000:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 1:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -7.5e6 or 1 < t Initial program 73.6%
+-commutative73.6%
remove-double-neg73.6%
distribute-frac-neg73.6%
unsub-neg73.6%
*-commutative73.6%
associate-*r*73.6%
distribute-rgt1-in73.6%
associate-/l*73.6%
fma-neg73.5%
*-commutative73.5%
fma-define73.5%
*-commutative73.5%
distribute-frac-neg73.5%
remove-double-neg73.5%
Simplified73.5%
Taylor expanded in t around inf 100.0%
associate--l+100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.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 x around 0 57.0%
sub-neg57.0%
metadata-eval57.0%
+-commutative57.0%
associate-/r*57.0%
associate-*r/57.0%
associate-*l/57.0%
distribute-rgt-in57.0%
associate-*l/57.0%
*-lft-identity57.0%
Simplified57.0%
Taylor expanded in z around 0 55.7%
Taylor expanded in z around inf 42.5%
if -7.5e6 < t < 1Initial program 98.4%
Taylor expanded in t around 0 79.9%
associate-*r/79.9%
metadata-eval79.9%
Simplified79.9%
Taylor expanded in z around inf 36.5%
Final simplification39.1%
(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 87.7%
+-commutative87.7%
remove-double-neg87.7%
distribute-frac-neg87.7%
unsub-neg87.7%
*-commutative87.7%
associate-*r*87.7%
distribute-rgt1-in87.7%
associate-/l*87.6%
fma-neg87.6%
*-commutative87.6%
fma-define87.6%
*-commutative87.6%
distribute-frac-neg87.6%
remove-double-neg87.6%
Simplified87.6%
Taylor expanded in t around inf 99.1%
associate--l+99.1%
+-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
associate-*r/99.1%
distribute-lft-in99.1%
metadata-eval99.1%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
Taylor expanded in x around 0 71.0%
sub-neg71.0%
metadata-eval71.0%
+-commutative71.0%
associate-/r*71.0%
associate-*r/71.0%
associate-*l/71.0%
distribute-rgt-in71.0%
associate-*l/71.0%
*-lft-identity71.0%
Simplified71.0%
Taylor expanded in z around 0 50.1%
Taylor expanded in z around inf 19.7%
Final simplification19.7%
(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 2024066
(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))))