Math2.org Math Tables: Recursive Formulas for B / A |
(Math) |
Explicit form:
Find B/A where B and A are real numbers and B > 0Recursive form:
Convert B and A to scientific notation base 2 (C++ has function "frexp" for this). Note: mantissa is ³ .5 and < 1.Example: 314.51 / 5.6789Let
a = mantissa of AReiterate x until desired precision reached. Result only has to be close, not perfect. I suggest about 5 times.
b = mantissa of B
exp = exponent of b - exponent of a
x_{0} = 1
x_{n+1} = x_{n}(2 - a x_{n})
y_{0} = b x_{n}Reiterate y until desired precision reached.
y_{i+1} = y_{i} + x_{n}(b - a y_{i})B / A = y_{i} * 2^{exp}
Written in base-2 scientific notation:Source: Jeff Yates, et al.
B = 0.61357421875 * 2^{9}
A = 0.7098625 * 2^{3}
exp = 9 - 3 = 6
iteration value x_{0} 1 x_{1} 1.2901375 x_{2} 1.398740976607287 x_{3} 1.408652781763906 x_{4} 1.408723516847958
(will use this value for x)iteration value y_{0} 0.864356431284738 y_{1} 0.864356433463227 y_{2} 0.864356433463227 y_{3} 0.864356433463227 y_{4} 0.864356433463227 y_{5} 0.864356433463227
B / A = 0.864356433463227 * 2^{6} =
55.31881174171053855.318811741710538 (true value)