Math FPCore C Julia Wolfram TeX \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\]
↓
\[\begin{array}{l}
t_0 := \frac{c}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{b}{\mathsf{hypot}\left(c, d\right)}\\
t_2 := \mathsf{fma}\left(t_0, t_1, \frac{-a}{d}\right)\\
\mathbf{if}\;d \leq -2.765891584532292 \cdot 10^{+76}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq 1.3579662715200553 \cdot 10^{+98}:\\
\;\;\;\;\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}:\\
\;\;\;\;t_2\\
\end{array}
\]
(FPCore (a b c d)
:precision binary64
(/ (- (* b c) (* a d)) (+ (* c c) (* d d)))) ↓
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ c (hypot c d)))
(t_1 (/ b (hypot c d)))
(t_2 (fma t_0 t_1 (/ (- a) d))))
(if (<= d -2.765891584532292e+76)
t_2
(if (<= d 1.3579662715200553e+98)
(fma t_0 t_1 (/ (* d (- a)) (pow (hypot c d) 2.0)))
t_2)))) 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) {
double t_0 = c / hypot(c, d);
double t_1 = b / hypot(c, d);
double t_2 = fma(t_0, t_1, (-a / d));
double tmp;
if (d <= -2.765891584532292e+76) {
tmp = t_2;
} else if (d <= 1.3579662715200553e+98) {
tmp = fma(t_0, t_1, ((d * -a) / pow(hypot(c, d), 2.0)));
} else {
tmp = t_2;
}
return tmp;
}
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)
t_0 = Float64(c / hypot(c, d))
t_1 = Float64(b / hypot(c, d))
t_2 = fma(t_0, t_1, Float64(Float64(-a) / d))
tmp = 0.0
if (d <= -2.765891584532292e+76)
tmp = t_2;
elseif (d <= 1.3579662715200553e+98)
tmp = fma(t_0, t_1, Float64(Float64(d * Float64(-a)) / (hypot(c, d) ^ 2.0)));
else
tmp = t_2;
end
return tmp
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_] := Block[{t$95$0 = N[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1 + N[((-a) / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.765891584532292e+76], t$95$2, If[LessEqual[d, 1.3579662715200553e+98], N[(t$95$0 * t$95$1 + N[(N[(d * (-a)), $MachinePrecision] / N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
↓
\begin{array}{l}
t_0 := \frac{c}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{b}{\mathsf{hypot}\left(c, d\right)}\\
t_2 := \mathsf{fma}\left(t_0, t_1, \frac{-a}{d}\right)\\
\mathbf{if}\;d \leq -2.765891584532292 \cdot 10^{+76}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq 1.3579662715200553 \cdot 10^{+98}:\\
\;\;\;\;\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}:\\
\;\;\;\;t_2\\
\end{array}
Alternatives Alternative 1 Error 6.6 Cost 22024
\[\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-a}{d}\right)\\
t_1 := c \cdot b - d \cdot a\\
t_2 := \frac{t_1}{c \cdot c + d \cdot d}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+268}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 2 Error 10.3 Cost 14288
\[\begin{array}{l}
t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;d \leq -8.515586876420877 \cdot 10^{+72}:\\
\;\;\;\;\frac{b}{d} \cdot \frac{c}{d} - \frac{a}{d}\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-128}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 10^{-210}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;d \leq 1.3579662715200553 \cdot 10^{+98}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{b}{d}}{\frac{d}{c}} - \frac{a}{d}\\
\end{array}
\]
Alternative 3 Error 15.9 Cost 1628
\[\begin{array}{l}
t_0 := \frac{b \cdot \frac{c}{d} - a}{d}\\
t_1 := \frac{b - a \cdot \frac{d}{c}}{c}\\
t_2 := \frac{c \cdot b}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -5.141091477822407 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 2.0751177407278352 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 5.5753156676145865 \cdot 10^{-40}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq 224611782627.78482:\\
\;\;\;\;\frac{\frac{b}{d}}{\frac{d}{c}} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 1.461643935036261 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 5.231201427481236 \cdot 10^{+110}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.845256899382351 \cdot 10^{+130}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c} \cdot \frac{a}{c}\\
\end{array}
\]
Alternative 4 Error 16.0 Cost 1628
\[\begin{array}{l}
t_0 := \frac{b \cdot \frac{c}{d} - a}{d}\\
t_1 := \frac{b}{c} - d \cdot \frac{\frac{a}{c}}{c}\\
t_2 := \frac{c \cdot b}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -5.141091477822407 \cdot 10^{-17}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq 2.0751177407278352 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 5.5753156676145865 \cdot 10^{-40}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq 224611782627.78482:\\
\;\;\;\;\frac{\frac{b}{d}}{\frac{d}{c}} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 1.461643935036261 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 5.231201427481236 \cdot 10^{+110}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 9.799499218022913 \cdot 10^{+128}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 5 Error 19.8 Cost 1104
\[\begin{array}{l}
t_0 := \frac{-a}{d}\\
t_1 := \frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{if}\;c \leq -5.141091477822407 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -5 \cdot 10^{-270}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -1.16 \cdot 10^{-293}:\\
\;\;\;\;\frac{b}{d \cdot \frac{d}{c}}\\
\mathbf{elif}\;c \leq 2.0751177407278352 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 6 Error 15.6 Cost 968
\[\begin{array}{l}
\mathbf{if}\;c \leq -5.141091477822407 \cdot 10^{-17}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq 2.0751177407278352 \cdot 10^{-64}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c} \cdot \frac{a}{c}\\
\end{array}
\]
Alternative 7 Error 24.2 Cost 844
\[\begin{array}{l}
t_0 := \frac{-a}{d}\\
\mathbf{if}\;c \leq -5.141091477822407 \cdot 10^{-17}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq -5 \cdot 10^{-270}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -1.16 \cdot 10^{-293}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d}}{d}\\
\mathbf{elif}\;c \leq 2.0751177407278352 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 8 Error 24.2 Cost 844
\[\begin{array}{l}
t_0 := \frac{-a}{d}\\
\mathbf{if}\;c \leq -5.141091477822407 \cdot 10^{-17}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq -5 \cdot 10^{-270}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -1.16 \cdot 10^{-293}:\\
\;\;\;\;\frac{b}{d \cdot \frac{d}{c}}\\
\mathbf{elif}\;c \leq 2.0751177407278352 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 9 Error 15.5 Cost 840
\[\begin{array}{l}
t_0 := \frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{if}\;c \leq -5.141091477822407 \cdot 10^{-17}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 2.0751177407278352 \cdot 10^{-64}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 10 Error 15.4 Cost 840
\[\begin{array}{l}
\mathbf{if}\;c \leq -5.141091477822407 \cdot 10^{-17}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq 2.0751177407278352 \cdot 10^{-64}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\end{array}
\]
Alternative 11 Error 23.7 Cost 520
\[\begin{array}{l}
\mathbf{if}\;c \leq -5.141091477822407 \cdot 10^{-17}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 2.0751177407278352 \cdot 10^{-64}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 12 Error 37.3 Cost 192
\[\frac{b}{c}
\]