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(\frac{z - x}{\frac{y}{z + x}} - 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) (/ y (+ z x))) 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) / (y / (z + x))) - 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) / (y / (z + x))) - 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) / (y / (z + x))) - 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) / (y / (z + x))) - 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(y / Float64(z + x))) - 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) / (y / (z + x))) - 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[(y / N[(z + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] * -0.5), $MachinePrecision]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
↓
\left(\frac{z - x}{\frac{y}{z + x}} - y\right) \cdot -0.5
Alternatives Alternative 1 Accuracy 75.3% Cost 2137
\[\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot \frac{0.5}{y}\\
t_1 := -0.5 \cdot \left(z \cdot \frac{z}{y} - y\right)\\
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+36}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 10^{+89}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+136}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+203} \lor \neg \left(x \cdot x \leq 4 \cdot 10^{+263}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 2 Accuracy 75.3% Cost 2136
\[\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot \frac{0.5}{y}\\
t_1 := -0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+36}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 10^{+89}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+136}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+203}:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y} - y\right)\\
\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+263}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 3 Accuracy 87.4% Cost 1357
\[\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{-251}:\\
\;\;\;\;-0.5 \cdot \left(\frac{z}{\frac{y}{z}} - y\right)\\
\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-90} \lor \neg \left(x \cdot x \leq 2 \cdot 10^{+16}\right):\\
\;\;\;\;0.5 \cdot \left(y + x \cdot \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y} - y\right)\\
\end{array}
\]
Alternative 4 Accuracy 63.3% Cost 976
\[\begin{array}{l}
t_0 := x \cdot \frac{x}{y \cdot 2}\\
\mathbf{if}\;y \leq -5.7 \cdot 10^{-7}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -1.5 \cdot 10^{-138}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -5.2 \cdot 10^{-186}:\\
\;\;\;\;z \cdot \frac{-0.5}{\frac{y}{z}}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-106}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\]
Alternative 5 Accuracy 63.4% Cost 976
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-7}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-139}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\
\mathbf{elif}\;y \leq -9.2 \cdot 10^{-186}:\\
\;\;\;\;z \cdot \frac{-0.5}{\frac{y}{z}}\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{-106}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\]
Alternative 6 Accuracy 63.2% Cost 976
\[\begin{array}{l}
\mathbf{if}\;y \leq -0.055:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -7 \cdot 10^{-138}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot 2}\\
\mathbf{elif}\;y \leq -2.15 \cdot 10^{-182}:\\
\;\;\;\;-0.5 \cdot \frac{z \cdot z}{y}\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{-106}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\]
Alternative 7 Accuracy 63.0% Cost 844
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-7}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{-138}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{0.5}{y}\\
\mathbf{elif}\;y \leq 8.1 \cdot 10^{-106}:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\]
Alternative 8 Accuracy 99.8% Cost 832
\[-0.5 \cdot \left(\frac{z - x}{y} \cdot \left(z + x\right) - y\right)
\]
Alternative 9 Accuracy 63.3% Cost 713
\[\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{-78} \lor \neg \left(y \leq 6.7 \cdot 10^{-106}\right):\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\
\end{array}
\]
Alternative 10 Accuracy 63.3% Cost 713
\[\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-77} \lor \neg \left(y \leq 7.7 \cdot 10^{-106}\right):\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-0.5}{\frac{y}{z}}\\
\end{array}
\]
Alternative 11 Accuracy 63.4% Cost 713
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{-78} \lor \neg \left(y \leq 8.6 \cdot 10^{-106}\right):\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\
\end{array}
\]
Alternative 12 Accuracy 56.9% Cost 192
\[y \cdot 0.5
\]