Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-01

General Decimal Arithmetic

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

Hi List,
About 18 months ago I started on writng a General Decimal Arithmetic unit/library based on Mike Colishaw's work
<http://www2.hursley.ibm.com/decimal> conforming to IEEE 854-1987 standard. Sickness prevented me from completing this work and I am now ready to give it another try. Before I start I would like some sort of feedback from the list about the viability of this project.

Basically the calling programme would have to pass the following parameters to the Free Pascal unit:
1. Rounding type
2. Number of digits (precision)
3. SubNormal numbers (boolean)
4. plus several other parameters depending on the type of the arithmetic and the speed of the operations.

Questions:
1. Is this type of unit a necessary or useful as part of Free Pascal?
2. Are these operations presently available within Free Pascal?
3. Can we do without this capability?
4. How useful will this unit be in practical applications?

Regards

John

Reply by email

mm
to Vincent Snijders
Vincent Snijders wrote 6 lines
schreef: > 2. Are these operations presently available within Free Pascal? AFAIK, not distributed and installed by default with Free Pascal. There are a number of arbitrary precision libs around, for example bigint from: http://www.polarhome.com/~franco

Regarding big floats, I know only two libraries, the one of Wolfgang Ehrhardt:
http://home.netsurf.de/wolfgang.ehrhardt/mp_intro.html and mine:
http://www.ellipsa.net/public/nx/

But they don't follow IEEE standards. With multiprecision numbers, this is not always possible and, overall, it would be a small disaster for the running times. For instance, correctly implementing the "Inexact" error as described in the IEEE standard increases the code size and slows down computations for a questionable usefulness [*] (with floating point numbers, what is exceptional is not an inexact result but an exact one). Even the subnormal numbers are not really necessary (the only benefit is that, with them, we always have ((A-B = 0) <-> (A = B))).

[*] Of course, in case of a fixed (small) precision decimal library, like the one of the OP, it might be necessary. "Decimal" libraries are mainly aimed at financial computations.

mm

Reply by email

Unknown author
mm wrote 27 lines
Vincent Snijders a écrit : > schreef: >> 2. Are these operations presently available within Free Pascal? > > AFAIK, not distributed and installed by default with Free Pascal. There > are a number of arbitrary precision libs around, for example bigint from: > http://www.polarhome.com/~franco Regarding big floats, I know only two libraries, the one of Wolfgang Ehrhardt: http://home.netsurf.de/wolfgang.ehrhardt/mp_intro.html and mine: http://www.ellipsa.net/public/nx/ But they don't follow IEEE standards. With multiprecision numbers, this is not always possible and, overall, it would be a small disaster for the running times. For instance, correctly implementing the "Inexact" error as described in the IEEE standard increases the code size and slows down computations for a questionable usefulness [*] (with floating point numbers, what is exceptional is not an inexact result but an exact one). Even the subnormal numbers are not really necessary (the only benefit is that, with them, we always have ((A-B = 0) <-> (A = B))). [*] Of course, in case of a fixed (small) precision decimal library, like the one of the OP, it might be necessary. "Decimal" libraries are mainly aimed at financial computations.

I have investigated the above links and it would appear that I would be duplicating the efforts of others for very little (if any) gain. For my self interest will study the code in these libraries and thank you those who responded.

Regards

John

Reply by email