Math FPCore C Java Python Julia MATLAB Wolfram TeX \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\]
↓
\[\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 0 \lor \neg \left(t_1 \leq 5 \cdot 10^{+307}\right):\\
\;\;\;\;\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)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\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 b) (* d a))) (t_1 (/ t_0 (+ (* c c) (* d d)))))
(if (or (<= t_1 0.0) (not (<= t_1 5e+307)))
(*
(/ 1.0 (hypot c d))
(- (* c (/ b (hypot c d))) (* (/ d (hypot c d)) a)))
(/ (/ t_0 (hypot c d)) (hypot c d))))) 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 * b) - (d * a);
double t_1 = t_0 / ((c * c) + (d * d));
double tmp;
if ((t_1 <= 0.0) || !(t_1 <= 5e+307)) {
tmp = (1.0 / hypot(c, d)) * ((c * (b / hypot(c, d))) - ((d / hypot(c, d)) * a));
} else {
tmp = (t_0 / hypot(c, d)) / hypot(c, d);
}
return tmp;
}
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) {
double t_0 = (c * b) - (d * a);
double t_1 = t_0 / ((c * c) + (d * d));
double tmp;
if ((t_1 <= 0.0) || !(t_1 <= 5e+307)) {
tmp = (1.0 / Math.hypot(c, d)) * ((c * (b / Math.hypot(c, d))) - ((d / Math.hypot(c, d)) * a));
} else {
tmp = (t_0 / Math.hypot(c, d)) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d):
return ((b * c) - (a * d)) / ((c * c) + (d * d))
↓
def code(a, b, c, d):
t_0 = (c * b) - (d * a)
t_1 = t_0 / ((c * c) + (d * d))
tmp = 0
if (t_1 <= 0.0) or not (t_1 <= 5e+307):
tmp = (1.0 / math.hypot(c, d)) * ((c * (b / math.hypot(c, d))) - ((d / math.hypot(c, d)) * a))
else:
tmp = (t_0 / math.hypot(c, d)) / math.hypot(c, d)
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(Float64(c * b) - Float64(d * a))
t_1 = Float64(t_0 / Float64(Float64(c * c) + Float64(d * d)))
tmp = 0.0
if ((t_1 <= 0.0) || !(t_1 <= 5e+307))
tmp = Float64(Float64(1.0 / hypot(c, d)) * Float64(Float64(c * Float64(b / hypot(c, d))) - Float64(Float64(d / hypot(c, d)) * a)));
else
tmp = Float64(Float64(t_0 / hypot(c, d)) / hypot(c, d));
end
return tmp
end
function tmp = code(a, b, c, d)
tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
end
↓
function tmp_2 = code(a, b, c, d)
t_0 = (c * b) - (d * a);
t_1 = t_0 / ((c * c) + (d * d));
tmp = 0.0;
if ((t_1 <= 0.0) || ~((t_1 <= 5e+307)))
tmp = (1.0 / hypot(c, d)) * ((c * (b / hypot(c, d))) - ((d / hypot(c, d)) * a));
else
tmp = (t_0 / hypot(c, d)) / hypot(c, d);
end
tmp_2 = 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[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, 0.0], N[Not[LessEqual[t$95$1, 5e+307]], $MachinePrecision]], 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], N[(N[(t$95$0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
↓
\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 0 \lor \neg \left(t_1 \leq 5 \cdot 10^{+307}\right):\\
\;\;\;\;\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)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
Alternatives Alternative 1 Error 0.87% Cost 20416
\[\left(\frac{d}{\mathsf{hypot}\left(c, d\right)} \cdot a + \frac{c}{-\mathsf{hypot}\left(c, d\right)} \cdot b\right) \cdot \frac{-1}{\mathsf{hypot}\left(c, d\right)}
\]
Alternative 2 Error 17.32% Cost 17744
\[\begin{array}{l}
t_0 := \frac{c}{\mathsf{hypot}\left(d, c\right)} \cdot \frac{b}{\mathsf{hypot}\left(d, c\right)}\\
t_1 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_1 \leq -5 \cdot 10^{-316}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_0\\
\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 Error 11.16% Cost 15688
\[\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:\\
\;\;\;\;\frac{c}{\mathsf{hypot}\left(d, c\right)} \cdot \frac{b}{\mathsf{hypot}\left(d, c\right)}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{\frac{t_0}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\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 4 Error 10.65% Cost 15688
\[\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:\\
\;\;\;\;\left(a + \frac{c}{-\mathsf{hypot}\left(c, d\right)} \cdot b\right) \cdot \frac{-1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{\frac{t_0}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\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 20.13% Cost 13904
\[\begin{array}{l}
t_0 := \frac{c}{\mathsf{hypot}\left(d, c\right)} \cdot \frac{b}{\mathsf{hypot}\left(d, c\right)}\\
t_1 := c \cdot c + d \cdot d\\
t_2 := \frac{c \cdot b - d \cdot a}{t_1}\\
\mathbf{if}\;d \leq -6.8 \cdot 10^{+142}:\\
\;\;\;\;\frac{b}{d} \cdot \frac{c}{d} - \frac{a}{d}\\
\mathbf{elif}\;d \leq -3.55 \cdot 10^{+75}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -7.2 \cdot 10^{+32}:\\
\;\;\;\;\frac{-a}{\frac{t_1}{d}}\\
\mathbf{elif}\;d \leq -4.4 \cdot 10^{-7}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1.55 \cdot 10^{-158}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq 2.8 \cdot 10^{-105}:\\
\;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{+89}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{c}{\frac{d}{b}} - a\right)\\
\end{array}
\]
Alternative 6 Error 18.23% Cost 7696
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;d \leq -6.6 \cdot 10^{+89}:\\
\;\;\;\;\frac{b}{d} \cdot \frac{c}{d} - \frac{a}{d}\\
\mathbf{elif}\;d \leq -1.5 \cdot 10^{-158}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 9.8 \cdot 10^{-104}:\\
\;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\
\mathbf{elif}\;d \leq 5.3 \cdot 10^{+94}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{c}{\frac{d}{b}} - a\right)\\
\end{array}
\]
Alternative 7 Error 18.32% Cost 1488
\[\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;d \leq -3.4 \cdot 10^{+89}:\\
\;\;\;\;\frac{b}{d} \cdot \frac{c}{d} - \frac{a}{d}\\
\mathbf{elif}\;d \leq -1.46 \cdot 10^{-158}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 4.4 \cdot 10^{-107}:\\
\;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\
\mathbf{elif}\;d \leq 2.2 \cdot 10^{+95}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{c}{\frac{d}{b}} - a\right) \cdot \frac{1}{d}\\
\end{array}
\]
Alternative 8 Error 25.77% Cost 1234
\[\begin{array}{l}
\mathbf{if}\;c \leq -2.65 \cdot 10^{-13} \lor \neg \left(c \leq 3.6 \cdot 10^{-92} \lor \neg \left(c \leq 0.7\right) \land c \leq 1.25 \cdot 10^{+43}\right):\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{d} \cdot \frac{c}{d} - \frac{a}{d}\\
\end{array}
\]
Alternative 9 Error 25.48% Cost 1233
\[\begin{array}{l}
t_0 := \frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{if}\;c \leq -9.5 \cdot 10^{-15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 3.6 \cdot 10^{-92}:\\
\;\;\;\;\left(\frac{c}{\frac{d}{b}} - a\right) \cdot \frac{1}{d}\\
\mathbf{elif}\;c \leq 0.46 \lor \neg \left(c \leq 1.45 \cdot 10^{+40}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{d} \cdot \frac{c}{d} - \frac{a}{d}\\
\end{array}
\]
Alternative 10 Error 30.25% Cost 1106
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.4 \cdot 10^{-16} \lor \neg \left(c \leq 10^{-78}\right) \land \left(c \leq 0.185 \lor \neg \left(c \leq 7 \cdot 10^{+37}\right)\right):\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\
\end{array}
\]
Alternative 11 Error 37.44% Cost 1050
\[\begin{array}{l}
t_0 := \frac{-a}{d}\\
\mathbf{if}\;d \leq -1.25 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1 \cdot 10^{+58}:\\
\;\;\;\;\frac{d}{c} \cdot \frac{a}{-c}\\
\mathbf{elif}\;d \leq -1.16 \cdot 10^{+31} \lor \neg \left(d \leq -1100 \lor \neg \left(d \leq -1.5 \cdot 10^{-93}\right) \land d \leq 2.65 \cdot 10^{-17}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 12 Error 37.56% Cost 1050
\[\begin{array}{l}
t_0 := \frac{-a}{d}\\
\mathbf{if}\;d \leq -1.25 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1 \cdot 10^{+58}:\\
\;\;\;\;\frac{\frac{-a}{\frac{c}{d}}}{c}\\
\mathbf{elif}\;d \leq -4.5 \cdot 10^{+31} \lor \neg \left(d \leq -820\right) \land \left(d \leq -5.9 \cdot 10^{-92} \lor \neg \left(d \leq 2.05 \cdot 10^{-13}\right)\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 13 Error 37.53% Cost 1050
\[\begin{array}{l}
t_0 := \frac{-a}{d}\\
\mathbf{if}\;d \leq -1.25 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1 \cdot 10^{+58}:\\
\;\;\;\;\frac{a \cdot \frac{-d}{c}}{c}\\
\mathbf{elif}\;d \leq -4.5 \cdot 10^{+31} \lor \neg \left(d \leq -2050 \lor \neg \left(d \leq -3.15 \cdot 10^{-93}\right) \land d \leq 1.5 \cdot 10^{-13}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 14 Error 36.13% Cost 520
\[\begin{array}{l}
\mathbf{if}\;c \leq -2 \cdot 10^{-19}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 1.5 \cdot 10^{+82}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\]
Alternative 15 Error 54.1% Cost 456
\[\begin{array}{l}
\mathbf{if}\;d \leq -3.3 \cdot 10^{+181}:\\
\;\;\;\;\frac{a}{d}\\
\mathbf{elif}\;d \leq 4.5 \cdot 10^{+202}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{d}\\
\end{array}
\]
Alternative 16 Error 88.88% Cost 192
\[\frac{a}{d}
\]