
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}
NOTE: x should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (hypot y (hypot x z))))
(if (<= x 4.5e+185)
(+ (* 0.5 (- y (/ z (/ y z)))) (* 0.5 (* x (/ x y))))
(* t_0 (* t_0 (/ 0.5 y))))))x = abs(x);
double code(double x, double y, double z) {
double t_0 = hypot(y, hypot(x, z));
double tmp;
if (x <= 4.5e+185) {
tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
} else {
tmp = t_0 * (t_0 * (0.5 / y));
}
return tmp;
}
x = Math.abs(x);
public static double code(double x, double y, double z) {
double t_0 = Math.hypot(y, Math.hypot(x, z));
double tmp;
if (x <= 4.5e+185) {
tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
} else {
tmp = t_0 * (t_0 * (0.5 / y));
}
return tmp;
}
x = abs(x) def code(x, y, z): t_0 = math.hypot(y, math.hypot(x, z)) tmp = 0 if x <= 4.5e+185: tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y))) else: tmp = t_0 * (t_0 * (0.5 / y)) return tmp
x = abs(x) function code(x, y, z) t_0 = hypot(y, hypot(x, z)) tmp = 0.0 if (x <= 4.5e+185) tmp = Float64(Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))) + Float64(0.5 * Float64(x * Float64(x / y)))); else tmp = Float64(t_0 * Float64(t_0 * Float64(0.5 / y))); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) t_0 = hypot(y, hypot(x, z)); tmp = 0.0; if (x <= 4.5e+185) tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y))); else tmp = t_0 * (t_0 * (0.5 / y)); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[y ^ 2 + N[Sqrt[x ^ 2 + z ^ 2], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[x, 4.5e+185], N[(N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$0 * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)\\
\mathbf{if}\;x \leq 4.5 \cdot 10^{+185}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(t_0 \cdot \frac{0.5}{y}\right)\\
\end{array}
\end{array}
if x < 4.5000000000000002e185Initial program 65.4%
Taylor expanded in x around inf 81.3%
unpow281.3%
*-un-lft-identity81.3%
times-frac89.1%
Applied egg-rr89.1%
unpow289.1%
*-un-lft-identity89.1%
times-frac94.0%
Applied egg-rr94.0%
/-rgt-identity94.0%
associate-*r/89.1%
associate-/l*94.0%
Applied egg-rr94.0%
if 4.5000000000000002e185 < x Initial program 80.0%
div-inv80.0%
add-sqr-sqrt80.0%
associate-*l*80.0%
Applied egg-rr99.9%
Final simplification94.4%
NOTE: x should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (hypot y (hypot x z))))
(if (<= x 2.2e+158)
(+ (* 0.5 (- y (/ z (/ y z)))) (* 0.5 (* x (/ x y))))
(* (/ t_0 y) (/ t_0 2.0)))))x = abs(x);
double code(double x, double y, double z) {
double t_0 = hypot(y, hypot(x, z));
double tmp;
if (x <= 2.2e+158) {
tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
} else {
tmp = (t_0 / y) * (t_0 / 2.0);
}
return tmp;
}
x = Math.abs(x);
public static double code(double x, double y, double z) {
double t_0 = Math.hypot(y, Math.hypot(x, z));
double tmp;
if (x <= 2.2e+158) {
tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
} else {
tmp = (t_0 / y) * (t_0 / 2.0);
}
return tmp;
}
x = abs(x) def code(x, y, z): t_0 = math.hypot(y, math.hypot(x, z)) tmp = 0 if x <= 2.2e+158: tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y))) else: tmp = (t_0 / y) * (t_0 / 2.0) return tmp
x = abs(x) function code(x, y, z) t_0 = hypot(y, hypot(x, z)) tmp = 0.0 if (x <= 2.2e+158) tmp = Float64(Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))) + Float64(0.5 * Float64(x * Float64(x / y)))); else tmp = Float64(Float64(t_0 / y) * Float64(t_0 / 2.0)); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) t_0 = hypot(y, hypot(x, z)); tmp = 0.0; if (x <= 2.2e+158) tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y))); else tmp = (t_0 / y) * (t_0 / 2.0); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[y ^ 2 + N[Sqrt[x ^ 2 + z ^ 2], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[x, 2.2e+158], N[(N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / y), $MachinePrecision] * N[(t$95$0 / 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)\\
\mathbf{if}\;x \leq 2.2 \cdot 10^{+158}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{y} \cdot \frac{t_0}{2}\\
\end{array}
\end{array}
if x < 2.2000000000000001e158Initial program 66.0%
Taylor expanded in x around inf 82.2%
unpow282.2%
*-un-lft-identity82.2%
times-frac89.7%
Applied egg-rr89.7%
unpow289.7%
*-un-lft-identity89.7%
times-frac94.7%
Applied egg-rr94.7%
/-rgt-identity94.7%
associate-*r/89.7%
associate-/l*94.7%
Applied egg-rr94.7%
if 2.2000000000000001e158 < x Initial program 72.0%
add-sqr-sqrt72.0%
times-frac72.0%
Applied egg-rr91.5%
Final simplification94.4%
NOTE: x should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* x (/ 0.5 y)))))
(if (<= (* z z) 2e-280)
(* 0.5 y)
(if (<= (* z z) 1e+38)
t_0
(if (<= (* z z) 1e+60)
(* 0.5 y)
(if (<= (* z z) 5e+115)
(/ (* x (* x 0.5)) y)
(if (<= (* z z) 1e+180)
(* 0.5 y)
(if (<= (* z z) 2e+190) t_0 (* -0.5 (* z (* z (/ 1.0 y))))))))))))x = abs(x);
double code(double x, double y, double z) {
double t_0 = x * (x * (0.5 / y));
double tmp;
if ((z * z) <= 2e-280) {
tmp = 0.5 * y;
} else if ((z * z) <= 1e+38) {
tmp = t_0;
} else if ((z * z) <= 1e+60) {
tmp = 0.5 * y;
} else if ((z * z) <= 5e+115) {
tmp = (x * (x * 0.5)) / y;
} else if ((z * z) <= 1e+180) {
tmp = 0.5 * y;
} else if ((z * z) <= 2e+190) {
tmp = t_0;
} else {
tmp = -0.5 * (z * (z * (1.0 / y)));
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x * (x * (0.5d0 / y))
if ((z * z) <= 2d-280) then
tmp = 0.5d0 * y
else if ((z * z) <= 1d+38) then
tmp = t_0
else if ((z * z) <= 1d+60) then
tmp = 0.5d0 * y
else if ((z * z) <= 5d+115) then
tmp = (x * (x * 0.5d0)) / y
else if ((z * z) <= 1d+180) then
tmp = 0.5d0 * y
else if ((z * z) <= 2d+190) then
tmp = t_0
else
tmp = (-0.5d0) * (z * (z * (1.0d0 / y)))
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double t_0 = x * (x * (0.5 / y));
double tmp;
if ((z * z) <= 2e-280) {
tmp = 0.5 * y;
} else if ((z * z) <= 1e+38) {
tmp = t_0;
} else if ((z * z) <= 1e+60) {
tmp = 0.5 * y;
} else if ((z * z) <= 5e+115) {
tmp = (x * (x * 0.5)) / y;
} else if ((z * z) <= 1e+180) {
tmp = 0.5 * y;
} else if ((z * z) <= 2e+190) {
tmp = t_0;
} else {
tmp = -0.5 * (z * (z * (1.0 / y)));
}
return tmp;
}
x = abs(x) def code(x, y, z): t_0 = x * (x * (0.5 / y)) tmp = 0 if (z * z) <= 2e-280: tmp = 0.5 * y elif (z * z) <= 1e+38: tmp = t_0 elif (z * z) <= 1e+60: tmp = 0.5 * y elif (z * z) <= 5e+115: tmp = (x * (x * 0.5)) / y elif (z * z) <= 1e+180: tmp = 0.5 * y elif (z * z) <= 2e+190: tmp = t_0 else: tmp = -0.5 * (z * (z * (1.0 / y))) return tmp
x = abs(x) function code(x, y, z) t_0 = Float64(x * Float64(x * Float64(0.5 / y))) tmp = 0.0 if (Float64(z * z) <= 2e-280) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 1e+38) tmp = t_0; elseif (Float64(z * z) <= 1e+60) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 5e+115) tmp = Float64(Float64(x * Float64(x * 0.5)) / y); elseif (Float64(z * z) <= 1e+180) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 2e+190) tmp = t_0; else tmp = Float64(-0.5 * Float64(z * Float64(z * Float64(1.0 / y)))); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) t_0 = x * (x * (0.5 / y)); tmp = 0.0; if ((z * z) <= 2e-280) tmp = 0.5 * y; elseif ((z * z) <= 1e+38) tmp = t_0; elseif ((z * z) <= 1e+60) tmp = 0.5 * y; elseif ((z * z) <= 5e+115) tmp = (x * (x * 0.5)) / y; elseif ((z * z) <= 1e+180) tmp = 0.5 * y; elseif ((z * z) <= 2e+190) tmp = t_0; else tmp = -0.5 * (z * (z * (1.0 / y))); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 2e-280], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+38], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 1e+60], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+115], N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+180], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+190], t$95$0, N[(-0.5 * N[(z * N[(z * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-280}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 10^{+38}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \cdot z \leq 10^{+60}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\
\mathbf{elif}\;z \cdot z \leq 10^{+180}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+190}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \left(z \cdot \frac{1}{y}\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999999e-280 or 9.99999999999999977e37 < (*.f64 z z) < 9.9999999999999995e59 or 5.00000000000000008e115 < (*.f64 z z) < 1e180Initial program 59.3%
Taylor expanded in y around inf 60.3%
if 1.9999999999999999e-280 < (*.f64 z z) < 9.99999999999999977e37 or 1e180 < (*.f64 z z) < 2.0000000000000001e190Initial program 78.2%
Taylor expanded in x around inf 53.2%
associate-*r/53.2%
associate-/l*53.2%
Simplified53.2%
associate-/r/53.2%
unpow253.2%
associate-*r*59.6%
Applied egg-rr59.6%
if 9.9999999999999995e59 < (*.f64 z z) < 5.00000000000000008e115Initial program 87.4%
Taylor expanded in x around inf 54.9%
associate-*r/54.9%
associate-/l*54.9%
Simplified54.9%
associate-/r/54.8%
unpow254.8%
associate-*r*54.7%
Applied egg-rr54.7%
*-commutative54.7%
associate-*l/54.7%
associate-*r/54.9%
Applied egg-rr54.9%
if 2.0000000000000001e190 < (*.f64 z z) Initial program 60.2%
Taylor expanded in z around inf 71.9%
*-commutative71.9%
Simplified71.9%
div-inv71.9%
unpow271.9%
associate-*l*77.9%
Applied egg-rr77.9%
Final simplification65.1%
NOTE: x should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* x (/ 0.5 y)))))
(if (<= (* z z) 3e-280)
(* 0.5 y)
(if (<= (* z z) 4.5e+39)
t_0
(if (<= (* z z) 7.8e+59)
(* 0.5 y)
(if (<= (* z z) 9.5e+121)
t_0
(if (<= (* z z) 6e+179)
(* 0.5 y)
(if (<= (* z z) 1.85e+197) t_0 (* -0.5 (/ (* z z) y))))))))))x = abs(x);
double code(double x, double y, double z) {
double t_0 = x * (x * (0.5 / y));
double tmp;
if ((z * z) <= 3e-280) {
tmp = 0.5 * y;
} else if ((z * z) <= 4.5e+39) {
tmp = t_0;
} else if ((z * z) <= 7.8e+59) {
tmp = 0.5 * y;
} else if ((z * z) <= 9.5e+121) {
tmp = t_0;
} else if ((z * z) <= 6e+179) {
tmp = 0.5 * y;
} else if ((z * z) <= 1.85e+197) {
tmp = t_0;
} else {
tmp = -0.5 * ((z * z) / y);
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x * (x * (0.5d0 / y))
if ((z * z) <= 3d-280) then
tmp = 0.5d0 * y
else if ((z * z) <= 4.5d+39) then
tmp = t_0
else if ((z * z) <= 7.8d+59) then
tmp = 0.5d0 * y
else if ((z * z) <= 9.5d+121) then
tmp = t_0
else if ((z * z) <= 6d+179) then
tmp = 0.5d0 * y
else if ((z * z) <= 1.85d+197) then
tmp = t_0
else
tmp = (-0.5d0) * ((z * z) / y)
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double t_0 = x * (x * (0.5 / y));
double tmp;
if ((z * z) <= 3e-280) {
tmp = 0.5 * y;
} else if ((z * z) <= 4.5e+39) {
tmp = t_0;
} else if ((z * z) <= 7.8e+59) {
tmp = 0.5 * y;
} else if ((z * z) <= 9.5e+121) {
tmp = t_0;
} else if ((z * z) <= 6e+179) {
tmp = 0.5 * y;
} else if ((z * z) <= 1.85e+197) {
tmp = t_0;
} else {
tmp = -0.5 * ((z * z) / y);
}
return tmp;
}
x = abs(x) def code(x, y, z): t_0 = x * (x * (0.5 / y)) tmp = 0 if (z * z) <= 3e-280: tmp = 0.5 * y elif (z * z) <= 4.5e+39: tmp = t_0 elif (z * z) <= 7.8e+59: tmp = 0.5 * y elif (z * z) <= 9.5e+121: tmp = t_0 elif (z * z) <= 6e+179: tmp = 0.5 * y elif (z * z) <= 1.85e+197: tmp = t_0 else: tmp = -0.5 * ((z * z) / y) return tmp
x = abs(x) function code(x, y, z) t_0 = Float64(x * Float64(x * Float64(0.5 / y))) tmp = 0.0 if (Float64(z * z) <= 3e-280) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 4.5e+39) tmp = t_0; elseif (Float64(z * z) <= 7.8e+59) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 9.5e+121) tmp = t_0; elseif (Float64(z * z) <= 6e+179) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 1.85e+197) tmp = t_0; else tmp = Float64(-0.5 * Float64(Float64(z * z) / y)); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) t_0 = x * (x * (0.5 / y)); tmp = 0.0; if ((z * z) <= 3e-280) tmp = 0.5 * y; elseif ((z * z) <= 4.5e+39) tmp = t_0; elseif ((z * z) <= 7.8e+59) tmp = 0.5 * y; elseif ((z * z) <= 9.5e+121) tmp = t_0; elseif ((z * z) <= 6e+179) tmp = 0.5 * y; elseif ((z * z) <= 1.85e+197) tmp = t_0; else tmp = -0.5 * ((z * z) / y); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 3e-280], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 4.5e+39], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 7.8e+59], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 9.5e+121], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 6e+179], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1.85e+197], t$95$0, N[(-0.5 * N[(N[(z * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{if}\;z \cdot z \leq 3 \cdot 10^{-280}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 4.5 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \cdot z \leq 7.8 \cdot 10^{+59}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 9.5 \cdot 10^{+121}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \cdot z \leq 6 \cdot 10^{+179}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 1.85 \cdot 10^{+197}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z \cdot z}{y}\\
\end{array}
\end{array}
if (*.f64 z z) < 2.99999999999999987e-280 or 4.49999999999999996e39 < (*.f64 z z) < 7.80000000000000043e59 or 9.49999999999999949e121 < (*.f64 z z) < 5.9999999999999996e179Initial program 59.3%
Taylor expanded in y around inf 60.3%
if 2.99999999999999987e-280 < (*.f64 z z) < 4.49999999999999996e39 or 7.80000000000000043e59 < (*.f64 z z) < 9.49999999999999949e121 or 5.9999999999999996e179 < (*.f64 z z) < 1.8500000000000002e197Initial program 79.8%
Taylor expanded in x around inf 53.5%
associate-*r/53.5%
associate-/l*53.5%
Simplified53.5%
associate-/r/53.5%
unpow253.5%
associate-*r*58.8%
Applied egg-rr58.8%
if 1.8500000000000002e197 < (*.f64 z z) Initial program 60.2%
Taylor expanded in z around inf 71.9%
*-commutative71.9%
Simplified71.9%
unpow271.9%
Applied egg-rr71.9%
Final simplification63.3%
NOTE: x should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* x (/ 0.5 y)))))
(if (<= (* z z) 2.2e-280)
(* 0.5 y)
(if (<= (* z z) 1.32e+38)
t_0
(if (<= (* z z) 1e+60)
(* 0.5 y)
(if (<= (* z z) 7.8e+116)
(/ (* x (* x 0.5)) y)
(if (<= (* z z) 1e+180)
(* 0.5 y)
(if (<= (* z z) 9.8e+191) t_0 (* -0.5 (/ (* z z) y))))))))))x = abs(x);
double code(double x, double y, double z) {
double t_0 = x * (x * (0.5 / y));
double tmp;
if ((z * z) <= 2.2e-280) {
tmp = 0.5 * y;
} else if ((z * z) <= 1.32e+38) {
tmp = t_0;
} else if ((z * z) <= 1e+60) {
tmp = 0.5 * y;
} else if ((z * z) <= 7.8e+116) {
tmp = (x * (x * 0.5)) / y;
} else if ((z * z) <= 1e+180) {
tmp = 0.5 * y;
} else if ((z * z) <= 9.8e+191) {
tmp = t_0;
} else {
tmp = -0.5 * ((z * z) / y);
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x * (x * (0.5d0 / y))
if ((z * z) <= 2.2d-280) then
tmp = 0.5d0 * y
else if ((z * z) <= 1.32d+38) then
tmp = t_0
else if ((z * z) <= 1d+60) then
tmp = 0.5d0 * y
else if ((z * z) <= 7.8d+116) then
tmp = (x * (x * 0.5d0)) / y
else if ((z * z) <= 1d+180) then
tmp = 0.5d0 * y
else if ((z * z) <= 9.8d+191) then
tmp = t_0
else
tmp = (-0.5d0) * ((z * z) / y)
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double t_0 = x * (x * (0.5 / y));
double tmp;
if ((z * z) <= 2.2e-280) {
tmp = 0.5 * y;
} else if ((z * z) <= 1.32e+38) {
tmp = t_0;
} else if ((z * z) <= 1e+60) {
tmp = 0.5 * y;
} else if ((z * z) <= 7.8e+116) {
tmp = (x * (x * 0.5)) / y;
} else if ((z * z) <= 1e+180) {
tmp = 0.5 * y;
} else if ((z * z) <= 9.8e+191) {
tmp = t_0;
} else {
tmp = -0.5 * ((z * z) / y);
}
return tmp;
}
x = abs(x) def code(x, y, z): t_0 = x * (x * (0.5 / y)) tmp = 0 if (z * z) <= 2.2e-280: tmp = 0.5 * y elif (z * z) <= 1.32e+38: tmp = t_0 elif (z * z) <= 1e+60: tmp = 0.5 * y elif (z * z) <= 7.8e+116: tmp = (x * (x * 0.5)) / y elif (z * z) <= 1e+180: tmp = 0.5 * y elif (z * z) <= 9.8e+191: tmp = t_0 else: tmp = -0.5 * ((z * z) / y) return tmp
x = abs(x) function code(x, y, z) t_0 = Float64(x * Float64(x * Float64(0.5 / y))) tmp = 0.0 if (Float64(z * z) <= 2.2e-280) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 1.32e+38) tmp = t_0; elseif (Float64(z * z) <= 1e+60) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 7.8e+116) tmp = Float64(Float64(x * Float64(x * 0.5)) / y); elseif (Float64(z * z) <= 1e+180) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 9.8e+191) tmp = t_0; else tmp = Float64(-0.5 * Float64(Float64(z * z) / y)); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) t_0 = x * (x * (0.5 / y)); tmp = 0.0; if ((z * z) <= 2.2e-280) tmp = 0.5 * y; elseif ((z * z) <= 1.32e+38) tmp = t_0; elseif ((z * z) <= 1e+60) tmp = 0.5 * y; elseif ((z * z) <= 7.8e+116) tmp = (x * (x * 0.5)) / y; elseif ((z * z) <= 1e+180) tmp = 0.5 * y; elseif ((z * z) <= 9.8e+191) tmp = t_0; else tmp = -0.5 * ((z * z) / y); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 2.2e-280], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1.32e+38], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 1e+60], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 7.8e+116], N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+180], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 9.8e+191], t$95$0, N[(-0.5 * N[(N[(z * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{if}\;z \cdot z \leq 2.2 \cdot 10^{-280}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 1.32 \cdot 10^{+38}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \cdot z \leq 10^{+60}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 7.8 \cdot 10^{+116}:\\
\;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\
\mathbf{elif}\;z \cdot z \leq 10^{+180}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 9.8 \cdot 10^{+191}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z \cdot z}{y}\\
\end{array}
\end{array}
if (*.f64 z z) < 2.2000000000000001e-280 or 1.32e38 < (*.f64 z z) < 9.9999999999999995e59 or 7.80000000000000065e116 < (*.f64 z z) < 1e180Initial program 59.3%
Taylor expanded in y around inf 60.3%
if 2.2000000000000001e-280 < (*.f64 z z) < 1.32e38 or 1e180 < (*.f64 z z) < 9.7999999999999999e191Initial program 78.2%
Taylor expanded in x around inf 53.2%
associate-*r/53.2%
associate-/l*53.2%
Simplified53.2%
associate-/r/53.2%
unpow253.2%
associate-*r*59.6%
Applied egg-rr59.6%
if 9.9999999999999995e59 < (*.f64 z z) < 7.80000000000000065e116Initial program 87.4%
Taylor expanded in x around inf 54.9%
associate-*r/54.9%
associate-/l*54.9%
Simplified54.9%
associate-/r/54.8%
unpow254.8%
associate-*r*54.7%
Applied egg-rr54.7%
*-commutative54.7%
associate-*l/54.7%
associate-*r/54.9%
Applied egg-rr54.9%
if 9.7999999999999999e191 < (*.f64 z z) Initial program 60.2%
Taylor expanded in z around inf 71.9%
*-commutative71.9%
Simplified71.9%
unpow271.9%
Applied egg-rr71.9%
Final simplification63.3%
NOTE: x should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* x (/ 0.5 y)))))
(if (<= (* z z) 2e-280)
(* 0.5 y)
(if (<= (* z z) 1e+38)
t_0
(if (<= (* z z) 1e+60)
(* 0.5 y)
(if (<= (* z z) 5e+115)
(/ (* x (* x 0.5)) y)
(if (<= (* z z) 1e+180)
(* 0.5 y)
(if (<= (* z z) 2e+190) t_0 (* (* z (/ z y)) -0.5)))))))))x = abs(x);
double code(double x, double y, double z) {
double t_0 = x * (x * (0.5 / y));
double tmp;
if ((z * z) <= 2e-280) {
tmp = 0.5 * y;
} else if ((z * z) <= 1e+38) {
tmp = t_0;
} else if ((z * z) <= 1e+60) {
tmp = 0.5 * y;
} else if ((z * z) <= 5e+115) {
tmp = (x * (x * 0.5)) / y;
} else if ((z * z) <= 1e+180) {
tmp = 0.5 * y;
} else if ((z * z) <= 2e+190) {
tmp = t_0;
} else {
tmp = (z * (z / y)) * -0.5;
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x * (x * (0.5d0 / y))
if ((z * z) <= 2d-280) then
tmp = 0.5d0 * y
else if ((z * z) <= 1d+38) then
tmp = t_0
else if ((z * z) <= 1d+60) then
tmp = 0.5d0 * y
else if ((z * z) <= 5d+115) then
tmp = (x * (x * 0.5d0)) / y
else if ((z * z) <= 1d+180) then
tmp = 0.5d0 * y
else if ((z * z) <= 2d+190) then
tmp = t_0
else
tmp = (z * (z / y)) * (-0.5d0)
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double t_0 = x * (x * (0.5 / y));
double tmp;
if ((z * z) <= 2e-280) {
tmp = 0.5 * y;
} else if ((z * z) <= 1e+38) {
tmp = t_0;
} else if ((z * z) <= 1e+60) {
tmp = 0.5 * y;
} else if ((z * z) <= 5e+115) {
tmp = (x * (x * 0.5)) / y;
} else if ((z * z) <= 1e+180) {
tmp = 0.5 * y;
} else if ((z * z) <= 2e+190) {
tmp = t_0;
} else {
tmp = (z * (z / y)) * -0.5;
}
return tmp;
}
x = abs(x) def code(x, y, z): t_0 = x * (x * (0.5 / y)) tmp = 0 if (z * z) <= 2e-280: tmp = 0.5 * y elif (z * z) <= 1e+38: tmp = t_0 elif (z * z) <= 1e+60: tmp = 0.5 * y elif (z * z) <= 5e+115: tmp = (x * (x * 0.5)) / y elif (z * z) <= 1e+180: tmp = 0.5 * y elif (z * z) <= 2e+190: tmp = t_0 else: tmp = (z * (z / y)) * -0.5 return tmp
x = abs(x) function code(x, y, z) t_0 = Float64(x * Float64(x * Float64(0.5 / y))) tmp = 0.0 if (Float64(z * z) <= 2e-280) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 1e+38) tmp = t_0; elseif (Float64(z * z) <= 1e+60) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 5e+115) tmp = Float64(Float64(x * Float64(x * 0.5)) / y); elseif (Float64(z * z) <= 1e+180) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 2e+190) tmp = t_0; else tmp = Float64(Float64(z * Float64(z / y)) * -0.5); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) t_0 = x * (x * (0.5 / y)); tmp = 0.0; if ((z * z) <= 2e-280) tmp = 0.5 * y; elseif ((z * z) <= 1e+38) tmp = t_0; elseif ((z * z) <= 1e+60) tmp = 0.5 * y; elseif ((z * z) <= 5e+115) tmp = (x * (x * 0.5)) / y; elseif ((z * z) <= 1e+180) tmp = 0.5 * y; elseif ((z * z) <= 2e+190) tmp = t_0; else tmp = (z * (z / y)) * -0.5; end tmp_2 = tmp; end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 2e-280], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+38], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 1e+60], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+115], N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+180], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+190], t$95$0, N[(N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]]]]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-280}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 10^{+38}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \cdot z \leq 10^{+60}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\frac{x \cdot \left(x \cdot 0.5\right)}{y}\\
\mathbf{elif}\;z \cdot z \leq 10^{+180}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+190}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot \frac{z}{y}\right) \cdot -0.5\\
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999999e-280 or 9.99999999999999977e37 < (*.f64 z z) < 9.9999999999999995e59 or 5.00000000000000008e115 < (*.f64 z z) < 1e180Initial program 59.3%
Taylor expanded in y around inf 60.3%
if 1.9999999999999999e-280 < (*.f64 z z) < 9.99999999999999977e37 or 1e180 < (*.f64 z z) < 2.0000000000000001e190Initial program 78.2%
Taylor expanded in x around inf 53.2%
associate-*r/53.2%
associate-/l*53.2%
Simplified53.2%
associate-/r/53.2%
unpow253.2%
associate-*r*59.6%
Applied egg-rr59.6%
if 9.9999999999999995e59 < (*.f64 z z) < 5.00000000000000008e115Initial program 87.4%
Taylor expanded in x around inf 54.9%
associate-*r/54.9%
associate-/l*54.9%
Simplified54.9%
associate-/r/54.8%
unpow254.8%
associate-*r*54.7%
Applied egg-rr54.7%
*-commutative54.7%
associate-*l/54.7%
associate-*r/54.9%
Applied egg-rr54.9%
if 2.0000000000000001e190 < (*.f64 z z) Initial program 60.2%
Taylor expanded in z around inf 71.9%
*-commutative71.9%
Simplified71.9%
unpow269.3%
*-un-lft-identity69.3%
times-frac81.8%
Applied egg-rr77.9%
Final simplification65.1%
NOTE: x should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= y -1.05e+165) (not (<= y 1.35e+154))) (* 0.5 y) (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0))))
x = abs(x);
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.05e+165) || !(y <= 1.35e+154)) {
tmp = 0.5 * y;
} else {
tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1.05d+165)) .or. (.not. (y <= 1.35d+154))) then
tmp = 0.5d0 * y
else
tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.05e+165) || !(y <= 1.35e+154)) {
tmp = 0.5 * y;
} else {
tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
return tmp;
}
x = abs(x) def code(x, y, z): tmp = 0 if (y <= -1.05e+165) or not (y <= 1.35e+154): tmp = 0.5 * y else: tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0) return tmp
x = abs(x) function code(x, y, z) tmp = 0.0 if ((y <= -1.05e+165) || !(y <= 1.35e+154)) tmp = Float64(0.5 * y); else tmp = Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.05e+165) || ~((y <= 1.35e+154))) tmp = 0.5 * y; else tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[y, -1.05e+165], N[Not[LessEqual[y, 1.35e+154]], $MachinePrecision]], N[(0.5 * y), $MachinePrecision], N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+165} \lor \neg \left(y \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\\
\end{array}
\end{array}
if y < -1.05e165 or 1.35000000000000003e154 < y Initial program 9.8%
Taylor expanded in y around inf 76.5%
if -1.05e165 < y < 1.35000000000000003e154Initial program 86.6%
Final simplification84.0%
NOTE: x should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= x 1.05e+231) (+ (* 0.5 (- y (/ z (/ y z)))) (* 0.5 (* x (/ x y)))) (* x (* x (/ 0.5 y)))))
x = abs(x);
double code(double x, double y, double z) {
double tmp;
if (x <= 1.05e+231) {
tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
} else {
tmp = x * (x * (0.5 / y));
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.05d+231) then
tmp = (0.5d0 * (y - (z / (y / z)))) + (0.5d0 * (x * (x / y)))
else
tmp = x * (x * (0.5d0 / y))
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.05e+231) {
tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
} else {
tmp = x * (x * (0.5 / y));
}
return tmp;
}
x = abs(x) def code(x, y, z): tmp = 0 if x <= 1.05e+231: tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y))) else: tmp = x * (x * (0.5 / y)) return tmp
x = abs(x) function code(x, y, z) tmp = 0.0 if (x <= 1.05e+231) tmp = Float64(Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))) + Float64(0.5 * Float64(x * Float64(x / y)))); else tmp = Float64(x * Float64(x * Float64(0.5 / y))); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.05e+231) tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y))); else tmp = x * (x * (0.5 / y)); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_, y_, z_] := If[LessEqual[x, 1.05e+231], N[(N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.05 \cdot 10^{+231}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\end{array}
\end{array}
if x < 1.04999999999999992e231Initial program 65.3%
Taylor expanded in x around inf 80.9%
unpow280.9%
*-un-lft-identity80.9%
times-frac89.3%
Applied egg-rr89.3%
unpow289.3%
*-un-lft-identity89.3%
times-frac94.0%
Applied egg-rr94.0%
/-rgt-identity94.0%
associate-*r/89.3%
associate-/l*94.1%
Applied egg-rr94.1%
if 1.04999999999999992e231 < x Initial program 86.7%
Taylor expanded in x around inf 100.0%
associate-*r/100.0%
associate-/l*100.0%
Simplified100.0%
associate-/r/100.0%
unpow2100.0%
associate-*r*100.0%
Applied egg-rr100.0%
Final simplification94.4%
NOTE: x should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= x 4.4e+84) (* 0.5 y) (* x (* x (/ 0.5 y)))))
x = abs(x);
double code(double x, double y, double z) {
double tmp;
if (x <= 4.4e+84) {
tmp = 0.5 * y;
} else {
tmp = x * (x * (0.5 / y));
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 4.4d+84) then
tmp = 0.5d0 * y
else
tmp = x * (x * (0.5d0 / y))
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4.4e+84) {
tmp = 0.5 * y;
} else {
tmp = x * (x * (0.5 / y));
}
return tmp;
}
x = abs(x) def code(x, y, z): tmp = 0 if x <= 4.4e+84: tmp = 0.5 * y else: tmp = x * (x * (0.5 / y)) return tmp
x = abs(x) function code(x, y, z) tmp = 0.0 if (x <= 4.4e+84) tmp = Float64(0.5 * y); else tmp = Float64(x * Float64(x * Float64(0.5 / y))); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4.4e+84) tmp = 0.5 * y; else tmp = x * (x * (0.5 / y)); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_, y_, z_] := If[LessEqual[x, 4.4e+84], N[(0.5 * y), $MachinePrecision], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.4 \cdot 10^{+84}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\end{array}
\end{array}
if x < 4.3999999999999997e84Initial program 65.4%
Taylor expanded in y around inf 40.0%
if 4.3999999999999997e84 < x Initial program 72.6%
Taylor expanded in x around inf 75.2%
associate-*r/75.2%
associate-/l*75.2%
Simplified75.2%
associate-/r/75.2%
unpow275.2%
associate-*r*79.7%
Applied egg-rr79.7%
Final simplification46.1%
NOTE: x should be positive before calling this function (FPCore (x y z) :precision binary64 (* 0.5 y))
x = abs(x);
double code(double x, double y, double z) {
return 0.5 * y;
}
NOTE: x should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 0.5d0 * y
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
return 0.5 * y;
}
x = abs(x) def code(x, y, z): return 0.5 * y
x = abs(x) function code(x, y, z) return Float64(0.5 * y) end
x = abs(x) function tmp = code(x, y, z) tmp = 0.5 * y; end
NOTE: x should be positive before calling this function code[x_, y_, z_] := N[(0.5 * y), $MachinePrecision]
\begin{array}{l}
x = |x|\\
\\
0.5 \cdot y
\end{array}
Initial program 66.5%
Taylor expanded in y around inf 35.2%
Final simplification35.2%
(FPCore (x y z) :precision binary64 (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x))))
double code(double x, double y, double z) {
return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y * 0.5d0) - (((0.5d0 / y) * (z + x)) * (z - x))
end function
public static double code(double x, double y, double z) {
return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x));
}
def code(x, y, z): return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x))
function code(x, y, z) return Float64(Float64(y * 0.5) - Float64(Float64(Float64(0.5 / y) * Float64(z + x)) * Float64(z - x))) end
function tmp = code(x, y, z) tmp = (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x)); end
code[x_, y_, z_] := N[(N[(y * 0.5), $MachinePrecision] - N[(N[(N[(0.5 / y), $MachinePrecision] * N[(z + x), $MachinePrecision]), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 0.5 - \left(\frac{0.5}{y} \cdot \left(z + x\right)\right) \cdot \left(z - x\right)
\end{array}
herbie shell --seed 2023336
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
:herbie-target
(- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))