Math FPCore C Julia Wolfram TeX \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
\]
↓
\[\begin{array}{l}
t_0 := \frac{\frac{\mathsf{fma}\left(a, c, d \cdot b\right)}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\
\mathbf{if}\;c \leq -2.7673013263796686 \cdot 10^{+116}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -8.271532338194581 \cdot 10^{-74}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 10^{-240}:\\
\;\;\;\;\frac{b}{d} + \frac{c}{\frac{d}{\frac{a}{d}}}\\
\mathbf{elif}\;c \leq 6.525239025109652 \cdot 10^{+54}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
(FPCore (a b c d)
:precision binary64
(/ (+ (* a c) (* b d)) (+ (* c c) (* d d)))) ↓
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (/ (fma a c (* d b)) (hypot c d)) (hypot c d)))
(t_1 (+ (/ a c) (* (/ d c) (/ b c)))))
(if (<= c -2.7673013263796686e+116)
t_1
(if (<= c -8.271532338194581e-74)
t_0
(if (<= c 1e-240)
(+ (/ b d) (/ c (/ d (/ a d))))
(if (<= c 6.525239025109652e+54) t_0 t_1)))))) double code(double a, double b, double c, double d) {
return ((a * c) + (b * d)) / ((c * c) + (d * d));
}
↓
double code(double a, double b, double c, double d) {
double t_0 = (fma(a, c, (d * b)) / hypot(c, d)) / hypot(c, d);
double t_1 = (a / c) + ((d / c) * (b / c));
double tmp;
if (c <= -2.7673013263796686e+116) {
tmp = t_1;
} else if (c <= -8.271532338194581e-74) {
tmp = t_0;
} else if (c <= 1e-240) {
tmp = (b / d) + (c / (d / (a / d)));
} else if (c <= 6.525239025109652e+54) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(a, b, c, d)
return Float64(Float64(Float64(a * c) + Float64(b * d)) / Float64(Float64(c * c) + Float64(d * d)))
end
↓
function code(a, b, c, d)
t_0 = Float64(Float64(fma(a, c, Float64(d * b)) / hypot(c, d)) / hypot(c, d))
t_1 = Float64(Float64(a / c) + Float64(Float64(d / c) * Float64(b / c)))
tmp = 0.0
if (c <= -2.7673013263796686e+116)
tmp = t_1;
elseif (c <= -8.271532338194581e-74)
tmp = t_0;
elseif (c <= 1e-240)
tmp = Float64(Float64(b / d) + Float64(c / Float64(d / Float64(a / d))));
elseif (c <= 6.525239025109652e+54)
tmp = t_0;
else
tmp = t_1;
end
return tmp
end
code[a_, b_, c_, d_] := N[(N[(N[(a * c), $MachinePrecision] + N[(b * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
↓
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(a * c + N[(d * b), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a / c), $MachinePrecision] + N[(N[(d / c), $MachinePrecision] * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.7673013263796686e+116], t$95$1, If[LessEqual[c, -8.271532338194581e-74], t$95$0, If[LessEqual[c, 1e-240], N[(N[(b / d), $MachinePrecision] + N[(c / N[(d / N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 6.525239025109652e+54], t$95$0, t$95$1]]]]]]
\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
↓
\begin{array}{l}
t_0 := \frac{\frac{\mathsf{fma}\left(a, c, d \cdot b\right)}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\
\mathbf{if}\;c \leq -2.7673013263796686 \cdot 10^{+116}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -8.271532338194581 \cdot 10^{-74}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 10^{-240}:\\
\;\;\;\;\frac{b}{d} + \frac{c}{\frac{d}{\frac{a}{d}}}\\
\mathbf{elif}\;c \leq 6.525239025109652 \cdot 10^{+54}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
Alternatives Alternative 1 Error 21.1 Cost 1496
\[\begin{array}{l}
t_0 := \frac{b}{d} + \frac{\frac{c}{d}}{\frac{d}{a}}\\
\mathbf{if}\;c \leq -4.7413158013113923 \cdot 10^{+42}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq 2.9 \cdot 10^{-124}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 8.106500627277879 \cdot 10^{-76}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq 168042824510737.88:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 6.060970290553637 \cdot 10^{+134}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq 6.634909662165788 \cdot 10^{+188}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 2 Error 22.1 Cost 1496
\[\begin{array}{l}
t_0 := \frac{b}{d} + \frac{\frac{c}{d}}{\frac{d}{a}}\\
\mathbf{if}\;c \leq -4.7413158013113923 \cdot 10^{+42}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq 2.9 \cdot 10^{-124}:\\
\;\;\;\;\frac{b}{d} + \frac{c}{\frac{d}{\frac{a}{d}}}\\
\mathbf{elif}\;c \leq 8.106500627277879 \cdot 10^{-76}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq 168042824510737.88:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 6.060970290553637 \cdot 10^{+134}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq 6.634909662165788 \cdot 10^{+188}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 3 Error 13.3 Cost 1488
\[\begin{array}{l}
t_0 := \frac{d \cdot b + c \cdot a}{c \cdot c + d \cdot d}\\
t_1 := \frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\
\mathbf{if}\;c \leq -2.7673013263796686 \cdot 10^{+116}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -8.271532338194581 \cdot 10^{-74}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 10^{-140}:\\
\;\;\;\;\frac{b}{d} + \frac{c}{\frac{d}{\frac{a}{d}}}\\
\mathbf{elif}\;c \leq 6.525239025109652 \cdot 10^{+54}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 4 Error 15.9 Cost 968
\[\begin{array}{l}
\mathbf{if}\;d \leq -1307311938.091909:\\
\;\;\;\;\frac{b}{d} + \frac{\frac{c}{d}}{\frac{d}{a}}\\
\mathbf{elif}\;d \leq 1.224898047879664 \cdot 10^{+33}:\\
\;\;\;\;\frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{d} + \frac{c}{\frac{d}{\frac{a}{d}}}\\
\end{array}
\]
Alternative 5 Error 23.9 Cost 720
\[\begin{array}{l}
\mathbf{if}\;d \leq -1307311938.091909:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;d \leq 1.224898047879664 \cdot 10^{+33}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;d \leq 2.683623825811258 \cdot 10^{+89}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;d \leq 1.5129465991589888 \cdot 10^{+142}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{d}\\
\end{array}
\]
Alternative 6 Error 59.0 Cost 192
\[\frac{a}{d}
\]
Alternative 7 Error 37.3 Cost 192
\[\frac{b}{d}
\]