|
On Tue, 8 Aug 2000 jpcarr@TREDEGAR.COM wrote: > > <SNIP> > This is because floating point uses > a binary representation and some decimal values can't be expressed > exactly as binary numbers. > <SNIP> > Barbara Morris I always pictured this as being the same concept as the fact that we can't represent 1/3 exactly as a decimal number. (But if you stored your numbers in a Base 3 format (Trinary?), it'd be easy!) > > I noticed that in their infinite wisdom the creators of the business > language Java never included a "Decimal" variable? Is that right? and if > you wanted decimal (as uncommon as that is in the financial business world) > you have to use a math library function involving Floating point. Is that > right? I guess those people at Sun weren't propeller heads after all > huh? <VBG> "Let them eat integers !" > > This (if you are comically challenged) was a joke, so no flames. > > John Carr What a strange comment! There are very few new or original ideas in the actual programming language of Java. Its almost a wholesale copy of C++, with a few syntax changes to simplify coding. I program in something like 20 different programming languages. With the single exception of RPG (okay, and CL, too!) NONE of those languages have a "decimal" representation. NONE. (No, I don't do COBOL) The AS/400 is the only platform that I know of where the system itself can do math without doing it in either integer or floating point logic. Somehow, the AS/400 does packed as well. (Which is very useful, but bizarre..) If you do need to work around this on a non-AS/400 platform, the workaround isn't that hard, though. Just use an integer, and keep track of the decimal places in a seperate variable. When its time to display the number, throw it into a character variable, and insert a decimal place at the proper point. :) +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.