Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
\]
↓
\[\begin{array}{l}
t_0 := a \cdot c + b \cdot d\\
t_1 := \frac{a}{c} + d \cdot \frac{b}{{c}^{2}}\\
t_2 := c \cdot c + d \cdot d\\
\mathbf{if}\;c \leq -7.5 \cdot 10^{+63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -6.9 \cdot 10^{-143}:\\
\;\;\;\;\frac{t_0}{t_2}\\
\mathbf{elif}\;c \leq 1.2 \cdot 10^{-125}:\\
\;\;\;\;\frac{b}{d} + c \cdot \frac{a}{{d}^{2}}\\
\mathbf{elif}\;c \leq 5.5 \cdot 10^{+91}:\\
\;\;\;\;\frac{1}{t_2} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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 (+ (* a c) (* b d)))
(t_1 (+ (/ a c) (* d (/ b (pow c 2.0)))))
(t_2 (+ (* c c) (* d d))))
(if (<= c -7.5e+63)
t_1
(if (<= c -6.9e-143)
(/ t_0 t_2)
(if (<= c 1.2e-125)
(+ (/ b d) (* c (/ a (pow d 2.0))))
(if (<= c 5.5e+91) (* (/ 1.0 t_2) t_0) 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 = (a * c) + (b * d);
double t_1 = (a / c) + (d * (b / pow(c, 2.0)));
double t_2 = (c * c) + (d * d);
double tmp;
if (c <= -7.5e+63) {
tmp = t_1;
} else if (c <= -6.9e-143) {
tmp = t_0 / t_2;
} else if (c <= 1.2e-125) {
tmp = (b / d) + (c * (a / pow(d, 2.0)));
} else if (c <= 5.5e+91) {
tmp = (1.0 / t_2) * t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = ((a * c) + (b * d)) / ((c * c) + (d * d))
end function
↓
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (a * c) + (b * d)
t_1 = (a / c) + (d * (b / (c ** 2.0d0)))
t_2 = (c * c) + (d * d)
if (c <= (-7.5d+63)) then
tmp = t_1
else if (c <= (-6.9d-143)) then
tmp = t_0 / t_2
else if (c <= 1.2d-125) then
tmp = (b / d) + (c * (a / (d ** 2.0d0)))
else if (c <= 5.5d+91) then
tmp = (1.0d0 / t_2) * t_0
else
tmp = t_1
end if
code = tmp
end function
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 = (a * c) + (b * d);
double t_1 = (a / c) + (d * (b / Math.pow(c, 2.0)));
double t_2 = (c * c) + (d * d);
double tmp;
if (c <= -7.5e+63) {
tmp = t_1;
} else if (c <= -6.9e-143) {
tmp = t_0 / t_2;
} else if (c <= 1.2e-125) {
tmp = (b / d) + (c * (a / Math.pow(d, 2.0)));
} else if (c <= 5.5e+91) {
tmp = (1.0 / t_2) * t_0;
} else {
tmp = 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 = (a * c) + (b * d)
t_1 = (a / c) + (d * (b / math.pow(c, 2.0)))
t_2 = (c * c) + (d * d)
tmp = 0
if c <= -7.5e+63:
tmp = t_1
elif c <= -6.9e-143:
tmp = t_0 / t_2
elif c <= 1.2e-125:
tmp = (b / d) + (c * (a / math.pow(d, 2.0)))
elif c <= 5.5e+91:
tmp = (1.0 / t_2) * t_0
else:
tmp = 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(Float64(a * c) + Float64(b * d))
t_1 = Float64(Float64(a / c) + Float64(d * Float64(b / (c ^ 2.0))))
t_2 = Float64(Float64(c * c) + Float64(d * d))
tmp = 0.0
if (c <= -7.5e+63)
tmp = t_1;
elseif (c <= -6.9e-143)
tmp = Float64(t_0 / t_2);
elseif (c <= 1.2e-125)
tmp = Float64(Float64(b / d) + Float64(c * Float64(a / (d ^ 2.0))));
elseif (c <= 5.5e+91)
tmp = Float64(Float64(1.0 / t_2) * t_0);
else
tmp = 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 = (a * c) + (b * d);
t_1 = (a / c) + (d * (b / (c ^ 2.0)));
t_2 = (c * c) + (d * d);
tmp = 0.0;
if (c <= -7.5e+63)
tmp = t_1;
elseif (c <= -6.9e-143)
tmp = t_0 / t_2;
elseif (c <= 1.2e-125)
tmp = (b / d) + (c * (a / (d ^ 2.0)));
elseif (c <= 5.5e+91)
tmp = (1.0 / t_2) * t_0;
else
tmp = 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[(N[(a * c), $MachinePrecision] + N[(b * d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a / c), $MachinePrecision] + N[(d * N[(b / N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -7.5e+63], t$95$1, If[LessEqual[c, -6.9e-143], N[(t$95$0 / t$95$2), $MachinePrecision], If[LessEqual[c, 1.2e-125], N[(N[(b / d), $MachinePrecision] + N[(c * N[(a / N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 5.5e+91], N[(N[(1.0 / t$95$2), $MachinePrecision] * t$95$0), $MachinePrecision], t$95$1]]]]]]]
\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
↓
\begin{array}{l}
t_0 := a \cdot c + b \cdot d\\
t_1 := \frac{a}{c} + d \cdot \frac{b}{{c}^{2}}\\
t_2 := c \cdot c + d \cdot d\\
\mathbf{if}\;c \leq -7.5 \cdot 10^{+63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -6.9 \cdot 10^{-143}:\\
\;\;\;\;\frac{t_0}{t_2}\\
\mathbf{elif}\;c \leq 1.2 \cdot 10^{-125}:\\
\;\;\;\;\frac{b}{d} + c \cdot \frac{a}{{d}^{2}}\\
\mathbf{elif}\;c \leq 5.5 \cdot 10^{+91}:\\
\;\;\;\;\frac{1}{t_2} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
Alternatives Alternative 1 Error 15.1 Cost 7568
\[\begin{array}{l}
t_0 := a \cdot c + b \cdot d\\
t_1 := \frac{a}{c} + d \cdot \frac{b}{{c}^{2}}\\
t_2 := c \cdot c + d \cdot d\\
\mathbf{if}\;c \leq -8.5 \cdot 10^{+63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -6.9 \cdot 10^{-143}:\\
\;\;\;\;\frac{t_0}{t_2}\\
\mathbf{elif}\;c \leq 2.9 \cdot 10^{-125}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 4.9 \cdot 10^{+92}:\\
\;\;\;\;\frac{1}{t_2} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 2 Error 22.7 Cost 1892
\[\begin{array}{l}
t_0 := c \cdot c + d \cdot d\\
t_1 := \frac{c}{t_0} \cdot a\\
\mathbf{if}\;c \leq -1.25 \cdot 10^{+47}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq -2.25 \cdot 10^{+29}:\\
\;\;\;\;\frac{b}{t_0} \cdot d\\
\mathbf{elif}\;c \leq -0.43:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -1.9 \cdot 10^{-40}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq -9.5 \cdot 10^{-120}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 1.2 \cdot 10^{-122}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 2.9 \cdot 10^{-65}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 850000:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 8.5 \cdot 10^{+151}:\\
\;\;\;\;\frac{a}{t_0} \cdot c\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 3 Error 22.6 Cost 1892
\[\begin{array}{l}
t_0 := c \cdot c + d \cdot d\\
t_1 := \frac{c}{t_0} \cdot a\\
\mathbf{if}\;c \leq -1.35 \cdot 10^{+47}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq -2.1 \cdot 10^{+29}:\\
\;\;\;\;\frac{b}{t_0} \cdot d\\
\mathbf{elif}\;c \leq -0.24:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -5.8 \cdot 10^{-41}:\\
\;\;\;\;\frac{d}{t_0} \cdot b\\
\mathbf{elif}\;c \leq -3.85 \cdot 10^{-118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 1.2 \cdot 10^{-122}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 2.65 \cdot 10^{-65}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 240000:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 8.5 \cdot 10^{+151}:\\
\;\;\;\;\frac{a}{t_0} \cdot c\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 4 Error 22.7 Cost 1892
\[\begin{array}{l}
t_0 := c \cdot c + d \cdot d\\
t_1 := \frac{a}{\frac{t_0}{c}}\\
\mathbf{if}\;c \leq -3.5 \cdot 10^{+47}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq -2.25 \cdot 10^{+29}:\\
\;\;\;\;\frac{b}{t_0} \cdot d\\
\mathbf{elif}\;c \leq -0.85:\\
\;\;\;\;\frac{c}{t_0} \cdot a\\
\mathbf{elif}\;c \leq -1.6 \cdot 10^{-40}:\\
\;\;\;\;\frac{d}{t_0} \cdot b\\
\mathbf{elif}\;c \leq -2 \cdot 10^{-119}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 1.2 \cdot 10^{-122}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 2.2 \cdot 10^{-64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 370000:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 8.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{a}{t_0} \cdot c\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 5 Error 22.7 Cost 1892
\[\begin{array}{l}
t_0 := c \cdot c + d \cdot d\\
t_1 := \frac{b}{\frac{t_0}{d}}\\
t_2 := \frac{a}{\frac{t_0}{c}}\\
\mathbf{if}\;c \leq -1.25 \cdot 10^{+47}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq -2.25 \cdot 10^{+29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -0.23:\\
\;\;\;\;\frac{c}{t_0} \cdot a\\
\mathbf{elif}\;c \leq -1.6 \cdot 10^{-40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -4.9 \cdot 10^{-119}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq 1.2 \cdot 10^{-122}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 2.6 \cdot 10^{-65}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq 860000:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 9 \cdot 10^{+151}:\\
\;\;\;\;\frac{a}{t_0} \cdot c\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 6 Error 22.7 Cost 1892
\[\begin{array}{l}
t_0 := c \cdot c + d \cdot d\\
t_1 := \frac{b}{\frac{t_0}{d}}\\
\mathbf{if}\;c \leq -2.05 \cdot 10^{+45}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq -1.95 \cdot 10^{+29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -9.5:\\
\;\;\;\;\frac{c}{t_0} \cdot a\\
\mathbf{elif}\;c \leq -9 \cdot 10^{-41}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -2 \cdot 10^{-119}:\\
\;\;\;\;\frac{a}{\frac{t_0}{c}}\\
\mathbf{elif}\;c \leq 1.15 \cdot 10^{-123}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 2.7 \cdot 10^{-65}:\\
\;\;\;\;\frac{c \cdot a}{t_0}\\
\mathbf{elif}\;c \leq 350000:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 8.5 \cdot 10^{+151}:\\
\;\;\;\;\frac{a}{t_0} \cdot c\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 7 Error 22.7 Cost 1892
\[\begin{array}{l}
t_0 := c \cdot c + d \cdot d\\
t_1 := \frac{b}{\frac{t_0}{d}}\\
\mathbf{if}\;c \leq -2.6 \cdot 10^{+45}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq -2.9 \cdot 10^{+28}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -0.25:\\
\;\;\;\;\frac{c}{t_0} \cdot a\\
\mathbf{elif}\;c \leq -1.65 \cdot 10^{-40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -3.85 \cdot 10^{-118}:\\
\;\;\;\;\frac{a}{\frac{t_0}{c}}\\
\mathbf{elif}\;c \leq 1.06 \cdot 10^{-122}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 5.5 \cdot 10^{-65}:\\
\;\;\;\;\frac{1}{t_0} \cdot \left(c \cdot a\right)\\
\mathbf{elif}\;c \leq 300000:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 1.55 \cdot 10^{+152}:\\
\;\;\;\;\frac{a}{t_0} \cdot c\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 8 Error 23.9 Cost 1628
\[\begin{array}{l}
t_0 := c \cdot c + d \cdot d\\
t_1 := \frac{a}{t_0} \cdot c\\
\mathbf{if}\;c \leq -2.8 \cdot 10^{+46}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq -7.4 \cdot 10^{+28}:\\
\;\;\;\;\frac{b}{t_0} \cdot d\\
\mathbf{elif}\;c \leq -5.7:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -4.4 \cdot 10^{-41}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq -3.85 \cdot 10^{-118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 7.2 \cdot 10^{-111}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 3.6 \cdot 10^{-64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 4.4 \cdot 10^{+76}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 9 Error 16.0 Cost 1616
\[\begin{array}{l}
t_0 := c \cdot c + d \cdot d\\
t_1 := a \cdot c + b \cdot d\\
\mathbf{if}\;c \leq -5.7 \cdot 10^{+118}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq -6.5 \cdot 10^{-148}:\\
\;\;\;\;\frac{t_1}{t_0}\\
\mathbf{elif}\;c \leq 7.8 \cdot 10^{-126}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 1.55 \cdot 10^{+95}:\\
\;\;\;\;\frac{1}{t_0} \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 10 Error 16.0 Cost 1488
\[\begin{array}{l}
t_0 := \frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -3.9 \cdot 10^{+117}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq -3.6 \cdot 10^{-145}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.4 \cdot 10^{-124}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 3.1 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 11 Error 23.9 Cost 1100
\[\begin{array}{l}
\mathbf{if}\;c \leq -3.5 \cdot 10^{+47}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;c \leq 7.2 \cdot 10^{-111}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq 8.2 \cdot 10^{-65}:\\
\;\;\;\;\frac{a}{c \cdot c + d \cdot d} \cdot c\\
\mathbf{elif}\;c \leq 7.2 \cdot 10^{+76}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\]
Alternative 12 Error 23.8 Cost 720
\[\begin{array}{l}
\mathbf{if}\;d \leq -2.2 \cdot 10^{+52}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{-43}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{-15}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;d \leq 1.85 \cdot 10^{+43}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{d}\\
\end{array}
\]
Alternative 13 Error 37.1 Cost 192
\[\frac{a}{c}
\]