Floating point math
Daniel Berstein at <architek at GEOCITIES.COM> wrote concerning
"Floating point math":
> I think the binary floating point Euphoria uses for atom's may have
> it's benefits (maybe speed), but it has been proof that we need a way
> to store *accurate* decimal values. It seems that all "solutions"
> posted here aren't generally valid.
> The solution may come from RDS, creating a new data type, that may be
> slower for arithmetic calculations, but absolutly accurate when dealing
> with decimal values.
I think we need an assembly programmer to write some Binary
Coded Decimal (BCD) math routines which can be loaded into
Euphoria.
I downloaded a file named BCDASM.ZIP from Simtelnet. Here
is the file_id.diz:
> x86 assembly language BCD math. TASM
> 80x86 16-/32-bit routines to handle
> packed signed Binary-Coded-Decimals
> (add, sub, imul, idiv, mod, shl, shr,
> cmp, mov, load, conversion, display).
> Huge integer math. No FPU support.
> Includes multi-memory-model assembly
> source, docs, C libs, and Pascal TPU.
> TASM v3.20+ required for reassembly.
> Un-Zip with /d. (FW)(June 1997)
and an excerpt from the description file:
> General considerations
> ----------------------
>
> Numbers in business applications software must be large and
> precise. Accounting books must balance so floating-point math
> and its potential for rounding errors is insufficient.
>
> Performing business math in the CPU registers is OK if you
> can make do with numbers in the range +21,474,836.47 to
> -21,474,836.48 (32 bit). Inflation-ridden nations, large
> companies, and Italian car dealers need bigger numbers.
>
> BCD math is basic in-memory integer math that lets you handle
> numbers of considerable sizes, typically 18 digits but with
> the capacity for several thousand digits. By tradition, BCDs
> are used for business math and BCD schemes are supported by
> several computers. All Intel's iAPx86 chips (PCs) execute BCD
> instructions.
The package was written by:
> Morten Elling
> Ellemarksvej 12
> DK-8000 Aarhus C
> Denmark
>
> <mailto:elling at post1.tele.dk>
Since I am not an assembler programmer, I don't know where
to begin to adapt this stuff to Euphoria, even though the
author says:
> Copyright and disclaimer
> ------------------------
>
> This text and the accompanying assembly source files and
> binary files ("BCDASM") are copyright Morten Elling, 1997.
>
> You're free to use BCDASM for educational purposes and in
> software (freeware, shareware, or commercial) but use it
> at your own risk. BCDASM is offered without any guarantee.
>
> You're free to distribute the BCDASM file archive through
> any media at your disposal on condition that the contents
> of the file archive are not modified.
But, the possibility of exact integer math does exist for
use with Euphoria.
Larry Gregg
|
Not Categorized, Please Help
|
|