Post Reply 
FORTRAN floating point accuracy problems
05-04-2016, 06:04 PM
Post: #53
RE: FORTRAN floating point accuracy problems
(05-04-2016 02:50 PM)HP67 Wrote:  Actually I had a FLOOR function in FORTRAN that was based on the less than optimal IDINT function that I replaced with my handy-dandy assembler DINT. So this is available now. This is what I have been using, does it look ok or can it be improved:

It can be improved so that it returns correct results for integer x<0. The given implementation will return FLOOR(–3) = –4, which of course is wrong. You might test if x<0 and x≠int(x).

(05-04-2016 02:50 PM)HP67 Wrote:  Given our beautiful results above is this necessary?

The suggested changes provide correct results for arguments that are extremely small, zero or negative. I think this makes sense.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: FORTRAN floating point accuracy problems - Dieter - 05-04-2016 06:04 PM



User(s) browsing this thread: 6 Guest(s)