
(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 8 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}
(FPCore (x y z) :precision binary64 (* 0.5 (+ y (/ (+ z x) (/ y (- x z))))))
double code(double x, double y, double z) {
return 0.5 * (y + ((z + x) / (y / (x - z))));
}
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 + ((z + x) / (y / (x - z))))
end function
public static double code(double x, double y, double z) {
return 0.5 * (y + ((z + x) / (y / (x - z))));
}
def code(x, y, z): return 0.5 * (y + ((z + x) / (y / (x - z))))
function code(x, y, z) return Float64(0.5 * Float64(y + Float64(Float64(z + x) / Float64(y / Float64(x - z))))) end
function tmp = code(x, y, z) tmp = 0.5 * (y + ((z + x) / (y / (x - z)))); end
code[x_, y_, z_] := N[(0.5 * N[(y + N[(N[(z + x), $MachinePrecision] / N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(y + \frac{z + x}{\frac{y}{x - z}}\right)
\end{array}
Initial program 67.5%
Taylor expanded in y around 0 80.3%
+-lft-identity80.3%
+-commutative80.3%
mul0-lft80.3%
metadata-eval80.3%
distribute-rgt1-in80.3%
distribute-lft-out80.3%
distribute-rgt1-in80.3%
metadata-eval80.3%
mul0-lft80.3%
+-rgt-identity80.3%
unpow280.3%
unpow280.3%
difference-of-squares86.6%
associate-/l*99.9%
+-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (* z (/ -0.5 y)))))
(if (<= (* x x) 5e-154)
t_0
(if (<= (* x x) 5e-79)
(* 0.5 y)
(if (<= (* x x) 0.02)
t_0
(if (<= (* x x) 1e+155) (* 0.5 y) (* 0.5 (* x (/ x y)))))))))
double code(double x, double y, double z) {
double t_0 = z * (z * (-0.5 / y));
double tmp;
if ((x * x) <= 5e-154) {
tmp = t_0;
} else if ((x * x) <= 5e-79) {
tmp = 0.5 * y;
} else if ((x * x) <= 0.02) {
tmp = t_0;
} else if ((x * x) <= 1e+155) {
tmp = 0.5 * y;
} else {
tmp = 0.5 * (x * (x / y));
}
return tmp;
}
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 * ((-0.5d0) / y))
if ((x * x) <= 5d-154) then
tmp = t_0
else if ((x * x) <= 5d-79) then
tmp = 0.5d0 * y
else if ((x * x) <= 0.02d0) then
tmp = t_0
else if ((x * x) <= 1d+155) then
tmp = 0.5d0 * y
else
tmp = 0.5d0 * (x * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (z * (-0.5 / y));
double tmp;
if ((x * x) <= 5e-154) {
tmp = t_0;
} else if ((x * x) <= 5e-79) {
tmp = 0.5 * y;
} else if ((x * x) <= 0.02) {
tmp = t_0;
} else if ((x * x) <= 1e+155) {
tmp = 0.5 * y;
} else {
tmp = 0.5 * (x * (x / y));
}
return tmp;
}
def code(x, y, z): t_0 = z * (z * (-0.5 / y)) tmp = 0 if (x * x) <= 5e-154: tmp = t_0 elif (x * x) <= 5e-79: tmp = 0.5 * y elif (x * x) <= 0.02: tmp = t_0 elif (x * x) <= 1e+155: tmp = 0.5 * y else: tmp = 0.5 * (x * (x / y)) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(z * Float64(-0.5 / y))) tmp = 0.0 if (Float64(x * x) <= 5e-154) tmp = t_0; elseif (Float64(x * x) <= 5e-79) tmp = Float64(0.5 * y); elseif (Float64(x * x) <= 0.02) tmp = t_0; elseif (Float64(x * x) <= 1e+155) tmp = Float64(0.5 * y); else tmp = Float64(0.5 * Float64(x * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (z * (-0.5 / y)); tmp = 0.0; if ((x * x) <= 5e-154) tmp = t_0; elseif ((x * x) <= 5e-79) tmp = 0.5 * y; elseif ((x * x) <= 0.02) tmp = t_0; elseif ((x * x) <= 1e+155) tmp = 0.5 * y; else tmp = 0.5 * (x * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(z * N[(-0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e-154], t$95$0, If[LessEqual[N[(x * x), $MachinePrecision], 5e-79], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 0.02], t$95$0, If[LessEqual[N[(x * x), $MachinePrecision], 1e+155], N[(0.5 * y), $MachinePrecision], N[(0.5 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-154}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-79}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;x \cdot x \leq 0.02:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 10^{+155}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 5.0000000000000002e-154 or 4.99999999999999999e-79 < (*.f64 x x) < 0.0200000000000000004Initial program 68.2%
Taylor expanded in z around inf 49.3%
*-commutative49.3%
unpow249.3%
associate-/l*56.1%
Simplified56.1%
Taylor expanded in z around 0 49.3%
unpow249.3%
associate-/l*56.1%
associate-*r/56.1%
associate-*l/56.1%
*-commutative56.1%
associate-/r/56.1%
Simplified56.1%
if 5.0000000000000002e-154 < (*.f64 x x) < 4.99999999999999999e-79 or 0.0200000000000000004 < (*.f64 x x) < 1.00000000000000001e155Initial program 70.4%
Taylor expanded in y around inf 55.1%
if 1.00000000000000001e155 < (*.f64 x x) Initial program 65.3%
Taylor expanded in x around inf 64.3%
unpow264.3%
associate-/l*69.0%
Simplified69.0%
associate-/r/69.0%
Applied egg-rr69.0%
Final simplification61.1%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 5e-9) (* 0.5 (+ y (/ x (/ y x)))) (* 0.5 (/ (+ z x) (/ y (- x z))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e-9) {
tmp = 0.5 * (y + (x / (y / x)));
} else {
tmp = 0.5 * ((z + x) / (y / (x - z)));
}
return tmp;
}
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) <= 5d-9) then
tmp = 0.5d0 * (y + (x / (y / x)))
else
tmp = 0.5d0 * ((z + x) / (y / (x - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e-9) {
tmp = 0.5 * (y + (x / (y / x)));
} else {
tmp = 0.5 * ((z + x) / (y / (x - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 5e-9: tmp = 0.5 * (y + (x / (y / x))) else: tmp = 0.5 * ((z + x) / (y / (x - z))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 5e-9) tmp = Float64(0.5 * Float64(y + Float64(x / Float64(y / x)))); else tmp = Float64(0.5 * Float64(Float64(z + x) / Float64(y / Float64(x - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 5e-9) tmp = 0.5 * (y + (x / (y / x))); else tmp = 0.5 * ((z + x) / (y / (x - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-9], N[(0.5 * N[(y + N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(z + x), $MachinePrecision] / N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-9}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x}{\frac{y}{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{z + x}{\frac{y}{x - z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 5.0000000000000001e-9Initial program 73.8%
Taylor expanded in y around 0 89.7%
+-lft-identity89.7%
+-commutative89.7%
mul0-lft89.7%
metadata-eval89.7%
distribute-rgt1-in89.7%
distribute-lft-out89.7%
distribute-rgt1-in89.7%
metadata-eval89.7%
mul0-lft89.7%
+-rgt-identity89.7%
unpow289.7%
unpow289.7%
difference-of-squares89.7%
associate-/l*99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 82.7%
unpow282.7%
associate-/l*91.5%
Simplified91.5%
if 5.0000000000000001e-9 < (*.f64 z z) Initial program 61.2%
Taylor expanded in y around 0 64.1%
unpow264.1%
unpow264.1%
sub-neg64.1%
mul-1-neg64.1%
unpow264.1%
+-commutative64.1%
unpow264.1%
unpow264.1%
+-commutative64.1%
unpow264.1%
mul-1-neg64.1%
sub-neg64.1%
difference-of-squares76.6%
associate-/l*83.8%
+-commutative83.8%
Simplified83.8%
Final simplification87.6%
(FPCore (x y z) :precision binary64 (* 0.5 (+ y (* (- x z) (/ (+ z x) y)))))
double code(double x, double y, double z) {
return 0.5 * (y + ((x - z) * ((z + x) / y)));
}
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 + ((x - z) * ((z + x) / y)))
end function
public static double code(double x, double y, double z) {
return 0.5 * (y + ((x - z) * ((z + x) / y)));
}
def code(x, y, z): return 0.5 * (y + ((x - z) * ((z + x) / y)))
function code(x, y, z) return Float64(0.5 * Float64(y + Float64(Float64(x - z) * Float64(Float64(z + x) / y)))) end
function tmp = code(x, y, z) tmp = 0.5 * (y + ((x - z) * ((z + x) / y))); end
code[x_, y_, z_] := N[(0.5 * N[(y + N[(N[(x - z), $MachinePrecision] * N[(N[(z + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(y + \left(x - z\right) \cdot \frac{z + x}{y}\right)
\end{array}
Initial program 67.5%
Taylor expanded in y around 0 80.3%
+-lft-identity80.3%
+-commutative80.3%
mul0-lft80.3%
metadata-eval80.3%
distribute-rgt1-in80.3%
distribute-lft-out80.3%
distribute-rgt1-in80.3%
metadata-eval80.3%
mul0-lft80.3%
+-rgt-identity80.3%
unpow280.3%
unpow280.3%
difference-of-squares86.6%
associate-/l*99.9%
+-commutative99.9%
Simplified99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= z 1.3e+120) (* 0.5 (+ y (/ x (/ y x)))) (* (* z (/ z y)) -0.5)))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.3e+120) {
tmp = 0.5 * (y + (x / (y / x)));
} else {
tmp = (z * (z / y)) * -0.5;
}
return tmp;
}
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 <= 1.3d+120) then
tmp = 0.5d0 * (y + (x / (y / x)))
else
tmp = (z * (z / y)) * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.3e+120) {
tmp = 0.5 * (y + (x / (y / x)));
} else {
tmp = (z * (z / y)) * -0.5;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.3e+120: tmp = 0.5 * (y + (x / (y / x))) else: tmp = (z * (z / y)) * -0.5 return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.3e+120) 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
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.3e+120) tmp = 0.5 * (y + (x / (y / x))); else tmp = (z * (z / y)) * -0.5; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.3e+120], 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}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.3 \cdot 10^{+120}:\\
\;\;\;\;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 z < 1.2999999999999999e120Initial program 70.4%
Taylor expanded in y around 0 85.7%
+-lft-identity85.7%
+-commutative85.7%
mul0-lft85.7%
metadata-eval85.7%
distribute-rgt1-in85.7%
distribute-lft-out85.7%
distribute-rgt1-in85.7%
metadata-eval85.7%
mul0-lft85.7%
+-rgt-identity85.7%
unpow285.7%
unpow285.7%
difference-of-squares88.6%
associate-/l*99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 66.3%
unpow266.3%
associate-/l*73.0%
Simplified73.0%
if 1.2999999999999999e120 < z Initial program 54.7%
Taylor expanded in z around inf 61.9%
*-commutative61.9%
unpow261.9%
associate-*l/71.3%
*-commutative71.3%
Simplified71.3%
Final simplification72.7%
(FPCore (x y z) :precision binary64 (if (<= z 1.06e+86) (* 0.5 (+ y (/ x (/ y x)))) (* 0.5 (- y (/ z (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.06e+86) {
tmp = 0.5 * (y + (x / (y / x)));
} else {
tmp = 0.5 * (y - (z / (y / z)));
}
return tmp;
}
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 <= 1.06d+86) then
tmp = 0.5d0 * (y + (x / (y / x)))
else
tmp = 0.5d0 * (y - (z / (y / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.06e+86) {
tmp = 0.5 * (y + (x / (y / x)));
} else {
tmp = 0.5 * (y - (z / (y / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.06e+86: tmp = 0.5 * (y + (x / (y / x))) else: tmp = 0.5 * (y - (z / (y / z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.06e+86) tmp = Float64(0.5 * Float64(y + Float64(x / Float64(y / x)))); else tmp = Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.06e+86) tmp = 0.5 * (y + (x / (y / x))); else tmp = 0.5 * (y - (z / (y / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.06e+86], N[(0.5 * N[(y + N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.06 \cdot 10^{+86}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x}{\frac{y}{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right)\\
\end{array}
\end{array}
if z < 1.06e86Initial program 70.4%
Taylor expanded in y around 0 85.3%
+-lft-identity85.3%
+-commutative85.3%
mul0-lft85.3%
metadata-eval85.3%
distribute-rgt1-in85.3%
distribute-lft-out85.3%
distribute-rgt1-in85.3%
metadata-eval85.3%
mul0-lft85.3%
+-rgt-identity85.3%
unpow285.3%
unpow285.3%
difference-of-squares88.3%
associate-/l*99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 66.3%
unpow266.3%
associate-/l*73.2%
Simplified73.2%
if 1.06e86 < z Initial program 56.3%
Taylor expanded in x around 0 55.0%
unpow255.0%
unpow255.0%
div-sub55.0%
associate-/l*62.5%
*-inverses62.5%
/-rgt-identity62.5%
associate-/l*80.4%
Simplified80.4%
Final simplification74.7%
(FPCore (x y z) :precision binary64 (if (<= x 4.5e+77) (* 0.5 y) (* 0.5 (* x (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 4.5e+77) {
tmp = 0.5 * y;
} else {
tmp = 0.5 * (x * (x / y));
}
return tmp;
}
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.5d+77) then
tmp = 0.5d0 * y
else
tmp = 0.5d0 * (x * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4.5e+77) {
tmp = 0.5 * y;
} else {
tmp = 0.5 * (x * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4.5e+77: tmp = 0.5 * y else: tmp = 0.5 * (x * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4.5e+77) tmp = Float64(0.5 * y); else tmp = Float64(0.5 * Float64(x * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4.5e+77) tmp = 0.5 * y; else tmp = 0.5 * (x * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4.5e+77], N[(0.5 * y), $MachinePrecision], N[(0.5 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{+77}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\
\end{array}
\end{array}
if x < 4.50000000000000024e77Initial program 70.0%
Taylor expanded in y around inf 33.9%
if 4.50000000000000024e77 < x Initial program 57.1%
Taylor expanded in x around inf 56.9%
unpow256.9%
associate-/l*62.9%
Simplified62.9%
associate-/r/63.0%
Applied egg-rr63.0%
Final simplification39.6%
(FPCore (x y z) :precision binary64 (* 0.5 y))
double code(double x, double y, double z) {
return 0.5 * y;
}
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
public static double code(double x, double y, double z) {
return 0.5 * y;
}
def code(x, y, z): return 0.5 * y
function code(x, y, z) return Float64(0.5 * y) end
function tmp = code(x, y, z) tmp = 0.5 * y; end
code[x_, y_, z_] := N[(0.5 * y), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot y
\end{array}
Initial program 67.5%
Taylor expanded in y around inf 30.5%
Final simplification30.5%
(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 2023297
(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)))