
(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 13 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: z should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= y -1.35e-18) (not (<= y 3e-142))) (* 0.5 (+ (/ x (/ y x)) (* (/ (- y z) y) (+ y z)))) (/ (fma x x (* (- y z) (+ y z))) (* y 2.0))))
z = abs(z);
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.35e-18) || !(y <= 3e-142)) {
tmp = 0.5 * ((x / (y / x)) + (((y - z) / y) * (y + z)));
} else {
tmp = fma(x, x, ((y - z) * (y + z))) / (y * 2.0);
}
return tmp;
}
z = abs(z) function code(x, y, z) tmp = 0.0 if ((y <= -1.35e-18) || !(y <= 3e-142)) tmp = Float64(0.5 * Float64(Float64(x / Float64(y / x)) + Float64(Float64(Float64(y - z) / y) * Float64(y + z)))); else tmp = Float64(fma(x, x, Float64(Float64(y - z) * Float64(y + z))) / Float64(y * 2.0)); end return tmp end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[y, -1.35e-18], N[Not[LessEqual[y, 3e-142]], $MachinePrecision]], N[(0.5 * N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y - z), $MachinePrecision] / y), $MachinePrecision] * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x + N[(N[(y - z), $MachinePrecision] * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{-18} \lor \neg \left(y \leq 3 \cdot 10^{-142}\right):\\
\;\;\;\;0.5 \cdot \left(\frac{x}{\frac{y}{x}} + \frac{y - z}{y} \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, \left(y - z\right) \cdot \left(y + z\right)\right)}{y \cdot 2}\\
\end{array}
\end{array}
if y < -1.34999999999999994e-18 or 3.0000000000000001e-142 < y Initial program 58.8%
Taylor expanded in x around 0 58.8%
distribute-lft-out58.8%
unpow258.8%
unpow258.8%
difference-of-squares60.1%
*-commutative60.1%
+-commutative60.1%
unpow260.1%
associate-/l*64.2%
associate-/l*99.2%
associate-/r/99.2%
Simplified99.2%
if -1.34999999999999994e-18 < y < 3.0000000000000001e-142Initial program 94.5%
associate--l+94.5%
fma-def95.6%
difference-of-squares95.6%
Simplified95.6%
Final simplification97.9%
NOTE: z should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= (* x x) 2e+237) (fma (/ (hypot x y) y) (/ (hypot x y) 2.0) (* (/ z y) (/ (- z) 2.0))) (* 0.5 (fma (/ x y) x y))))
z = abs(z);
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 2e+237) {
tmp = fma((hypot(x, y) / y), (hypot(x, y) / 2.0), ((z / y) * (-z / 2.0)));
} else {
tmp = 0.5 * fma((x / y), x, y);
}
return tmp;
}
z = abs(z) function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 2e+237) tmp = fma(Float64(hypot(x, y) / y), Float64(hypot(x, y) / 2.0), Float64(Float64(z / y) * Float64(Float64(-z) / 2.0))); else tmp = Float64(0.5 * fma(Float64(x / y), x, y)); end return tmp end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 2e+237], N[(N[(N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision] / y), $MachinePrecision] * N[(N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision] / 2.0), $MachinePrecision] + N[(N[(z / y), $MachinePrecision] * N[((-z) / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x / y), $MachinePrecision] * x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+237}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{hypot}\left(x, y\right)}{y}, \frac{\mathsf{hypot}\left(x, y\right)}{2}, \frac{z}{y} \cdot \frac{-z}{2}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \mathsf{fma}\left(\frac{x}{y}, x, y\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 1.99999999999999988e237Initial program 76.9%
div-sub75.2%
sub-neg75.2%
add-sqr-sqrt75.2%
times-frac75.2%
fma-def76.9%
hypot-def76.9%
hypot-def91.2%
times-frac99.9%
Applied egg-rr99.9%
if 1.99999999999999988e237 < (*.f64 x x) Initial program 59.5%
Taylor expanded in y around 0 60.8%
distribute-lft-out60.8%
unpow260.8%
unpow260.8%
Simplified60.8%
Taylor expanded in x around inf 68.8%
unpow268.8%
associate-/l*89.8%
Simplified89.8%
+-commutative89.8%
associate-/r/89.8%
fma-def89.8%
Applied egg-rr89.8%
Final simplification96.8%
NOTE: z should be positive before calling this function
(FPCore (x y z)
:precision binary64
(if (<= (* x x) 2e+132)
(* 0.5 (- y (/ z (/ y z))))
(if (or (<= (* x x) 5e+222) (not (<= (* x x) 2e+295)))
(* 0.5 (+ y (/ x (/ y x))))
(/ (- (* x x) (* z z)) (* y 2.0)))))z = abs(z);
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 2e+132) {
tmp = 0.5 * (y - (z / (y / z)));
} else if (((x * x) <= 5e+222) || !((x * x) <= 2e+295)) {
tmp = 0.5 * (y + (x / (y / x)));
} else {
tmp = ((x * x) - (z * z)) / (y * 2.0);
}
return tmp;
}
NOTE: z 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 * x) <= 2d+132) then
tmp = 0.5d0 * (y - (z / (y / z)))
else if (((x * x) <= 5d+222) .or. (.not. ((x * x) <= 2d+295))) then
tmp = 0.5d0 * (y + (x / (y / x)))
else
tmp = ((x * x) - (z * z)) / (y * 2.0d0)
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 2e+132) {
tmp = 0.5 * (y - (z / (y / z)));
} else if (((x * x) <= 5e+222) || !((x * x) <= 2e+295)) {
tmp = 0.5 * (y + (x / (y / x)));
} else {
tmp = ((x * x) - (z * z)) / (y * 2.0);
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if (x * x) <= 2e+132: tmp = 0.5 * (y - (z / (y / z))) elif ((x * x) <= 5e+222) or not ((x * x) <= 2e+295): tmp = 0.5 * (y + (x / (y / x))) else: tmp = ((x * x) - (z * z)) / (y * 2.0) return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 2e+132) tmp = Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))); elseif ((Float64(x * x) <= 5e+222) || !(Float64(x * x) <= 2e+295)) tmp = Float64(0.5 * Float64(y + Float64(x / Float64(y / x)))); else tmp = Float64(Float64(Float64(x * x) - Float64(z * z)) / Float64(y * 2.0)); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 2e+132) tmp = 0.5 * (y - (z / (y / z))); elseif (((x * x) <= 5e+222) || ~(((x * x) <= 2e+295))) tmp = 0.5 * (y + (x / (y / x))); else tmp = ((x * x) - (z * z)) / (y * 2.0); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 2e+132], N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * x), $MachinePrecision], 5e+222], N[Not[LessEqual[N[(x * x), $MachinePrecision], 2e+295]], $MachinePrecision]], N[(0.5 * N[(y + N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+132}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right)\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+222} \lor \neg \left(x \cdot x \leq 2 \cdot 10^{+295}\right):\\
\;\;\;\;0.5 \cdot \left(y + \frac{x}{\frac{y}{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot x - z \cdot z}{y \cdot 2}\\
\end{array}
\end{array}
if (*.f64 x x) < 1.99999999999999998e132Initial program 77.7%
div-sub75.7%
sub-neg75.7%
add-sqr-sqrt75.7%
times-frac75.7%
fma-def77.7%
hypot-def77.7%
hypot-def93.5%
times-frac99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 85.0%
distribute-lft-out--85.0%
unpow285.0%
associate-/l*91.3%
Simplified91.3%
if 1.99999999999999998e132 < (*.f64 x x) < 5.00000000000000023e222 or 2e295 < (*.f64 x x) Initial program 56.9%
Taylor expanded in y around 0 60.1%
distribute-lft-out60.1%
unpow260.1%
unpow260.1%
Simplified60.1%
Taylor expanded in x around inf 74.8%
unpow274.8%
associate-/l*93.2%
Simplified93.2%
if 5.00000000000000023e222 < (*.f64 x x) < 2e295Initial program 94.5%
Taylor expanded in y around 0 94.5%
unpow294.5%
unpow294.5%
Simplified94.5%
Final simplification92.2%
NOTE: z should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= y -1e-18) (not (<= y 1.65e-96))) (* 0.5 (+ (/ x (/ y x)) (* (/ (- y z) y) (+ y z)))) (* 0.5 (+ y (/ (- (* x x) (* z z)) y)))))
z = abs(z);
double code(double x, double y, double z) {
double tmp;
if ((y <= -1e-18) || !(y <= 1.65e-96)) {
tmp = 0.5 * ((x / (y / x)) + (((y - z) / y) * (y + z)));
} else {
tmp = 0.5 * (y + (((x * x) - (z * z)) / y));
}
return tmp;
}
NOTE: z 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 <= (-1d-18)) .or. (.not. (y <= 1.65d-96))) then
tmp = 0.5d0 * ((x / (y / x)) + (((y - z) / y) * (y + z)))
else
tmp = 0.5d0 * (y + (((x * x) - (z * z)) / y))
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1e-18) || !(y <= 1.65e-96)) {
tmp = 0.5 * ((x / (y / x)) + (((y - z) / y) * (y + z)));
} else {
tmp = 0.5 * (y + (((x * x) - (z * z)) / y));
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if (y <= -1e-18) or not (y <= 1.65e-96): tmp = 0.5 * ((x / (y / x)) + (((y - z) / y) * (y + z))) else: tmp = 0.5 * (y + (((x * x) - (z * z)) / y)) return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if ((y <= -1e-18) || !(y <= 1.65e-96)) tmp = Float64(0.5 * Float64(Float64(x / Float64(y / x)) + Float64(Float64(Float64(y - z) / y) * Float64(y + z)))); else tmp = Float64(0.5 * Float64(y + Float64(Float64(Float64(x * x) - Float64(z * z)) / y))); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1e-18) || ~((y <= 1.65e-96))) tmp = 0.5 * ((x / (y / x)) + (((y - z) / y) * (y + z))); else tmp = 0.5 * (y + (((x * x) - (z * z)) / y)); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[y, -1e-18], N[Not[LessEqual[y, 1.65e-96]], $MachinePrecision]], N[(0.5 * N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y - z), $MachinePrecision] / y), $MachinePrecision] * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y + N[(N[(N[(x * x), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-18} \lor \neg \left(y \leq 1.65 \cdot 10^{-96}\right):\\
\;\;\;\;0.5 \cdot \left(\frac{x}{\frac{y}{x}} + \frac{y - z}{y} \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x \cdot x - z \cdot z}{y}\right)\\
\end{array}
\end{array}
if y < -1.0000000000000001e-18 or 1.64999999999999995e-96 < y Initial program 55.6%
Taylor expanded in x around 0 55.6%
distribute-lft-out55.6%
unpow255.6%
unpow255.6%
difference-of-squares57.0%
*-commutative57.0%
+-commutative57.0%
unpow257.0%
associate-/l*61.4%
associate-/l*99.2%
associate-/r/99.2%
Simplified99.2%
if -1.0000000000000001e-18 < y < 1.64999999999999995e-96Initial program 95.1%
Taylor expanded in y around 0 95.2%
distribute-lft-out95.2%
unpow295.2%
unpow295.2%
Simplified95.2%
Final simplification97.6%
NOTE: z should be positive before calling this function
(FPCore (x y z)
:precision binary64
(if (<= (* z z) 1e-18)
(* 0.5 (+ (/ x (/ y x)) (- y (/ (* z z) y))))
(if (<= (* z z) 4e+284)
(* 0.5 (+ y (/ (- (* x x) (* z z)) y)))
(/ 1.0 (* 2.0 (/ (/ y (+ y z)) (- y z)))))))z = abs(z);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-18) {
tmp = 0.5 * ((x / (y / x)) + (y - ((z * z) / y)));
} else if ((z * z) <= 4e+284) {
tmp = 0.5 * (y + (((x * x) - (z * z)) / y));
} else {
tmp = 1.0 / (2.0 * ((y / (y + z)) / (y - z)));
}
return tmp;
}
NOTE: z 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 ((z * z) <= 1d-18) then
tmp = 0.5d0 * ((x / (y / x)) + (y - ((z * z) / y)))
else if ((z * z) <= 4d+284) then
tmp = 0.5d0 * (y + (((x * x) - (z * z)) / y))
else
tmp = 1.0d0 / (2.0d0 * ((y / (y + z)) / (y - z)))
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-18) {
tmp = 0.5 * ((x / (y / x)) + (y - ((z * z) / y)));
} else if ((z * z) <= 4e+284) {
tmp = 0.5 * (y + (((x * x) - (z * z)) / y));
} else {
tmp = 1.0 / (2.0 * ((y / (y + z)) / (y - z)));
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if (z * z) <= 1e-18: tmp = 0.5 * ((x / (y / x)) + (y - ((z * z) / y))) elif (z * z) <= 4e+284: tmp = 0.5 * (y + (((x * x) - (z * z)) / y)) else: tmp = 1.0 / (2.0 * ((y / (y + z)) / (y - z))) return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e-18) tmp = Float64(0.5 * Float64(Float64(x / Float64(y / x)) + Float64(y - Float64(Float64(z * z) / y)))); elseif (Float64(z * z) <= 4e+284) tmp = Float64(0.5 * Float64(y + Float64(Float64(Float64(x * x) - Float64(z * z)) / y))); else tmp = Float64(1.0 / Float64(2.0 * Float64(Float64(y / Float64(y + z)) / Float64(y - z)))); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 1e-18) tmp = 0.5 * ((x / (y / x)) + (y - ((z * z) / y))); elseif ((z * z) <= 4e+284) tmp = 0.5 * (y + (((x * x) - (z * z)) / y)); else tmp = 1.0 / (2.0 * ((y / (y + z)) / (y - z))); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e-18], N[(0.5 * N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] + N[(y - N[(N[(z * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 4e+284], N[(0.5 * N[(y + N[(N[(N[(x * x), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 * N[(N[(y / N[(y + z), $MachinePrecision]), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-18}:\\
\;\;\;\;0.5 \cdot \left(\frac{x}{\frac{y}{x}} + \left(y - \frac{z \cdot z}{y}\right)\right)\\
\mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{+284}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x \cdot x - z \cdot z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 \cdot \frac{\frac{y}{y + z}}{y - z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.0000000000000001e-18Initial program 73.4%
Taylor expanded in x around inf 89.9%
+-commutative89.9%
distribute-lft-out89.9%
unpow289.9%
associate-/l*99.9%
unpow299.9%
Simplified99.9%
if 1.0000000000000001e-18 < (*.f64 z z) < 4.00000000000000032e284Initial program 90.1%
Taylor expanded in y around 0 96.6%
distribute-lft-out96.6%
unpow296.6%
unpow296.6%
Simplified96.6%
if 4.00000000000000032e284 < (*.f64 z z) Initial program 54.7%
Taylor expanded in x around 0 57.3%
unpow257.3%
unpow257.3%
difference-of-squares62.5%
*-commutative62.5%
associate-/l*86.0%
associate-*r/86.0%
Simplified86.0%
clear-num86.0%
inv-pow86.0%
Applied egg-rr86.0%
unpow-186.0%
*-lft-identity86.0%
times-frac86.0%
metadata-eval86.0%
Simplified86.0%
Final simplification94.9%
NOTE: z should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= (* x x) 2e+295) (* 0.5 (+ y (/ (- (* x x) (* z z)) y))) (* 0.5 (+ y (/ x (/ y x))))))
z = abs(z);
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 2e+295) {
tmp = 0.5 * (y + (((x * x) - (z * z)) / y));
} else {
tmp = 0.5 * (y + (x / (y / x)));
}
return tmp;
}
NOTE: z 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 * x) <= 2d+295) then
tmp = 0.5d0 * (y + (((x * x) - (z * z)) / y))
else
tmp = 0.5d0 * (y + (x / (y / x)))
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 2e+295) {
tmp = 0.5 * (y + (((x * x) - (z * z)) / y));
} else {
tmp = 0.5 * (y + (x / (y / x)));
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if (x * x) <= 2e+295: tmp = 0.5 * (y + (((x * x) - (z * z)) / y)) else: tmp = 0.5 * (y + (x / (y / x))) return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 2e+295) tmp = Float64(0.5 * Float64(y + Float64(Float64(Float64(x * x) - Float64(z * z)) / y))); else tmp = Float64(0.5 * Float64(y + Float64(x / Float64(y / x)))); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 2e+295) tmp = 0.5 * (y + (((x * x) - (z * z)) / y)); else tmp = 0.5 * (y + (x / (y / x))); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 2e+295], N[(0.5 * N[(y + N[(N[(N[(x * x), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y + N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+295}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x \cdot x - z \cdot z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x}{\frac{y}{x}}\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 2e295Initial program 78.6%
Taylor expanded in y around 0 91.4%
distribute-lft-out91.4%
unpow291.4%
unpow291.4%
Simplified91.4%
if 2e295 < (*.f64 x x) Initial program 50.8%
Taylor expanded in y around 0 52.4%
distribute-lft-out52.4%
unpow252.4%
unpow252.4%
Simplified52.4%
Taylor expanded in x around inf 66.7%
unpow266.7%
associate-/l*92.2%
Simplified92.2%
Final simplification91.6%
NOTE: z should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* z (/ z y)) -0.5)))
(if (<= x 3.2e-200)
(* y 0.5)
(if (<= x 7.2e-35)
t_0
(if (<= x 9.6e-6)
(* y 0.5)
(if (<= x 8.5e+50) t_0 (* 0.5 (/ x (/ y x)))))))))z = abs(z);
double code(double x, double y, double z) {
double t_0 = (z * (z / y)) * -0.5;
double tmp;
if (x <= 3.2e-200) {
tmp = y * 0.5;
} else if (x <= 7.2e-35) {
tmp = t_0;
} else if (x <= 9.6e-6) {
tmp = y * 0.5;
} else if (x <= 8.5e+50) {
tmp = t_0;
} else {
tmp = 0.5 * (x / (y / x));
}
return tmp;
}
NOTE: z 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 = (z * (z / y)) * (-0.5d0)
if (x <= 3.2d-200) then
tmp = y * 0.5d0
else if (x <= 7.2d-35) then
tmp = t_0
else if (x <= 9.6d-6) then
tmp = y * 0.5d0
else if (x <= 8.5d+50) then
tmp = t_0
else
tmp = 0.5d0 * (x / (y / x))
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double t_0 = (z * (z / y)) * -0.5;
double tmp;
if (x <= 3.2e-200) {
tmp = y * 0.5;
} else if (x <= 7.2e-35) {
tmp = t_0;
} else if (x <= 9.6e-6) {
tmp = y * 0.5;
} else if (x <= 8.5e+50) {
tmp = t_0;
} else {
tmp = 0.5 * (x / (y / x));
}
return tmp;
}
z = abs(z) def code(x, y, z): t_0 = (z * (z / y)) * -0.5 tmp = 0 if x <= 3.2e-200: tmp = y * 0.5 elif x <= 7.2e-35: tmp = t_0 elif x <= 9.6e-6: tmp = y * 0.5 elif x <= 8.5e+50: tmp = t_0 else: tmp = 0.5 * (x / (y / x)) return tmp
z = abs(z) function code(x, y, z) t_0 = Float64(Float64(z * Float64(z / y)) * -0.5) tmp = 0.0 if (x <= 3.2e-200) tmp = Float64(y * 0.5); elseif (x <= 7.2e-35) tmp = t_0; elseif (x <= 9.6e-6) tmp = Float64(y * 0.5); elseif (x <= 8.5e+50) tmp = t_0; else tmp = Float64(0.5 * Float64(x / Float64(y / x))); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) t_0 = (z * (z / y)) * -0.5; tmp = 0.0; if (x <= 3.2e-200) tmp = y * 0.5; elseif (x <= 7.2e-35) tmp = t_0; elseif (x <= 9.6e-6) tmp = y * 0.5; elseif (x <= 8.5e+50) tmp = t_0; else tmp = 0.5 * (x / (y / x)); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[x, 3.2e-200], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, 7.2e-35], t$95$0, If[LessEqual[x, 9.6e-6], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, 8.5e+50], t$95$0, N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_0 := \left(z \cdot \frac{z}{y}\right) \cdot -0.5\\
\mathbf{if}\;x \leq 3.2 \cdot 10^{-200}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-35}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{-6}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+50}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\end{array}
\end{array}
if x < 3.19999999999999983e-200 or 7.20000000000000038e-35 < x < 9.5999999999999996e-6Initial program 72.2%
Taylor expanded in y around inf 36.1%
if 3.19999999999999983e-200 < x < 7.20000000000000038e-35 or 9.5999999999999996e-6 < x < 8.49999999999999961e50Initial program 83.5%
Taylor expanded in z around inf 57.5%
*-commutative57.5%
unpow257.5%
Simplified57.5%
Taylor expanded in z around 0 57.5%
unpow257.5%
associate-*r/59.8%
Simplified59.8%
if 8.49999999999999961e50 < x Initial program 62.9%
Taylor expanded in x around inf 61.7%
unpow261.7%
associate-/l*68.3%
Simplified68.3%
Final simplification48.3%
NOTE: z should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ z (* (/ y z) -2.0))))
(if (<= x 3e-208)
(* y 0.5)
(if (<= x 5.8e-35)
t_0
(if (<= x 3.8e-7)
(* y 0.5)
(if (<= x 7e+50) t_0 (* 0.5 (/ x (/ y x)))))))))z = abs(z);
double code(double x, double y, double z) {
double t_0 = z / ((y / z) * -2.0);
double tmp;
if (x <= 3e-208) {
tmp = y * 0.5;
} else if (x <= 5.8e-35) {
tmp = t_0;
} else if (x <= 3.8e-7) {
tmp = y * 0.5;
} else if (x <= 7e+50) {
tmp = t_0;
} else {
tmp = 0.5 * (x / (y / x));
}
return tmp;
}
NOTE: z 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 = z / ((y / z) * (-2.0d0))
if (x <= 3d-208) then
tmp = y * 0.5d0
else if (x <= 5.8d-35) then
tmp = t_0
else if (x <= 3.8d-7) then
tmp = y * 0.5d0
else if (x <= 7d+50) then
tmp = t_0
else
tmp = 0.5d0 * (x / (y / x))
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double t_0 = z / ((y / z) * -2.0);
double tmp;
if (x <= 3e-208) {
tmp = y * 0.5;
} else if (x <= 5.8e-35) {
tmp = t_0;
} else if (x <= 3.8e-7) {
tmp = y * 0.5;
} else if (x <= 7e+50) {
tmp = t_0;
} else {
tmp = 0.5 * (x / (y / x));
}
return tmp;
}
z = abs(z) def code(x, y, z): t_0 = z / ((y / z) * -2.0) tmp = 0 if x <= 3e-208: tmp = y * 0.5 elif x <= 5.8e-35: tmp = t_0 elif x <= 3.8e-7: tmp = y * 0.5 elif x <= 7e+50: tmp = t_0 else: tmp = 0.5 * (x / (y / x)) return tmp
z = abs(z) function code(x, y, z) t_0 = Float64(z / Float64(Float64(y / z) * -2.0)) tmp = 0.0 if (x <= 3e-208) tmp = Float64(y * 0.5); elseif (x <= 5.8e-35) tmp = t_0; elseif (x <= 3.8e-7) tmp = Float64(y * 0.5); elseif (x <= 7e+50) tmp = t_0; else tmp = Float64(0.5 * Float64(x / Float64(y / x))); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) t_0 = z / ((y / z) * -2.0); tmp = 0.0; if (x <= 3e-208) tmp = y * 0.5; elseif (x <= 5.8e-35) tmp = t_0; elseif (x <= 3.8e-7) tmp = y * 0.5; elseif (x <= 7e+50) tmp = t_0; else tmp = 0.5 * (x / (y / x)); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(z / N[(N[(y / z), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 3e-208], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, 5.8e-35], t$95$0, If[LessEqual[x, 3.8e-7], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, 7e+50], t$95$0, N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_0 := \frac{z}{\frac{y}{z} \cdot -2}\\
\mathbf{if}\;x \leq 3 \cdot 10^{-208}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-35}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-7}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+50}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\end{array}
\end{array}
if x < 2.99999999999999986e-208 or 5.8000000000000004e-35 < x < 3.80000000000000015e-7Initial program 72.2%
Taylor expanded in y around inf 36.1%
if 2.99999999999999986e-208 < x < 5.8000000000000004e-35 or 3.80000000000000015e-7 < x < 7.00000000000000012e50Initial program 83.5%
div-sub81.0%
sub-neg81.0%
add-sqr-sqrt81.0%
times-frac81.0%
fma-def83.5%
hypot-def83.5%
hypot-def97.5%
times-frac99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 57.5%
*-commutative57.5%
unpow257.5%
metadata-eval57.5%
associate-/l*59.9%
times-frac59.9%
*-rgt-identity59.9%
Simplified59.9%
if 7.00000000000000012e50 < x Initial program 62.9%
Taylor expanded in x around inf 61.7%
unpow261.7%
associate-/l*68.3%
Simplified68.3%
Final simplification48.4%
NOTE: z should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ z (* (/ y z) -2.0))))
(if (<= x 6.6e-205)
(* y 0.5)
(if (<= x 4.2e-35)
t_0
(if (<= x 1.6e-8)
(* y 0.5)
(if (<= x 1.1e+51) t_0 (/ (* x (/ x y)) 2.0)))))))z = abs(z);
double code(double x, double y, double z) {
double t_0 = z / ((y / z) * -2.0);
double tmp;
if (x <= 6.6e-205) {
tmp = y * 0.5;
} else if (x <= 4.2e-35) {
tmp = t_0;
} else if (x <= 1.6e-8) {
tmp = y * 0.5;
} else if (x <= 1.1e+51) {
tmp = t_0;
} else {
tmp = (x * (x / y)) / 2.0;
}
return tmp;
}
NOTE: z 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 = z / ((y / z) * (-2.0d0))
if (x <= 6.6d-205) then
tmp = y * 0.5d0
else if (x <= 4.2d-35) then
tmp = t_0
else if (x <= 1.6d-8) then
tmp = y * 0.5d0
else if (x <= 1.1d+51) then
tmp = t_0
else
tmp = (x * (x / y)) / 2.0d0
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double t_0 = z / ((y / z) * -2.0);
double tmp;
if (x <= 6.6e-205) {
tmp = y * 0.5;
} else if (x <= 4.2e-35) {
tmp = t_0;
} else if (x <= 1.6e-8) {
tmp = y * 0.5;
} else if (x <= 1.1e+51) {
tmp = t_0;
} else {
tmp = (x * (x / y)) / 2.0;
}
return tmp;
}
z = abs(z) def code(x, y, z): t_0 = z / ((y / z) * -2.0) tmp = 0 if x <= 6.6e-205: tmp = y * 0.5 elif x <= 4.2e-35: tmp = t_0 elif x <= 1.6e-8: tmp = y * 0.5 elif x <= 1.1e+51: tmp = t_0 else: tmp = (x * (x / y)) / 2.0 return tmp
z = abs(z) function code(x, y, z) t_0 = Float64(z / Float64(Float64(y / z) * -2.0)) tmp = 0.0 if (x <= 6.6e-205) tmp = Float64(y * 0.5); elseif (x <= 4.2e-35) tmp = t_0; elseif (x <= 1.6e-8) tmp = Float64(y * 0.5); elseif (x <= 1.1e+51) tmp = t_0; else tmp = Float64(Float64(x * Float64(x / y)) / 2.0); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) t_0 = z / ((y / z) * -2.0); tmp = 0.0; if (x <= 6.6e-205) tmp = y * 0.5; elseif (x <= 4.2e-35) tmp = t_0; elseif (x <= 1.6e-8) tmp = y * 0.5; elseif (x <= 1.1e+51) tmp = t_0; else tmp = (x * (x / y)) / 2.0; end tmp_2 = tmp; end
NOTE: z should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(z / N[(N[(y / z), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 6.6e-205], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, 4.2e-35], t$95$0, If[LessEqual[x, 1.6e-8], N[(y * 0.5), $MachinePrecision], If[LessEqual[x, 1.1e+51], t$95$0, N[(N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_0 := \frac{z}{\frac{y}{z} \cdot -2}\\
\mathbf{if}\;x \leq 6.6 \cdot 10^{-205}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-35}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-8}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+51}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{x}{y}}{2}\\
\end{array}
\end{array}
if x < 6.5999999999999998e-205 or 4.2e-35 < x < 1.6000000000000001e-8Initial program 72.2%
Taylor expanded in y around inf 36.1%
if 6.5999999999999998e-205 < x < 4.2e-35 or 1.6000000000000001e-8 < x < 1.09999999999999996e51Initial program 83.5%
div-sub81.0%
sub-neg81.0%
add-sqr-sqrt81.0%
times-frac81.0%
fma-def83.5%
hypot-def83.5%
hypot-def97.5%
times-frac99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 57.5%
*-commutative57.5%
unpow257.5%
metadata-eval57.5%
associate-/l*59.9%
times-frac59.9%
*-rgt-identity59.9%
Simplified59.9%
if 1.09999999999999996e51 < x Initial program 62.9%
Taylor expanded in x around inf 61.7%
unpow261.7%
associate-/l*68.3%
Simplified68.3%
metadata-eval68.3%
associate-/r/68.4%
associate-*l/61.7%
times-frac61.7%
*-un-lft-identity61.7%
*-commutative61.7%
associate-/r*61.7%
associate-*l/68.4%
associate-/r/68.3%
div-inv68.3%
clear-num68.4%
Applied egg-rr68.4%
Final simplification48.4%
NOTE: z should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= (* z z) 4e+284) (* 0.5 (+ y (/ x (/ y x)))) (* (* z (/ z y)) -0.5)))
z = abs(z);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4e+284) {
tmp = 0.5 * (y + (x / (y / x)));
} else {
tmp = (z * (z / y)) * -0.5;
}
return tmp;
}
NOTE: z 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 ((z * z) <= 4d+284) then
tmp = 0.5d0 * (y + (x / (y / x)))
else
tmp = (z * (z / y)) * (-0.5d0)
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4e+284) {
tmp = 0.5 * (y + (x / (y / x)));
} else {
tmp = (z * (z / y)) * -0.5;
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if (z * z) <= 4e+284: tmp = 0.5 * (y + (x / (y / x))) else: tmp = (z * (z / y)) * -0.5 return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 4e+284) tmp = Float64(0.5 * Float64(y + Float64(x / Float64(y / x)))); else tmp = Float64(Float64(z * Float64(z / y)) * -0.5); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 4e+284) tmp = 0.5 * (y + (x / (y / x))); else tmp = (z * (z / y)) * -0.5; end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e+284], N[(0.5 * N[(y + N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+284}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x}{\frac{y}{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot \frac{z}{y}\right) \cdot -0.5\\
\end{array}
\end{array}
if (*.f64 z z) < 4.00000000000000032e284Initial program 78.9%
Taylor expanded in y around 0 92.1%
distribute-lft-out92.1%
unpow292.1%
unpow292.1%
Simplified92.1%
Taylor expanded in x around inf 74.9%
unpow274.9%
associate-/l*82.7%
Simplified82.7%
if 4.00000000000000032e284 < (*.f64 z z) Initial program 54.7%
Taylor expanded in z around inf 61.2%
*-commutative61.2%
unpow261.2%
Simplified61.2%
Taylor expanded in z around 0 61.2%
unpow261.2%
associate-*r/71.8%
Simplified71.8%
Final simplification79.4%
NOTE: z should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= (* x x) 2e+132) (* 0.5 (- y (/ z (/ y z)))) (* 0.5 (+ y (/ x (/ y x))))))
z = abs(z);
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 2e+132) {
tmp = 0.5 * (y - (z / (y / z)));
} else {
tmp = 0.5 * (y + (x / (y / x)));
}
return tmp;
}
NOTE: z 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 * x) <= 2d+132) then
tmp = 0.5d0 * (y - (z / (y / z)))
else
tmp = 0.5d0 * (y + (x / (y / x)))
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 2e+132) {
tmp = 0.5 * (y - (z / (y / z)));
} else {
tmp = 0.5 * (y + (x / (y / x)));
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if (x * x) <= 2e+132: tmp = 0.5 * (y - (z / (y / z))) else: tmp = 0.5 * (y + (x / (y / x))) return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 2e+132) tmp = Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))); else tmp = Float64(0.5 * Float64(y + Float64(x / Float64(y / x)))); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 2e+132) tmp = 0.5 * (y - (z / (y / z))); else tmp = 0.5 * (y + (x / (y / x))); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 2e+132], N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y + N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+132}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x}{\frac{y}{x}}\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 1.99999999999999998e132Initial program 77.7%
div-sub75.7%
sub-neg75.7%
add-sqr-sqrt75.7%
times-frac75.7%
fma-def77.7%
hypot-def77.7%
hypot-def93.5%
times-frac99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 85.0%
distribute-lft-out--85.0%
unpow285.0%
associate-/l*91.3%
Simplified91.3%
if 1.99999999999999998e132 < (*.f64 x x) Initial program 62.9%
Taylor expanded in y around 0 65.6%
distribute-lft-out65.6%
unpow265.6%
unpow265.6%
Simplified65.6%
Taylor expanded in x around inf 74.1%
unpow274.1%
associate-/l*89.6%
Simplified89.6%
Final simplification90.6%
NOTE: z should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= x 1.65e+66) (* y 0.5) (* 0.5 (/ x (/ y x)))))
z = abs(z);
double code(double x, double y, double z) {
double tmp;
if (x <= 1.65e+66) {
tmp = y * 0.5;
} else {
tmp = 0.5 * (x / (y / x));
}
return tmp;
}
NOTE: z 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.65d+66) then
tmp = y * 0.5d0
else
tmp = 0.5d0 * (x / (y / x))
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.65e+66) {
tmp = y * 0.5;
} else {
tmp = 0.5 * (x / (y / x));
}
return tmp;
}
z = abs(z) def code(x, y, z): tmp = 0 if x <= 1.65e+66: tmp = y * 0.5 else: tmp = 0.5 * (x / (y / x)) return tmp
z = abs(z) function code(x, y, z) tmp = 0.0 if (x <= 1.65e+66) tmp = Float64(y * 0.5); else tmp = Float64(0.5 * Float64(x / Float64(y / x))); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.65e+66) tmp = y * 0.5; else tmp = 0.5 * (x / (y / x)); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := If[LessEqual[x, 1.65e+66], N[(y * 0.5), $MachinePrecision], N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.65 \cdot 10^{+66}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\end{array}
\end{array}
if x < 1.6500000000000001e66Initial program 74.6%
Taylor expanded in y around inf 34.9%
if 1.6500000000000001e66 < x Initial program 62.1%
Taylor expanded in x around inf 63.8%
unpow263.8%
associate-/l*70.9%
Simplified70.9%
Final simplification43.9%
NOTE: z should be positive before calling this function (FPCore (x y z) :precision binary64 (* y 0.5))
z = abs(z);
double code(double x, double y, double z) {
return y * 0.5;
}
NOTE: z 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 = y * 0.5d0
end function
z = Math.abs(z);
public static double code(double x, double y, double z) {
return y * 0.5;
}
z = abs(z) def code(x, y, z): return y * 0.5
z = abs(z) function code(x, y, z) return Float64(y * 0.5) end
z = abs(z) function tmp = code(x, y, z) tmp = y * 0.5; end
NOTE: z should be positive before calling this function code[x_, y_, z_] := N[(y * 0.5), $MachinePrecision]
\begin{array}{l}
z = |z|\\
\\
y \cdot 0.5
\end{array}
Initial program 71.5%
Taylor expanded in y around inf 31.2%
Final simplification31.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 2023274
(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)))