Math FPCore C Java Python Julia MATLAB Wolfram TeX \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
\]
↓
\[\begin{array}{l}
t_0 := \frac{\frac{c \cdot a + d \cdot b}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{d}{\frac{c}{b}}\\
\mathbf{if}\;c \leq -4.8 \cdot 10^{+82}:\\
\;\;\;\;\frac{\left(-a\right) - t_1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;c \leq -3.5 \cdot 10^{-110}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 2.9 \cdot 10^{-138}:\\
\;\;\;\;\frac{b}{d} + \frac{1}{d} \cdot \left(c \cdot \frac{a}{d}\right)\\
\mathbf{elif}\;c \leq 2.55 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a + t_1}{\mathsf{hypot}\left(c, d\right)}\\
\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 (/ (/ (+ (* c a) (* d b)) (hypot c d)) (hypot c d)))
(t_1 (/ d (/ c b))))
(if (<= c -4.8e+82)
(/ (- (- a) t_1) (hypot c d))
(if (<= c -3.5e-110)
t_0
(if (<= c 2.9e-138)
(+ (/ b d) (* (/ 1.0 d) (* c (/ a d))))
(if (<= c 2.55e+39) t_0 (/ (+ a t_1) (hypot c d)))))))) 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 = (((c * a) + (d * b)) / hypot(c, d)) / hypot(c, d);
double t_1 = d / (c / b);
double tmp;
if (c <= -4.8e+82) {
tmp = (-a - t_1) / hypot(c, d);
} else if (c <= -3.5e-110) {
tmp = t_0;
} else if (c <= 2.9e-138) {
tmp = (b / d) + ((1.0 / d) * (c * (a / d)));
} else if (c <= 2.55e+39) {
tmp = t_0;
} else {
tmp = (a + t_1) / hypot(c, d);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
return ((a * c) + (b * d)) / ((c * c) + (d * d));
}
↓
public static double code(double a, double b, double c, double d) {
double t_0 = (((c * a) + (d * b)) / Math.hypot(c, d)) / Math.hypot(c, d);
double t_1 = d / (c / b);
double tmp;
if (c <= -4.8e+82) {
tmp = (-a - t_1) / Math.hypot(c, d);
} else if (c <= -3.5e-110) {
tmp = t_0;
} else if (c <= 2.9e-138) {
tmp = (b / d) + ((1.0 / d) * (c * (a / d)));
} else if (c <= 2.55e+39) {
tmp = t_0;
} else {
tmp = (a + t_1) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d):
return ((a * c) + (b * d)) / ((c * c) + (d * d))
↓
def code(a, b, c, d):
t_0 = (((c * a) + (d * b)) / math.hypot(c, d)) / math.hypot(c, d)
t_1 = d / (c / b)
tmp = 0
if c <= -4.8e+82:
tmp = (-a - t_1) / math.hypot(c, d)
elif c <= -3.5e-110:
tmp = t_0
elif c <= 2.9e-138:
tmp = (b / d) + ((1.0 / d) * (c * (a / d)))
elif c <= 2.55e+39:
tmp = t_0
else:
tmp = (a + t_1) / math.hypot(c, d)
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(Float64(Float64(c * a) + Float64(d * b)) / hypot(c, d)) / hypot(c, d))
t_1 = Float64(d / Float64(c / b))
tmp = 0.0
if (c <= -4.8e+82)
tmp = Float64(Float64(Float64(-a) - t_1) / hypot(c, d));
elseif (c <= -3.5e-110)
tmp = t_0;
elseif (c <= 2.9e-138)
tmp = Float64(Float64(b / d) + Float64(Float64(1.0 / d) * Float64(c * Float64(a / d))));
elseif (c <= 2.55e+39)
tmp = t_0;
else
tmp = Float64(Float64(a + t_1) / hypot(c, d));
end
return tmp
end
function tmp = code(a, b, c, d)
tmp = ((a * c) + (b * d)) / ((c * c) + (d * d));
end
↓
function tmp_2 = code(a, b, c, d)
t_0 = (((c * a) + (d * b)) / hypot(c, d)) / hypot(c, d);
t_1 = d / (c / b);
tmp = 0.0;
if (c <= -4.8e+82)
tmp = (-a - t_1) / hypot(c, d);
elseif (c <= -3.5e-110)
tmp = t_0;
elseif (c <= 2.9e-138)
tmp = (b / d) + ((1.0 / d) * (c * (a / d)));
elseif (c <= 2.55e+39)
tmp = t_0;
else
tmp = (a + t_1) / hypot(c, d);
end
tmp_2 = 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[(N[(c * a), $MachinePrecision] + 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[(d / N[(c / b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -4.8e+82], N[(N[((-a) - t$95$1), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -3.5e-110], t$95$0, If[LessEqual[c, 2.9e-138], N[(N[(b / d), $MachinePrecision] + N[(N[(1.0 / d), $MachinePrecision] * N[(c * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.55e+39], t$95$0, N[(N[(a + t$95$1), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]]
\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
↓
\begin{array}{l}
t_0 := \frac{\frac{c \cdot a + d \cdot b}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{d}{\frac{c}{b}}\\
\mathbf{if}\;c \leq -4.8 \cdot 10^{+82}:\\
\;\;\;\;\frac{\left(-a\right) - t_1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;c \leq -3.5 \cdot 10^{-110}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 2.9 \cdot 10^{-138}:\\
\;\;\;\;\frac{b}{d} + \frac{1}{d} \cdot \left(c \cdot \frac{a}{d}\right)\\
\mathbf{elif}\;c \leq 2.55 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a + t_1}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
Alternatives Alternative 1 Error 12.5 Cost 7568
\[\begin{array}{l}
t_0 := \frac{c \cdot a + d \cdot b}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -6 \cdot 10^{+76}:\\
\;\;\;\;\frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\
\mathbf{elif}\;c \leq -1.65 \cdot 10^{-116}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.25 \cdot 10^{-70}:\\
\;\;\;\;\frac{b}{d} + \frac{a}{d \cdot \frac{d}{c}}\\
\mathbf{elif}\;c \leq 2.55 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a + \frac{d}{\frac{c}{b}}}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 2 Error 12.3 Cost 7568
\[\begin{array}{l}
t_0 := \frac{c \cdot a + d \cdot b}{c \cdot c + d \cdot d}\\
t_1 := \frac{d}{\frac{c}{b}}\\
\mathbf{if}\;c \leq -5 \cdot 10^{+78}:\\
\;\;\;\;\frac{\left(-a\right) - t_1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;c \leq -2.6 \cdot 10^{-116}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 4 \cdot 10^{-74}:\\
\;\;\;\;\frac{b}{d} + \frac{a}{d \cdot \frac{d}{c}}\\
\mathbf{elif}\;c \leq 1.12 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a + t_1}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\]
Alternative 3 Error 12.7 Cost 1488
\[\begin{array}{l}
t_0 := \frac{c \cdot a + d \cdot b}{c \cdot c + d \cdot d}\\
t_1 := \frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\
\mathbf{if}\;c \leq -5.4 \cdot 10^{+78}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -8.8 \cdot 10^{-116}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 2.55 \cdot 10^{-74}:\\
\;\;\;\;\frac{b}{d} + \frac{a}{d \cdot \frac{d}{c}}\\
\mathbf{elif}\;c \leq 2.55 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 4 Error 19.4 Cost 1232
\[\begin{array}{l}
t_0 := \frac{1}{d} \cdot \left(b + c \cdot \frac{a}{d}\right)\\
\mathbf{if}\;c \leq -8 \cdot 10^{+29}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq 1.15 \cdot 10^{-67}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 2.9 \cdot 10^{-27}:\\
\;\;\;\;a \cdot \frac{c}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;c \leq 10^{+106}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 5 Error 16.1 Cost 1232
\[\begin{array}{l}
t_0 := \frac{1}{d} \cdot \left(b + c \cdot \frac{a}{d}\right)\\
t_1 := \frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\
\mathbf{if}\;c \leq -4.6 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 3.6 \cdot 10^{-67}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.1 \cdot 10^{-29}:\\
\;\;\;\;a \cdot \frac{c}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;c \leq 2.8 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 6 Error 16.2 Cost 1232
\[\begin{array}{l}
t_0 := \frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\
\mathbf{if}\;c \leq -2.15 \cdot 10^{-17}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 4.6 \cdot 10^{-67}:\\
\;\;\;\;\frac{1}{d} \cdot \left(b + c \cdot \frac{a}{d}\right)\\
\mathbf{elif}\;c \leq 1.45 \cdot 10^{-26}:\\
\;\;\;\;a \cdot \frac{c}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;c \leq 8 \cdot 10^{+43}:\\
\;\;\;\;\frac{b}{d} + \frac{a}{d} \cdot \frac{c}{d}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 7 Error 16.1 Cost 1232
\[\begin{array}{l}
t_0 := \frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\
\mathbf{if}\;c \leq -9 \cdot 10^{-17}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 5.8 \cdot 10^{-67}:\\
\;\;\;\;\frac{b}{d} + \frac{1}{d} \cdot \left(c \cdot \frac{a}{d}\right)\\
\mathbf{elif}\;c \leq 1.6 \cdot 10^{-29}:\\
\;\;\;\;a \cdot \frac{c}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;c \leq 1.35 \cdot 10^{+44}:\\
\;\;\;\;\frac{b}{d} + \frac{a}{d} \cdot \frac{c}{d}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 8 Error 19.1 Cost 969
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.65 \cdot 10^{+30} \lor \neg \left(c \leq 3.2 \cdot 10^{+106}\right):\\
\;\;\;\;\frac{a}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{d} \cdot \left(b + c \cdot \frac{a}{d}\right)\\
\end{array}
\]
Alternative 9 Error 23.5 Cost 456
\[\begin{array}{l}
\mathbf{if}\;c \leq -2.7 \cdot 10^{+29}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq 2.1 \cdot 10^{+44}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 10 Error 38.0 Cost 192
\[\frac{a}{c}
\]