Math FPCore C Java Python Julia MATLAB Wolfram TeX \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\]
↓
\[\frac{c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)} - \frac{a}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}}{\mathsf{hypot}\left(c, d\right)}
\]
(FPCore (a b c d)
:precision binary64
(/ (- (* b c) (* a d)) (+ (* c c) (* d d)))) ↓
(FPCore (a b c d)
:precision binary64
(/ (- (* c (/ b (hypot c d))) (/ a (/ (hypot c d) d))) (hypot c d))) double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
↓
double code(double a, double b, double c, double d) {
return ((c * (b / hypot(c, d))) - (a / (hypot(c, d) / d))) / hypot(c, d);
}
public static double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
↓
public static double code(double a, double b, double c, double d) {
return ((c * (b / Math.hypot(c, d))) - (a / (Math.hypot(c, d) / d))) / Math.hypot(c, d);
}
def code(a, b, c, d):
return ((b * c) - (a * d)) / ((c * c) + (d * d))
↓
def code(a, b, c, d):
return ((c * (b / math.hypot(c, d))) - (a / (math.hypot(c, d) / d))) / math.hypot(c, d)
function code(a, b, c, d)
return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d)))
end
↓
function code(a, b, c, d)
return Float64(Float64(Float64(c * Float64(b / hypot(c, d))) - Float64(a / Float64(hypot(c, d) / d))) / hypot(c, d))
end
function tmp = code(a, b, c, d)
tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
end
↓
function tmp = code(a, b, c, d)
tmp = ((c * (b / hypot(c, d))) - (a / (hypot(c, d) / d))) / hypot(c, d);
end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
↓
code[a_, b_, c_, d_] := N[(N[(N[(c * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
↓
\frac{c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)} - \frac{a}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}}{\mathsf{hypot}\left(c, d\right)}
Alternatives Alternative 1 Error 0.8 Cost 20224
\[\frac{c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)} - a \cdot \frac{d}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}
\]
Alternative 2 Error 6.7 Cost 15881
\[\begin{array}{l}
t_0 := \frac{b \cdot c - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 5 \cdot 10^{+296}\right):\\
\;\;\;\;\frac{b - a \cdot \frac{d}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(d \cdot a - b \cdot c\right)}{-\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 3 Error 6.7 Cost 15817
\[\begin{array}{l}
t_0 := b \cdot c - d \cdot a\\
t_1 := \frac{t_0}{c \cdot c + d \cdot d}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{+296}\right):\\
\;\;\;\;\frac{b - a \cdot \frac{d}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 4 Error 5.5 Cost 14672
\[\begin{array}{l}
t_0 := \frac{d}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{b}{\frac{c \cdot c + d \cdot d}{c}} - t_0 \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;c \leq -1.02 \cdot 10^{+129}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{elif}\;c \leq -6.2 \cdot 10^{-182}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 1.1 \cdot 10^{-165}:\\
\;\;\;\;\frac{1}{d} \cdot \left(b \cdot \frac{c}{d} - a\right)\\
\mathbf{elif}\;c \leq 3.35 \cdot 10^{+69}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot t_0}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 5 Error 5.4 Cost 14672
\[\begin{array}{l}
t_0 := \frac{b}{\frac{c \cdot c + d \cdot d}{c}}\\
t_1 := \frac{d}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;c \leq -1.02 \cdot 10^{+129}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{elif}\;c \leq -8.2 \cdot 10^{-136}:\\
\;\;\;\;t_0 + \frac{a}{\frac{\mathsf{hypot}\left(c, d\right)}{d}} \cdot \frac{-1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;c \leq 1.62 \cdot 10^{-165}:\\
\;\;\;\;\frac{1}{d} \cdot \left(b \cdot \frac{c}{d} - a\right)\\
\mathbf{elif}\;c \leq 3.35 \cdot 10^{+69}:\\
\;\;\;\;t_0 - t_1 \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot t_1}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 6 Error 10.3 Cost 13900
\[\begin{array}{l}
t_0 := c \cdot c + d \cdot d\\
\mathbf{if}\;c \leq -7 \cdot 10^{+125}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c} \cdot \frac{a}{c}\\
\mathbf{elif}\;c \leq -1.8 \cdot 10^{-114}:\\
\;\;\;\;\frac{b}{\frac{t_0}{c}} - \frac{d \cdot a}{t_0}\\
\mathbf{elif}\;c \leq 8.2 \cdot 10^{-79}:\\
\;\;\;\;\frac{1}{d} \cdot \left(b \cdot \frac{c}{d} - a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 7 Error 10.6 Cost 7568
\[\begin{array}{l}
t_0 := c \cdot c + d \cdot d\\
t_1 := \frac{b}{\frac{t_0}{c}} - \frac{d \cdot a}{t_0}\\
\mathbf{if}\;d \leq -3.5 \cdot 10^{+90}:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{elif}\;d \leq -1.45 \cdot 10^{-82}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 5 \cdot 10^{-159}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{elif}\;d \leq 3.1 \cdot 10^{+66}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{c}{\frac{d}{b}} - a}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 8 Error 10.8 Cost 2000
\[\begin{array}{l}
t_0 := c \cdot c + d \cdot d\\
t_1 := \frac{b}{\frac{t_0}{c}} - \frac{d \cdot a}{t_0}\\
t_2 := \frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{if}\;d \leq -1.66 \cdot 10^{+96}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq -2.2 \cdot 10^{-80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-159}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{elif}\;d \leq 1.05 \cdot 10^{+68}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 9 Error 12.7 Cost 1488
\[\begin{array}{l}
t_0 := \frac{b \cdot c - d \cdot a}{c \cdot c + d \cdot d}\\
t_1 := \frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{if}\;d \leq -1.5 \cdot 10^{+99}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -3.4 \cdot 10^{-77}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 4.3 \cdot 10^{-74}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{elif}\;d \leq 1.06 \cdot 10^{-11}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 10^{+20}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 10 Error 15.0 Cost 1032
\[\begin{array}{l}
t_0 := \frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{if}\;d \leq -5.4 \cdot 10^{+87}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1.7 \cdot 10^{-35}:\\
\;\;\;\;\frac{-d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;d \leq 3 \cdot 10^{+20}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 11 Error 19.1 Cost 841
\[\begin{array}{l}
\mathbf{if}\;d \leq -1.85 \cdot 10^{-35} \lor \neg \left(d \leq 1.06 \cdot 10^{+20}\right):\\
\;\;\;\;-\frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\end{array}
\]
Alternative 12 Error 14.7 Cost 841
\[\begin{array}{l}
\mathbf{if}\;d \leq -1.4 \cdot 10^{-23} \lor \neg \left(d \leq 3.6 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\end{array}
\]
Alternative 13 Error 24.3 Cost 520
\[\begin{array}{l}
\mathbf{if}\;c \leq -9 \cdot 10^{-52}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 1.1 \cdot 10^{+113}:\\
\;\;\;\;-\frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 14 Error 37.0 Cost 324
\[\begin{array}{l}
\mathbf{if}\;d \leq -4 \cdot 10^{+136}:\\
\;\;\;\;\frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 15 Error 56.9 Cost 192
\[\frac{a}{d}
\]