1. Floating point math
- Posted by Daniel Berstein <architek at GEOCITIES.COM>
Jun 22, 1997
-
Last edited Jun 23, 1997
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.
--
Regards,
Daniel Berstein
architek at geocities.com
http://www.geocities.com/SiliconValley/Heights/9316
2. 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
3. Floating point math
Architek wrote:
>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.
>--
>Regards,
> Daniel Berstein
> architek at geocities.com
> http://www.geocities.com/SiliconValley/Heights/9316
Yes!!! Thank you Daniel, exactly my feeling!
Ad Rienks
4. Floating point math
Larry Gregg writes:
>>> A lot of interesting stuff <<<
>But, the possibility of exact integer math does exist for
>use with Euphoria.
>Larry Gregg
I'm very much interested. I could have a try at the assembly routines, as=
I
used to write small things (only trying to get my hands dirty) in A86, a
very good assembler program. The big problem is I have a daytime job and
also other interests besides programming. So don't expect miracles from m=
e
within a few days ):
I'll see how far I can get!
Ad Rienks
5. Re: Floating point math
Larry Gregg wrote:
> 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:
Looks interesting, I'll peek at it.
> But, the possibility of exact integer math does exist for
> use with Euphoria.
Lets hope this changes in the future.
--
Regards,
Daniel Berstein
architek at geocities.com
http://www.geocities.com/SiliconValley/Heights/9316