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 82.7% Cost 17744
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\frac{b \cdot \frac{c}{\mathsf{hypot}\left(d, c\right)}}{\mathsf{hypot}\left(d, c\right)}\\
\mathbf{elif}\;t_0 \leq -1 \cdot 10^{-269}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\frac{\frac{c}{\frac{\mathsf{hypot}\left(d, c\right)}{b}}}{\mathsf{hypot}\left(d, c\right)}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;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 2 Accuracy 81.4% Cost 17744
\[\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 -1 \cdot 10^{+203}:\\
\;\;\;\;\frac{b \cdot \frac{c}{\mathsf{hypot}\left(d, c\right)}}{\mathsf{hypot}\left(d, c\right)}\\
\mathbf{elif}\;t_1 \leq -1 \cdot 10^{-269}:\\
\;\;\;\;t_0 \cdot \frac{1}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{\frac{c}{\frac{\mathsf{hypot}\left(d, c\right)}{b}}}{\mathsf{hypot}\left(d, c\right)}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;t_1\\
\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 3 Accuracy 87.7% Cost 15816
\[\begin{array}{l}
t_0 := c \cdot b - d \cdot a\\
t_1 := \frac{t_0}{c \cdot c + d \cdot d}\\
t_2 := \frac{1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+212}:\\
\;\;\;\;\frac{b \cdot \frac{c}{\mathsf{hypot}\left(d, c\right)}}{\mathsf{hypot}\left(d, c\right)}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;t_2 \cdot \frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(b - \frac{d}{\mathsf{hypot}\left(c, d\right)} \cdot a\right)\\
\end{array}
\]
Alternative 4 Accuracy 79.0% Cost 7564
\[\begin{array}{l}
\mathbf{if}\;d \leq -0.65:\\
\;\;\;\;\frac{b}{d} \cdot \frac{c}{d} - \frac{a}{d}\\
\mathbf{elif}\;d \leq 5.2 \cdot 10^{-118}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\mathbf{elif}\;d \leq 3.7 \cdot 10^{+50}:\\
\;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{c}{\frac{d}{b}} - a\right)\\
\end{array}
\]
Alternative 5 Accuracy 78.8% Cost 1356
\[\begin{array}{l}
t_0 := \frac{b}{d} \cdot \frac{c}{d} - \frac{a}{d}\\
\mathbf{if}\;d \leq -0.6:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-120}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\mathbf{elif}\;d \leq 3.1 \cdot 10^{+51}:\\
\;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 6 Accuracy 76.4% Cost 969
\[\begin{array}{l}
\mathbf{if}\;d \leq -0.56 \lor \neg \left(d \leq 4.2 \cdot 10^{-37}\right):\\
\;\;\;\;\frac{b}{d} \cdot \frac{c}{d} - \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\end{array}
\]
Alternative 7 Accuracy 69.9% Cost 841
\[\begin{array}{l}
\mathbf{if}\;d \leq -0.62 \lor \neg \left(d \leq 13.8\right):\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\end{array}
\]
Alternative 8 Accuracy 70.5% Cost 841
\[\begin{array}{l}
\mathbf{if}\;d \leq -0.65 \lor \neg \left(d \leq 0.75\right):\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\end{array}
\]
Alternative 9 Accuracy 64.1% Cost 521
\[\begin{array}{l}
\mathbf{if}\;d \leq -0.6 \lor \neg \left(d \leq 8500\right):\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 10 Accuracy 13.4% Cost 456
\[\begin{array}{l}
\mathbf{if}\;d \leq -1.2 \cdot 10^{-38}:\\
\;\;\;\;\frac{a}{d}\\
\mathbf{elif}\;d \leq 1.7 \cdot 10^{+71}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{d}\\
\end{array}
\]
Alternative 11 Accuracy 44.9% Cost 456
\[\begin{array}{l}
\mathbf{if}\;d \leq -2.5 \cdot 10^{+109}:\\
\;\;\;\;\frac{a}{d}\\
\mathbf{elif}\;d \leq 1.52 \cdot 10^{+88}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{d}\\
\end{array}
\]
Alternative 12 Accuracy 7.8% Cost 192
\[\frac{a}{c}
\]