  MPOUT Log

advertisement
MPOUT
Log10
10log10 x  x
log10 x  ln10  ln x
(1)
log10 x  ln x / ln10
The subroutine MPLOG(IX,ILOGX) in mpln.for returns a multiple precision natural
logarithm.
10x
10x   exp  ln10    exp  x ln10 
x
The subroutine MPEXP(MPXP,MPEXPP) in mpexp.for returns a multiple precision
exponential.
10 JE10 y with 0  y < 1 is in scientific notation of the form d.ddd  10JE with d a
single digit.
If log10 x is greater than 0, then y is the fractional part of x.
JE = log10 x
y = log10 x – JE
If log10 x is less than 0
e.g. log10 x = -27.5; x = 3.16  10-28
JE = -abs(log10 x-1)
-(abs(-27.5-1))=-28
y=log10 x - JE
-27.5+28 = .5
Now the form is rigorously d.ddd
This set of files is used to test multi-precision input and output. Multi-precision
numbers are defined by –MPDetail.doc .htm –
IT 1
X  IB IX (1)  IB  J IX  j  1 (2)
J 1
The standard Fortran notation is
X=fract x 10JE
(3)
Where JE is an integer and
.1  fract < 1
(4)
Using the notation of (3)
log10 X  JE  log10 fract
Note that log(.1) = -1 and log (1) = 0, so that
Log10(X) = JE -1 +
The integer in the first term in the expansion with b1 is the next number. This is
used extensively in the final code. There is a bit of “funny” stuff in which the value of
this integer is lowered by 1 if the next term is negative.
Download