Math FPCore C Julia Wolfram TeX \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\]
↓
\[\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{d}{\mathsf{hypot}\left(d, c\right)} \cdot \frac{-a}{\mathsf{hypot}\left(d, c\right)}\right)
\]
(FPCore (a b c d)
:precision binary64
(/ (- (* b c) (* a d)) (+ (* c c) (* d d)))) ↓
(FPCore (a b c d)
:precision binary64
(fma
(/ c (hypot c d))
(/ b (hypot c d))
(* (/ d (hypot d c)) (/ (- a) (hypot d c))))) 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 fma((c / hypot(c, d)), (b / hypot(c, d)), ((d / hypot(d, c)) * (-a / hypot(d, c))));
}
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 fma(Float64(c / hypot(c, d)), Float64(b / hypot(c, d)), Float64(Float64(d / hypot(d, c)) * Float64(Float64(-a) / hypot(d, c))))
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[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] + N[(N[(d / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision] * N[((-a) / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
↓
\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{d}{\mathsf{hypot}\left(d, c\right)} \cdot \frac{-a}{\mathsf{hypot}\left(d, c\right)}\right)
Alternatives Alternative 1 Error 10.6 Cost 33552
\[\begin{array}{l}
t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\
t_1 := \frac{b}{c} - \frac{d}{c} \cdot \frac{a}{c}\\
\mathbf{if}\;c \leq -9.328439050051052 \cdot 10^{+150}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -1 \cdot 10^{-150}:\\
\;\;\;\;b \cdot \frac{c}{t_0} - a \cdot \frac{d}{t_0}\\
\mathbf{elif}\;c \leq 8.358364608016383 \cdot 10^{-5}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{elif}\;c \leq 7.524065297619922 \cdot 10^{+168}:\\
\;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{a \cdot \left(-d\right)}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)\\
\mathbf{elif}\;c \leq 1.0718376395457786 \cdot 10^{+195}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 4.109939024723472 \cdot 10^{+200}:\\
\;\;\;\;\frac{1}{\left(c \cdot \frac{c}{d}\right) \cdot \left(\frac{-1}{a} - \frac{b \cdot b}{{a}^{3}}\right) - \left(\frac{d}{a} + \frac{c}{a} \cdot \frac{b}{a}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 2 Error 1.6 Cost 33152
\[\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{\frac{-d}{\mathsf{hypot}\left(c, d\right)}}{\frac{\mathsf{hypot}\left(c, d\right)}{a}}\right)
\]
Alternative 3 Error 10.9 Cost 14808
\[\begin{array}{l}
t_0 := \frac{\frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \mathsf{fma}\left(c, c, d \cdot d\right)\\
\mathbf{if}\;d \leq -3.0435373335258623 \cdot 10^{+50}:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-195}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 10^{-190}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c \cdot \frac{c}{d}}\\
\mathbf{elif}\;d \leq 7.456499424371905 \cdot 10^{+28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 6.145696025654044 \cdot 10^{+93}:\\
\;\;\;\;\frac{c}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;d \leq 4.957626207730631 \cdot 10^{+104}:\\
\;\;\;\;c \cdot \frac{b}{t_1} - a \cdot \frac{d}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{c}{d}}{\frac{d}{b}} - \frac{a}{d}\\
\end{array}
\]
Alternative 4 Error 11.1 Cost 14296
\[\begin{array}{l}
t_0 := \frac{\frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;d \leq -3.0435373335258623 \cdot 10^{+50}:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-195}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 10^{-190}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c \cdot \frac{c}{d}}\\
\mathbf{elif}\;d \leq 7.456499424371905 \cdot 10^{+28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 6.145696025654044 \cdot 10^{+93}:\\
\;\;\;\;\frac{c}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;d \leq 9.637483085321208 \cdot 10^{+97}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{c}{d}}{\frac{d}{b}} - \frac{a}{d}\\
\end{array}
\]
Alternative 5 Error 12.4 Cost 1488
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
t_1 := \frac{b}{c} - \frac{d}{c} \cdot \frac{a}{c}\\
\mathbf{if}\;c \leq -4.149810530834531 \cdot 10^{+114}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -1 \cdot 10^{-150}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 8.358364608016383 \cdot 10^{-5}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{elif}\;c \leq 6.8607979028319614 \cdot 10^{+128}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 6 Error 14.9 Cost 968
\[\begin{array}{l}
t_0 := \frac{b}{c} - \frac{d}{c} \cdot \frac{a}{c}\\
\mathbf{if}\;c \leq -3.632484411105255 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 8.358364608016383 \cdot 10^{-5}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 7 Error 24.0 Cost 908
\[\begin{array}{l}
\mathbf{if}\;c \leq -5.52445799675944 \cdot 10^{-33}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 2.191442538112069 \cdot 10^{+47}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{elif}\;c \leq 6.010144942631681 \cdot 10^{+113}:\\
\;\;\;\;d \cdot \frac{-a}{c \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 8 Error 19.8 Cost 840
\[\begin{array}{l}
\mathbf{if}\;c \leq -4.275832477588358 \cdot 10^{+115}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 6.010144942631681 \cdot 10^{+113}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 9 Error 23.1 Cost 784
\[\begin{array}{l}
t_0 := \frac{-a}{d}\\
\mathbf{if}\;d \leq -9.834115852018582 \cdot 10^{+65}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 4.484683706448499 \cdot 10^{-9}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;d \leq 7.456499424371905 \cdot 10^{+28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 5.271506439197176 \cdot 10^{+68}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 10 Error 37.7 Cost 192
\[\frac{b}{c}
\]