![]() |
FEXP | Function (Macro constructor) |
timath.h |
A deprecated macro used to define floating point numbers.
Yet one deprecated macro. FEXP(m,e)
constructs
a number m*10^e
where m is a sequence
of digits (without decimal point) which is assumed to represent decimal number
m.mmmm..., e.g. FEXP(2514,5)
represents number
2.514*10^5
(251400
or 2.514e5
using
conventional exponential notation), and FEXP(42,-3)
represents
number 4.2*10^-3
(0.0042
or 4.2e-3
).
FEXP(1,3)
is 1*10^3
(1000
or 1e3
).
mantissa must be the constant sequence of digits, without leading zeros,
but the way on which FEXP
is implemented allows that
exponent may be a variable or an expression, like
FEXP(314,a)
, when even mantissa is not a constant, you
can use function ldexp10. Anyway, you don't need to
use FEXP
any more: simply use conventional exponential notation.
E.g. simply use 4.2e3
instead of FEXP(42,3)
etc.
Note that a = FEXP(m,e)
is not the same as
bcd_var(a).exponent = e+0x4000
and bcd_var(a).mantissa = m
. The first part is
true; the second is not. More precise, FEXP
shifts m to
the left enough number of times to produce correct normalized mantissa (see
bcd for more info).
So, when you type a = FEXP(352,3)
it works like
bcd_var(a).exponent = 0x4003
and bcd_var(a).mantissa = 0x3520000000000000
.
For more description about internal format of
floating point numbers, see bcd.