FORTRAN floating point accuracy problems
|
05-04-2016, 01:34 PM
(This post was last modified: 05-04-2016 02:05 PM by Dieter.)
Post: #51
|
|||
|
|||
RE: FORTRAN floating point accuracy problems
(05-04-2016 11:05 AM)HP67 Wrote: Outstanding! Thanks, Dieter! Fine. There is just one issue: if the input is very small, i.e. dms is a fraction of a second, or maybe even something below 1E–16, the input may be rounded down to zero. This can be avoided by replacing the respective lines by this: Code: If dms >= 1 Then If there was a FLOOR function the test was not required at all: k=FLOOR(log10(dms). Maybe you can write one in Assembler. ;-) Now add a few lines that handle dms<0 (there is a DSIGN function in Fortran IV) or dms=0 (simply return zero), and you're done. Edit: this could be a solution. Code: Function dms2dd(dms) If I get it right, dsign transfers the sign of the second argument to the first one, i.e. dsgn(x, y) = abs(x) * sign(y), which is quite handy here. Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)