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}
\]
↓
\[\left(\left(z - x\right) \cdot \frac{z + x}{y} - y\right) \cdot -0.5
\]
(FPCore (x y z)
:precision binary64
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0))) ↓
(FPCore (x y z) :precision binary64 (* (- (* (- z x) (/ (+ z x) y)) y) -0.5)) 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 (((z - x) * ((z + x) / y)) - y) * -0.5;
}
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 = (((z - x) * ((z + x) / y)) - y) * (-0.5d0)
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 (((z - x) * ((z + x) / y)) - y) * -0.5;
}
def code(x, y, z):
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
↓
def code(x, y, z):
return (((z - x) * ((z + x) / y)) - y) * -0.5
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(Float64(Float64(Float64(z - x) * Float64(Float64(z + x) / y)) - y) * -0.5)
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 = (((z - x) * ((z + x) / y)) - y) * -0.5;
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[(N[(N[(N[(z - x), $MachinePrecision] * N[(N[(z + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] * -0.5), $MachinePrecision]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
↓
\left(\left(z - x\right) \cdot \frac{z + x}{y} - y\right) \cdot -0.5
Alternatives Alternative 1 Accuracy 52.5% Cost 2396
\[\begin{array}{l}
t_0 := \frac{-0.5 \cdot \left(z \cdot z\right)}{y}\\
\mathbf{if}\;x \cdot x \leq 10^{-161}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-86}:\\
\;\;\;\;-0.5 \cdot \frac{z}{\frac{y}{z}}\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-55}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-41}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+46}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \cdot x \leq 10^{+139}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+181}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{2 \cdot \frac{y}{x}}\\
\end{array}
\]
Alternative 2 Accuracy 52.5% Cost 2268
\[\begin{array}{l}
t_0 := \frac{-0.5 \cdot \left(z \cdot z\right)}{y}\\
\mathbf{if}\;x \cdot x \leq 10^{-161}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-86}:\\
\;\;\;\;-0.5 \cdot \frac{z}{\frac{y}{z}}\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-55}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-41}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+46}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \cdot x \leq 10^{+139}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+181}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\end{array}
\]
Alternative 3 Accuracy 86.8% Cost 1485
\[\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-86}:\\
\;\;\;\;-0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+49} \lor \neg \left(x \cdot x \leq 10^{+139}\right):\\
\;\;\;\;-0.5 \cdot \left(\left(z - x\right) \cdot \frac{x}{y} - y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot x - z \cdot z}{y \cdot 2}\\
\end{array}
\]
Alternative 4 Accuracy 53.7% Cost 1372
\[\begin{array}{l}
t_0 := -0.5 \cdot \frac{z}{\frac{y}{z}}\\
\mathbf{if}\;x \leq -3.8 \cdot 10^{+21}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{elif}\;x \leq -1.15 \cdot 10^{-20}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{-79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-219}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-302}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+22}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{+70}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\
\end{array}
\]
Alternative 5 Accuracy 79.1% Cost 1356
\[\begin{array}{l}
t_0 := -0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-86}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-55}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\
\mathbf{elif}\;x \cdot x \leq 10^{+285}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{2 \cdot \frac{y}{x}}\\
\end{array}
\]
Alternative 6 Accuracy 80.0% Cost 1356
\[\begin{array}{l}
t_0 := -0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-86}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-55}:\\
\;\;\;\;-0.5 \cdot \left(\left(-y\right) - \frac{x \cdot x}{y}\right)\\
\mathbf{elif}\;x \cdot x \leq 10^{+285}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{2 \cdot \frac{y}{x}}\\
\end{array}
\]
Alternative 7 Accuracy 87.7% Cost 1232
\[\begin{array}{l}
t_0 := -0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\
t_1 := -0.5 \cdot \left(\left(z - x\right) \cdot \frac{x}{y} - y\right)\\
\mathbf{if}\;x \leq -2.85 \cdot 10^{+21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.8 \cdot 10^{-27}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-65}:\\
\;\;\;\;-0.5 \cdot \left(\left(-y\right) - \frac{x \cdot x}{y}\right)\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-30}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 8 Accuracy 53.7% Cost 713
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{+20} \lor \neg \left(x \leq 6.5 \cdot 10^{+32}\right):\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\]
Alternative 9 Accuracy 53.7% Cost 712
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.75 \cdot 10^{+20}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+34}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\
\end{array}
\]
Alternative 10 Accuracy 34.6% Cost 192
\[y \cdot 0.5
\]