PCjr NMI and 8253 Timer interactions

Guy Sotomayor ggs at shiresoft.com
Thu Oct 1 03:08:12 CDT 2009


On Sep 30, 2009, at 7:17 PM, Michael B. Brutman wrote:

> Fred Cisin wrote:
>> On Wed, 30 Sep 2009, Guy Sotomayor wrote:
>>> <rant>
>>> Why do people always seem to want to have elapsed time as a floating
>>> point number?
>>> </rant>
>> Because some of the CRAP that they learned in school makes them  
>> think that
>> truncation (or even rounding) to an int value "isn't the RIGHT  
>> answer".
>> In the XenoSoft Sales Tax Genie, I wrote a very small TSR that  
>> calculated
>> the sales tax of every California jurisdiction (based on ZIPCODE),  
>> rounded
>> appropriately to an "exact" cents amount. I NEVER used floating  
>> point.
>> I do not HAVE any "fraction of a cent" coins!
>> --
>> Grumpy Ol' Fred     		cisin at xenosoft.com
>
> I think that both of you are making assumptions about my education,  
> upbringing, etc. that are not true and I'd like you to calm down.

Please re-read what *I* said.  Your original post contained:

  float elapsed = ticks * 0.85;

Which is what *I* had the <rant> about.

>
> I've used that trick in all of my other TCP/IP apps so far - they  
> all report elapsed time (sometimes with decimal points), and I  
> managed to do it without ever linking in the floating point library.
>
> I was using this to explore other methods ..
>
> I don't know what CRAP you learned, but I would try to be more  
> gracious ...
>

Part of my job is to maintain/manage time for a particular OS.  In  
that OS all time (internally) is kept as a 64-bit number of  
nanoseconds (10**-9 seconds).  However, the number of people that  
insist that it be converted to a floating point number so that they  
can have seconds and fractional seconds (and then want to do math on  
it) is astounding.  I tend to overreact on this topic because floating  
point to represent time is idiotic IMHO especially since some of the  
low level conversion constants I deal with are specified in  
femtoseconds (10**-15 seconds).  If I can do everything necessary to  
maintain time in integer values at those precisions then I fail to  
understand why anyone needs to deal with time as a floating point  
value.  In case anyone is wondering, 64-bits of nanoseconds can  
represent a time span of over 500 years.

TTFN - Guy


More information about the cctalk mailing list