Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\]
↓
\[0.5 \cdot \left(y + \frac{x - z}{y} \cdot \left(x + z\right)\right)
\]
(FPCore (x y z)
:precision binary64
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0))) ↓
(FPCore (x y z) :precision binary64 (* 0.5 (+ y (* (/ (- x z) y) (+ x z))))) double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
↓
double code(double x, double y, double z) {
return 0.5 * (y + (((x - z) / 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 = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end 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 + (((x - z) / y) * (x + z)))
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
↓
public static double code(double x, double y, double z) {
return 0.5 * (y + (((x - z) / y) * (x + z)));
}
def code(x, y, z):
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
↓
def code(x, y, z):
return 0.5 * (y + (((x - z) / y) * (x + z)))
function code(x, y, z)
return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0))
end
↓
function code(x, y, z)
return Float64(0.5 * Float64(y + Float64(Float64(Float64(x - z) / y) * Float64(x + z))))
end
function tmp = code(x, y, z)
tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
end
↓
function tmp = code(x, y, z)
tmp = 0.5 * (y + (((x - z) / y) * (x + z)));
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]
↓
code[x_, y_, z_] := N[(0.5 * N[(y + N[(N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision] * N[(x + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
↓
0.5 \cdot \left(y + \frac{x - z}{y} \cdot \left(x + z\right)\right)
Alternatives Alternative 1 Error 22.9 Cost 1108
\[\begin{array}{l}
t_0 := \frac{0.5 \cdot x}{y} \cdot x\\
t_1 := \frac{-0.5 \cdot z}{y} \cdot z\\
\mathbf{if}\;y \leq -290000:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -1.3 \cdot 10^{-64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -7.5 \cdot 10^{-203}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{-192}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-87}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\]
Alternative 2 Error 22.9 Cost 1108
\[\begin{array}{l}
t_0 := \frac{0.5 \cdot x}{y} \cdot x\\
\mathbf{if}\;y \leq -290000:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -2 \cdot 10^{-68}:\\
\;\;\;\;\frac{0.5}{y} \cdot \left(-z \cdot z\right)\\
\mathbf{elif}\;y \leq -2.45 \cdot 10^{-183}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-190}:\\
\;\;\;\;\frac{-0.5 \cdot z}{y} \cdot z\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-86}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\]
Alternative 3 Error 15.3 Cost 1104
\[\begin{array}{l}
t_0 := 0.5 \cdot \left(y + \frac{x}{y} \cdot x\right)\\
\mathbf{if}\;y \leq -3300000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -2.4 \cdot 10^{-63}:\\
\;\;\;\;\frac{0.5}{y} \cdot \left(-z \cdot z\right)\\
\mathbf{elif}\;y \leq -2.75 \cdot 10^{-218}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{-280}:\\
\;\;\;\;\frac{-0.5 \cdot z}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 4 Error 22.9 Cost 976
\[\begin{array}{l}
t_0 := \frac{-0.5 \cdot z}{y} \cdot z\\
\mathbf{if}\;y \leq -290000:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-193}:\\
\;\;\;\;\frac{0.5}{y} \cdot \left(x \cdot x\right)\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-98}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\]
Alternative 5 Error 6.9 Cost 900
\[\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-177}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{-z}{y} \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x}{y} \cdot x\right)\\
\end{array}
\]
Alternative 6 Error 23.4 Cost 712
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{-70}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{-97}:\\
\;\;\;\;\frac{0.5}{y} \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\]
Alternative 7 Error 27.2 Cost 192
\[y \cdot 0.5
\]