Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!stanford.edu!agate!sizzlean.berkeley.edu!moews From: moews@math.berkeley.edu (David Moews) Newsgroups: comp.misc Subject: Re: Julian day numbers Message-ID: <1991Apr24.224138.2985@agate.berkeley.edu> Date: 24 Apr 91 22:41:38 GMT References: <41601@cup.portal.com> Sender: root@agate.berkeley.edu (Charlie Root) Organization: UC Berkeley Math Department Lines: 17 Originator: moews@sizzlean.berkeley.edu In article <41601@cup.portal.com> J_Otto_Tennant@cup.portal.com writes: |... | JULDAY = INT(365.25*JY)+INT(30.6001*JM)+ID+1720995 |... |First, why is the constant 30.6001? JM ranges from 4 to 15. If we |view the constant 30.6001 as (30.6 + 0.0001), the 0.0001 term is |completely irrelevant to the calculation. Why, in a book as |careful and accurate as _Numerical_Recipies_ would there be such |an irrelevant part of a constant?... The number 30.6 (= 153/5) does not have a terminating binary representation. As a result, if you just wrote `30.6' you might get a floating-point number that was actually a little smaller than 30.6. Then when you took INT(30.6*5) you might get 152 instead of 153, which would be incorrect. Adding a small fudge factor like 0.0001 prevents this. -- David Moews moews@math.berkeley.edu