fortran - Adding large numbers returns strange, large numbers -
i trying calculations in fortran looks like:
large number (order e40) - large number (order e40)
i should zero. of time works, in couple of cases i'm getting weird numbers. 1 answer fortran gave me -1e20
. weird answer got 32768
, 2^15
, oddly enough.
does have clue why happening?
it's hard tell without actual code, but...
this expected if numbers sufficiently similar. while 1e20
pretty large compared 1
or 2
, pretty small compared 1e40
.
in fact, double precision, have 15-17 digits of precision. considering that, values below accuracy possible numbers in range of 1e40
.
what see numerical noise.
[ possibility, of course, trying in single precision. not possible (max. exponent ~38) , might happen. ]
Comments
Post a Comment