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 Accuracy 87.3% Cost 15817
\[\begin{array}{l}
t_0 := c \cdot b - d \cdot a\\
t_1 := \frac{t_0}{c \cdot c + d \cdot d}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq \infty\right):\\
\;\;\;\;\frac{b - \frac{a}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 2 Accuracy 81.9% Cost 14032
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.6 \cdot 10^{+54}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\
\mathbf{elif}\;c \leq -9.5 \cdot 10^{-125}:\\
\;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;c \leq -1.8 \cdot 10^{-233}:\\
\;\;\;\;b \cdot \frac{c}{d \cdot d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 2.8 \cdot 10^{-153}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{a}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 3 Accuracy 80.0% Cost 7300
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -1.32 \cdot 10^{+54}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{a}{\frac{c}{d}} - b\right)\\
\mathbf{elif}\;c \leq -6.8 \cdot 10^{-125}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -1 \cdot 10^{-233}:\\
\;\;\;\;b \cdot \frac{c}{d \cdot d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 5 \cdot 10^{-60}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 6.4 \cdot 10^{+53}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\end{array}
\]
Alternative 4 Accuracy 80.1% Cost 1620
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -2.05 \cdot 10^{+54}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c} \cdot \frac{a}{c}\\
\mathbf{elif}\;c \leq -2.45 \cdot 10^{-124}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -1.2 \cdot 10^{-233}:\\
\;\;\;\;b \cdot \frac{c}{d \cdot d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 2.45 \cdot 10^{-61}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 6.4 \cdot 10^{+53}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\end{array}
\]
Alternative 5 Accuracy 61.8% Cost 1304
\[\begin{array}{l}
t_0 := d \cdot \frac{\frac{-a}{c}}{c}\\
\mathbf{if}\;c \leq -3.35 \cdot 10^{+134}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq -3.1 \cdot 10^{+105}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -0.46:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 7 \cdot 10^{-57}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{elif}\;c \leq 4.5 \cdot 10^{+141}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 9.8 \cdot 10^{+179}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 6 Accuracy 61.7% Cost 1304
\[\begin{array}{l}
t_0 := \frac{-a}{c}\\
\mathbf{if}\;c \leq -3.35 \cdot 10^{+134}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq -3.1 \cdot 10^{+105}:\\
\;\;\;\;\frac{d \cdot t_0}{c}\\
\mathbf{elif}\;c \leq -2800:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 1.15 \cdot 10^{-54}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{elif}\;c \leq 4.5 \cdot 10^{+141}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 9.8 \cdot 10^{+179}:\\
\;\;\;\;d \cdot \frac{t_0}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 7 Accuracy 61.6% Cost 1304
\[\begin{array}{l}
t_0 := \frac{a \cdot \frac{-d}{c}}{c}\\
\mathbf{if}\;c \leq -6.8 \cdot 10^{+133}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq -3 \cdot 10^{+105}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -3.4:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 3 \cdot 10^{-54}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{elif}\;c \leq 4 \cdot 10^{+141}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 9.8 \cdot 10^{+179}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 8 Accuracy 75.4% Cost 969
\[\begin{array}{l}
\mathbf{if}\;c \leq -7.6 \cdot 10^{+27} \lor \neg \left(c \leq 2.8 \cdot 10^{-54}\right):\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\end{array}
\]
Alternative 9 Accuracy 75.3% Cost 968
\[\begin{array}{l}
\mathbf{if}\;c \leq -5.5 \cdot 10^{+27}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c} \cdot \frac{a}{c}\\
\mathbf{elif}\;c \leq 2.9 \cdot 10^{-54}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\end{array}
\]
Alternative 10 Accuracy 69.8% Cost 841
\[\begin{array}{l}
\mathbf{if}\;c \leq -51000 \lor \neg \left(c \leq 9.5 \cdot 10^{-59}\right):\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\
\end{array}
\]
Alternative 11 Accuracy 70.3% Cost 841
\[\begin{array}{l}
\mathbf{if}\;c \leq -11200 \lor \neg \left(c \leq 10^{-54}\right):\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\
\end{array}
\]
Alternative 12 Accuracy 63.6% Cost 520
\[\begin{array}{l}
\mathbf{if}\;c \leq -200000:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 1.95 \cdot 10^{-54}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 13 Accuracy 13.9% Cost 456
\[\begin{array}{l}
\mathbf{if}\;d \leq -2.7 \cdot 10^{+97}:\\
\;\;\;\;\frac{a}{d}\\
\mathbf{elif}\;d \leq 1.5 \cdot 10^{+123}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{d}\\
\end{array}
\]
Alternative 14 Accuracy 45.6% Cost 456
\[\begin{array}{l}
\mathbf{if}\;d \leq -5.1 \cdot 10^{+134}:\\
\;\;\;\;\frac{a}{d}\\
\mathbf{elif}\;d \leq 1.2 \cdot 10^{+184}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{d}\\
\end{array}
\]
Alternative 15 Accuracy 8.2% Cost 192
\[\frac{a}{c}
\]