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{1}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{b}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}\\
\mathbf{if}\;c \leq -2.1 \cdot 10^{+168}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\
\mathbf{elif}\;c \leq 10^{+134}:\\
\;\;\;\;t_0 \cdot \left(t_1 + \frac{c \cdot a}{\mathsf{hypot}\left(c, d\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(a + t_1\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 (/ 1.0 (hypot c d))) (t_1 (/ b (/ (hypot c d) d))))
(if (<= c -2.1e+168)
(+ (/ a c) (* (/ b c) (/ d c)))
(if (<= c 1e+134)
(* t_0 (+ t_1 (/ (* c a) (hypot c d))))
(* t_0 (+ a t_1)))))) 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 = 1.0 / hypot(c, d);
double t_1 = b / (hypot(c, d) / d);
double tmp;
if (c <= -2.1e+168) {
tmp = (a / c) + ((b / c) * (d / c));
} else if (c <= 1e+134) {
tmp = t_0 * (t_1 + ((c * a) / hypot(c, d)));
} else {
tmp = t_0 * (a + t_1);
}
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 = 1.0 / Math.hypot(c, d);
double t_1 = b / (Math.hypot(c, d) / d);
double tmp;
if (c <= -2.1e+168) {
tmp = (a / c) + ((b / c) * (d / c));
} else if (c <= 1e+134) {
tmp = t_0 * (t_1 + ((c * a) / Math.hypot(c, d)));
} else {
tmp = t_0 * (a + t_1);
}
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 = 1.0 / math.hypot(c, d)
t_1 = b / (math.hypot(c, d) / d)
tmp = 0
if c <= -2.1e+168:
tmp = (a / c) + ((b / c) * (d / c))
elif c <= 1e+134:
tmp = t_0 * (t_1 + ((c * a) / math.hypot(c, d)))
else:
tmp = t_0 * (a + t_1)
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(1.0 / hypot(c, d))
t_1 = Float64(b / Float64(hypot(c, d) / d))
tmp = 0.0
if (c <= -2.1e+168)
tmp = Float64(Float64(a / c) + Float64(Float64(b / c) * Float64(d / c)));
elseif (c <= 1e+134)
tmp = Float64(t_0 * Float64(t_1 + Float64(Float64(c * a) / hypot(c, d))));
else
tmp = Float64(t_0 * Float64(a + t_1));
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 = 1.0 / hypot(c, d);
t_1 = b / (hypot(c, d) / d);
tmp = 0.0;
if (c <= -2.1e+168)
tmp = (a / c) + ((b / c) * (d / c));
elseif (c <= 1e+134)
tmp = t_0 * (t_1 + ((c * a) / hypot(c, d)));
else
tmp = t_0 * (a + t_1);
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[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b / N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.1e+168], N[(N[(a / c), $MachinePrecision] + N[(N[(b / c), $MachinePrecision] * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1e+134], N[(t$95$0 * N[(t$95$1 + N[(N[(c * a), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(a + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
↓
\begin{array}{l}
t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{b}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}\\
\mathbf{if}\;c \leq -2.1 \cdot 10^{+168}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\
\mathbf{elif}\;c \leq 10^{+134}:\\
\;\;\;\;t_0 \cdot \left(t_1 + \frac{c \cdot a}{\mathsf{hypot}\left(c, d\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(a + t_1\right)\\
\end{array}
Alternatives Alternative 1 Error 10.0 Cost 20560
\[\begin{array}{l}
t_0 := d \cdot d + c \cdot c\\
t_1 := \frac{1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;c \leq -6.2 \cdot 10^{+82}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\
\mathbf{elif}\;c \leq -1.85 \cdot 10^{-39}:\\
\;\;\;\;\frac{d}{\frac{t_0}{b}} + \frac{c}{\frac{t_0}{a}}\\
\mathbf{elif}\;c \leq 2.25 \cdot 10^{-141}:\\
\;\;\;\;\frac{b}{d} + \frac{a \cdot \frac{c}{d}}{d}\\
\mathbf{elif}\;c \leq 2.15 \cdot 10^{+133}:\\
\;\;\;\;t_1 \cdot \frac{\mathsf{fma}\left(a, c, b \cdot d\right)}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(a + \frac{b}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}\right)\\
\end{array}
\]
Alternative 2 Error 11.1 Cost 14160
\[\begin{array}{l}
t_0 := d \cdot d + c \cdot c\\
t_1 := \frac{d}{\frac{t_0}{b}} + \frac{c}{\frac{t_0}{a}}\\
\mathbf{if}\;c \leq -5.8 \cdot 10^{+82}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\
\mathbf{elif}\;c \leq -2.05 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 3.3 \cdot 10^{-110}:\\
\;\;\;\;\frac{b}{d} + \frac{a \cdot \frac{c}{d}}{d}\\
\mathbf{elif}\;c \leq 4 \cdot 10^{+136}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(a + \frac{b}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}\right)\\
\end{array}
\]
Alternative 3 Error 11.7 Cost 2000
\[\begin{array}{l}
t_0 := d \cdot d + c \cdot c\\
t_1 := \frac{d}{\frac{t_0}{b}} + \frac{c}{\frac{t_0}{a}}\\
\mathbf{if}\;c \leq -5.8 \cdot 10^{+82}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\
\mathbf{elif}\;c \leq -7 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 4.2 \cdot 10^{-110}:\\
\;\;\;\;\frac{b}{d} + \frac{a \cdot \frac{c}{d}}{d}\\
\mathbf{elif}\;c \leq 1.75 \cdot 10^{+133}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\
\end{array}
\]
Alternative 4 Error 11.6 Cost 1488
\[\begin{array}{l}
t_0 := \frac{b \cdot d + c \cdot a}{d \cdot d + c \cdot c}\\
\mathbf{if}\;c \leq -7.8 \cdot 10^{+105}:\\
\;\;\;\;\frac{a}{c} + \frac{1}{\frac{c}{d} \cdot \frac{c}{b}}\\
\mathbf{elif}\;c \leq -9.8 \cdot 10^{-77}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 6.1 \cdot 10^{-111}:\\
\;\;\;\;\frac{b}{d} + \frac{a \cdot \frac{c}{d}}{d}\\
\mathbf{elif}\;c \leq 1.2 \cdot 10^{+133}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\
\end{array}
\]
Alternative 5 Error 18.6 Cost 1364
\[\begin{array}{l}
t_0 := a \cdot \frac{c}{d \cdot d + c \cdot c}\\
t_1 := \frac{1}{c} \cdot \left(a + b \cdot \frac{d}{c}\right)\\
\mathbf{if}\;c \leq -8 \cdot 10^{+82}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -1.2 \cdot 10^{-33}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -1.85 \cdot 10^{-38}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 9 \cdot 10^{-48}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 1.2 \cdot 10^{+133}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 6 Error 18.5 Cost 1364
\[\begin{array}{l}
t_0 := a \cdot \frac{c}{d \cdot d + c \cdot c}\\
t_1 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\
\mathbf{if}\;c \leq -6.8 \cdot 10^{+76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -2.9 \cdot 10^{-33}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -1.5 \cdot 10^{-38}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 6.6 \cdot 10^{-49}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 4.5 \cdot 10^{+14}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 7 Error 18.6 Cost 1364
\[\begin{array}{l}
t_0 := a \cdot \frac{c}{d \cdot d + c \cdot c}\\
t_1 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\
\mathbf{if}\;c \leq -1.05 \cdot 10^{+80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -3.4 \cdot 10^{-34}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -3.3 \cdot 10^{-38}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 2.5 \cdot 10^{-47}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 1.75 \cdot 10^{+17}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\
\end{array}
\]
Alternative 8 Error 15.6 Cost 1232
\[\begin{array}{l}
t_0 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\
\mathbf{if}\;c \leq -9.6 \cdot 10^{+75}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -3.3 \cdot 10^{-34}:\\
\;\;\;\;a \cdot \frac{c}{d \cdot d + c \cdot c}\\
\mathbf{elif}\;c \leq -3.6 \cdot 10^{-38}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 8200000000000:\\
\;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\
\end{array}
\]
Alternative 9 Error 15.0 Cost 1232
\[\begin{array}{l}
t_0 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\
\mathbf{if}\;c \leq -3 \cdot 10^{+78}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -5.2 \cdot 10^{-33}:\\
\;\;\;\;a \cdot \frac{c}{d \cdot d + c \cdot c}\\
\mathbf{elif}\;c \leq -3.95 \cdot 10^{-38}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 2900000000000:\\
\;\;\;\;\frac{b}{d} + \frac{a \cdot \frac{c}{d}}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\
\end{array}
\]
Alternative 10 Error 15.0 Cost 1232
\[\begin{array}{l}
\mathbf{if}\;c \leq -2.5 \cdot 10^{+78}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\
\mathbf{elif}\;c \leq -2.45 \cdot 10^{-32}:\\
\;\;\;\;a \cdot \frac{c}{d \cdot d + c \cdot c}\\
\mathbf{elif}\;c \leq -8.5 \cdot 10^{-39}:\\
\;\;\;\;\frac{b \cdot d + c \cdot a}{c \cdot c}\\
\mathbf{elif}\;c \leq 9.6 \cdot 10^{+15}:\\
\;\;\;\;\frac{b}{d} + \frac{a \cdot \frac{c}{d}}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\
\end{array}
\]
Alternative 11 Error 18.6 Cost 969
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.14 \cdot 10^{-38} \lor \neg \left(c \leq 7.2 \cdot 10^{-52}\right):\\
\;\;\;\;\frac{1}{c} \cdot \left(a + b \cdot \frac{d}{c}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{d}\\
\end{array}
\]
Alternative 12 Error 22.7 Cost 456
\[\begin{array}{l}
\mathbf{if}\;c \leq -2.6 \cdot 10^{-38}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq 5.5 \cdot 10^{-47}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 13 Error 37.3 Cost 192
\[\frac{a}{c}
\]