Math FPCore C Java Python Julia MATLAB Wolfram TeX \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\]
↓
\[\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)} - \frac{d}{\mathsf{hypot}\left(c, d\right)} \cdot a\right)
\]
(FPCore (a b c d)
:precision binary64
(/ (- (* b c) (* a d)) (+ (* c c) (* d d)))) ↓
(FPCore (a b c d)
:precision binary64
(* (/ 1.0 (hypot c d)) (- (* c (/ b (hypot c d))) (* (/ d (hypot c d)) a)))) 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 (1.0 / hypot(c, d)) * ((c * (b / hypot(c, d))) - ((d / hypot(c, d)) * a));
}
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 (1.0 / Math.hypot(c, d)) * ((c * (b / Math.hypot(c, d))) - ((d / Math.hypot(c, d)) * a));
}
def code(a, b, c, d):
return ((b * c) - (a * d)) / ((c * c) + (d * d))
↓
def code(a, b, c, d):
return (1.0 / math.hypot(c, d)) * ((c * (b / math.hypot(c, d))) - ((d / math.hypot(c, d)) * a))
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(1.0 / hypot(c, d)) * Float64(Float64(c * Float64(b / hypot(c, d))) - Float64(Float64(d / hypot(c, d)) * a)))
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 = (1.0 / hypot(c, d)) * ((c * (b / hypot(c, d))) - ((d / hypot(c, d)) * a));
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[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(c * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(d / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
↓
\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)} - \frac{d}{\mathsf{hypot}\left(c, d\right)} \cdot a\right)
Alternatives Alternative 1 Error 1.5 Cost 20352
\[\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)} - d \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}\right)
\]
Alternative 2 Error 11.1 Cost 14160
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
t_1 := \frac{1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;c \leq -3.5 \cdot 10^{+46}:\\
\;\;\;\;t_1 \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\
\mathbf{elif}\;c \leq -4 \cdot 10^{-141}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 9.5 \cdot 10^{-148}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 1.12 \cdot 10^{-74}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(b - \frac{d}{\mathsf{hypot}\left(c, d\right)} \cdot a\right)\\
\end{array}
\]
Alternative 3 Error 11.1 Cost 14160
\[\begin{array}{l}
t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := c \cdot b - d \cdot a\\
\mathbf{if}\;c \leq -7.2 \cdot 10^{+48}:\\
\;\;\;\;t_0 \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\
\mathbf{elif}\;c \leq -1.35 \cdot 10^{-140}:\\
\;\;\;\;\frac{1}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}} \cdot t_1\\
\mathbf{elif}\;c \leq 2.3 \cdot 10^{-148}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 3.7 \cdot 10^{-75}:\\
\;\;\;\;\frac{t_1}{c \cdot c + d \cdot d}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(b - \frac{d}{\mathsf{hypot}\left(c, d\right)} \cdot a\right)\\
\end{array}
\]
Alternative 4 Error 9.6 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)}\\
\mathbf{if}\;c \leq -6.8 \cdot 10^{+156}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq -4.6 \cdot 10^{-141}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.18 \cdot 10^{-291}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 2 \cdot 10^{+96}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(b - \frac{d}{\mathsf{hypot}\left(c, d\right)} \cdot a\right)\\
\end{array}
\]
Alternative 5 Error 12.3 Cost 7632
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -8.5 \cdot 10^{+48}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq -1.65 \cdot 10^{-140}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 4 \cdot 10^{-151}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 1.9 \cdot 10^{+57}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{\frac{c}{d}} - b}{-\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 6 Error 12.2 Cost 7632
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
t_1 := \frac{a}{\frac{c}{d}} - b\\
\mathbf{if}\;c \leq -8.5 \cdot 10^{+48}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot t_1\\
\mathbf{elif}\;c \leq -8.5 \cdot 10^{-141}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 4.5 \cdot 10^{-148}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 2.4 \cdot 10^{+57}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{-\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 7 Error 12.3 Cost 7568
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -2.2 \cdot 10^{+48}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq -2.15 \cdot 10^{-141}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 3.1 \cdot 10^{-149}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 2.4 \cdot 10^{+57}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 8 Error 12.4 Cost 1488
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -8.5 \cdot 10^{+48}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq -4.6 \cdot 10^{-141}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 3.5 \cdot 10^{-149}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 2.3 \cdot 10^{+57}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{\frac{a}{c}}{\frac{c}{d}}\\
\end{array}
\]
Alternative 9 Error 20.4 Cost 1232
\[\begin{array}{l}
t_0 := \frac{-a}{d}\\
\mathbf{if}\;c \leq -7 \cdot 10^{-68}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq 3.2 \cdot 10^{-147}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 5.3 \cdot 10^{-120}:\\
\;\;\;\;b \cdot \frac{c}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;c \leq 5 \cdot 10^{+54}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{c} \cdot \left(b - \frac{d}{\frac{c}{a}}\right)\\
\end{array}
\]
Alternative 10 Error 20.0 Cost 968
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.28 \cdot 10^{-67}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq 1.2 \cdot 10^{+56}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{c} \cdot \left(b - \frac{d}{\frac{c}{a}}\right)\\
\end{array}
\]
Alternative 11 Error 16.6 Cost 968
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.4 \cdot 10^{-68}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq 6.5 \cdot 10^{+54}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{c} \cdot \left(b - \frac{d}{\frac{c}{a}}\right)\\
\end{array}
\]
Alternative 12 Error 16.7 Cost 968
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.28 \cdot 10^{-67}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq 6 \cdot 10^{+54}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c} \cdot \frac{a}{c}\\
\end{array}
\]
Alternative 13 Error 16.7 Cost 968
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.36 \cdot 10^{-68}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq 1.1 \cdot 10^{+55}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{\frac{a}{c}}{\frac{c}{d}}\\
\end{array}
\]
Alternative 14 Error 20.0 Cost 841
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.15 \cdot 10^{-67} \lor \neg \left(c \leq 1.06 \cdot 10^{+56}\right):\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\
\end{array}
\]
Alternative 15 Error 23.3 Cost 520
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.15 \cdot 10^{+42}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 4.4 \cdot 10^{+56}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 16 Error 55.3 Cost 456
\[\begin{array}{l}
\mathbf{if}\;c \leq -4.4 \cdot 10^{+133}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq 2.2 \cdot 10^{+171}:\\
\;\;\;\;\frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 17 Error 34.8 Cost 456
\[\begin{array}{l}
\mathbf{if}\;d \leq -4.5 \cdot 10^{+141}:\\
\;\;\;\;\frac{a}{d}\\
\mathbf{elif}\;d \leq 1.96 \cdot 10^{+214}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{d}\\
\end{array}
\]
Alternative 18 Error 58.8 Cost 192
\[\frac{a}{c}
\]