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{\frac{-d}{\frac{\mathsf{hypot}\left(d, c\right)}{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(Float64(-d) / Float64(hypot(d, c) / 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[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / N[Sqrt[d ^ 2 + c ^ 2], $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{\frac{-d}{\frac{\mathsf{hypot}\left(d, c\right)}{a}}}{\mathsf{hypot}\left(d, c\right)}\right)
Alternatives Alternative 1 Error 7.9 Cost 33288
\[\begin{array}{l}
t_0 := \frac{c}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{b}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;d \leq -122006031482371650:\\
\;\;\;\;\mathsf{fma}\left(t_0, t_1, \frac{a}{\mathsf{hypot}\left(d, c\right)}\right)\\
\mathbf{elif}\;d \leq 7.395863073945087 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(t_0, t_1, \frac{d \cdot \left(-a\right)}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\end{array}
\]
Alternative 2 Error 8.9 Cost 26500
\[\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 -8941568.424361361:\\
\;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{a}{\mathsf{hypot}\left(d, c\right)}\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-180}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 10^{-160}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c \cdot \frac{c}{d}}\\
\mathbf{elif}\;d \leq 1.5586786786398142 \cdot 10^{+46}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\end{array}
\]
Alternative 3 Error 10.7 Cost 14160
\[\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 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{if}\;d \leq -4.348610485428097 \cdot 10^{+35}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-180}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 10^{-160}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c \cdot \frac{c}{d}}\\
\mathbf{elif}\;d \leq 1.5586786786398142 \cdot 10^{+46}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 4 Error 12.4 Cost 13832
\[\begin{array}{l}
t_0 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{if}\;d \leq -122006031482371650:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-160}:\\
\;\;\;\;\frac{\mathsf{fma}\left(d, -a, c \cdot b\right)}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\
\mathbf{elif}\;d \leq 7 \cdot 10^{-133}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot \frac{-d}{c}, \frac{1}{c}, \frac{b}{c}\right)\\
\mathbf{elif}\;d \leq 1.5586786786398142 \cdot 10^{+46}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{d \cdot d + c \cdot c}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 5 Error 12.4 Cost 7824
\[\begin{array}{l}
t_0 := d \cdot d + c \cdot c\\
t_1 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{if}\;d \leq -122006031482371650:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-160}:\\
\;\;\;\;\frac{c \cdot b - d \cdot a}{t_0}\\
\mathbf{elif}\;d \leq 7 \cdot 10^{-133}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot \frac{-d}{c}, \frac{1}{c}, \frac{b}{c}\right)\\
\mathbf{elif}\;d \leq 1.5586786786398142 \cdot 10^{+46}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 6 Error 12.4 Cost 7564
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{d \cdot d + c \cdot c}\\
t_1 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{if}\;d \leq -122006031482371650:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-160}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 7 \cdot 10^{-133}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot \frac{-d}{c}, \frac{1}{c}, \frac{b}{c}\right)\\
\mathbf{elif}\;d \leq 1.5586786786398142 \cdot 10^{+46}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 7 Error 17.0 Cost 1496
\[\begin{array}{l}
t_0 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{if}\;d \leq -122006031482371650:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -4.1758521565422204 \cdot 10^{-48}:\\
\;\;\;\;\frac{d \cdot \left(-a\right)}{d \cdot d + c \cdot c}\\
\mathbf{elif}\;d \leq -1.998814742675197 \cdot 10^{-75}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -4.6 \cdot 10^{-135}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c} \cdot \frac{a}{c}\\
\mathbf{elif}\;d \leq -1.8 \cdot 10^{-162}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{elif}\;d \leq 7.605581508364986 \cdot 10^{-74}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c \cdot \frac{c}{d}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 8 Error 12.6 Cost 1488
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{d \cdot d + c \cdot c}\\
t_1 := \frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{if}\;d \leq -122006031482371650:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-160}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 7 \cdot 10^{-133}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c \cdot \frac{c}{d}}\\
\mathbf{elif}\;d \leq 1.5586786786398142 \cdot 10^{+46}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 9 Error 16.3 Cost 1232
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.2088374622742729 \cdot 10^{+45}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c \cdot \frac{c}{a}}\\
\mathbf{elif}\;c \leq 3.337487325098142 \cdot 10^{-58}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{elif}\;c \leq 7.916160279112307 \cdot 10^{+49}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c \cdot \frac{c}{d}}\\
\mathbf{elif}\;c \leq 4.9522731660807546 \cdot 10^{+101}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\end{array}
\]
Alternative 10 Error 16.3 Cost 1232
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.2088374622742729 \cdot 10^{+45}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c \cdot \frac{c}{a}}\\
\mathbf{elif}\;c \leq 3.337487325098142 \cdot 10^{-58}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{elif}\;c \leq 7.916160279112307 \cdot 10^{+49}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c \cdot \frac{c}{d}}\\
\mathbf{elif}\;c \leq 4.9522731660807546 \cdot 10^{+101}:\\
\;\;\;\;c \cdot \frac{\frac{b}{d}}{d} - \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\end{array}
\]
Alternative 11 Error 20.1 Cost 1104
\[\begin{array}{l}
t_0 := \frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{if}\;c \leq -1.2088374622742729 \cdot 10^{+45}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 3.337487325098142 \cdot 10^{-58}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 2.6689993466329684 \cdot 10^{-5}:\\
\;\;\;\;\frac{d \cdot \left(-a\right)}{c \cdot c}\\
\mathbf{elif}\;c \leq 627949049897513100:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.151460632922877 \cdot 10^{+60}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 1.65 \cdot 10^{+106}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 12 Error 16.0 Cost 1104
\[\begin{array}{l}
t_0 := \frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{if}\;c \leq -1.2088374622742729 \cdot 10^{+45}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 6.555413221717854 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{elif}\;c \leq 1.151460632922877 \cdot 10^{+60}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 4.9522731660807546 \cdot 10^{+101}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 13 Error 16.2 Cost 1104
\[\begin{array}{l}
t_0 := \frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{if}\;c \leq -1.2088374622742729 \cdot 10^{+45}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 3.337487325098142 \cdot 10^{-58}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{elif}\;c \leq 1.151460632922877 \cdot 10^{+60}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c \cdot \frac{c}{d}}\\
\mathbf{elif}\;c \leq 4.9522731660807546 \cdot 10^{+101}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 14 Error 16.5 Cost 1104
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.2088374622742729 \cdot 10^{+45}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c \cdot \frac{c}{a}}\\
\mathbf{elif}\;c \leq 3.337487325098142 \cdot 10^{-58}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{elif}\;c \leq 1.151460632922877 \cdot 10^{+60}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c \cdot \frac{c}{d}}\\
\mathbf{elif}\;c \leq 4.9522731660807546 \cdot 10^{+101}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\end{array}
\]
Alternative 15 Error 24.3 Cost 916
\[\begin{array}{l}
t_0 := \frac{-a}{d}\\
\mathbf{if}\;c \leq -1.2088374622742729 \cdot 10^{+45}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 3.337487325098142 \cdot 10^{-58}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 2.6689993466329684 \cdot 10^{-5}:\\
\;\;\;\;\frac{d \cdot \left(-a\right)}{c \cdot c}\\
\mathbf{elif}\;c \leq 1.151460632922877 \cdot 10^{+60}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 1.65 \cdot 10^{+106}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 16 Error 23.8 Cost 784
\[\begin{array}{l}
t_0 := \frac{-a}{d}\\
\mathbf{if}\;c \leq -1.2088374622742729 \cdot 10^{+45}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 3.337487325098142 \cdot 10^{-58}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.151460632922877 \cdot 10^{+60}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 1.65 \cdot 10^{+106}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 17 Error 37.4 Cost 192
\[\frac{b}{c}
\]