RE: arithmetic
- Posted by irv at take.maxleft.com
Jun 01, 2002
George Walters wrote:
> the inability of binary computers to accurately represent base 10
> numbers
> has been known since the beginning of computers, however, languages
> (i.e.
> fortran, basic, cobol,and any language i've ever used) deals with it
> where
> an equal (=) for normal arithmetic is useful.
George:
Fortran has exactly the same floating point errors as
Euphoria, if you're comparing floating point numbers.
See http://www.lahey.com/float.htm
COBOL has the same problem, but COBOL programmers
rarely use floating point, because COBOL has a
decimal type. Which for all practical purposes is
just integer math, with an imaginary decimal point
inserted on display. You can do the same thing with
Euphoria. See http://cobolreport.com/pp/part2.asp
As for Basic, I don't know, haven't used it in years,
but I do see that BCD math packages are available
as add-ons for Visual Basic, so I guess it can't handle
decimal arithmetic either, without help. CBasic came
with BCD math built-in, but it cost $4,000.
Borland's Turbo Pascal 3.0 offered a version with
a built-in BCD type. Later versions dropped support for
this. Guess it wasn't very popular.
Regards.
Irv
|
Not Categorized, Please Help
|
|