Hi everyone, I was wondering if there was a package to manipulate floats like the MPFR library in C... Then I found in http://stephane.ducasse.free.fr/Web/Draft/Float.pdf that using ScaledDecimal allows exact arithmetics. So I guess ScaledDecimal is the best class to use for playing with 20 decimals numbers ? :) Thanks ! Pierre
On 02 Feb 2015, at 17:22, Pierre CHANSON <chans.pierre@gmail.com> wrote:
Hi everyone, I was wondering if there was a package to manipulate floats like the MPFR library in Câ¦
Then I found in http://stephane.ducasse.free.fr/Web/Draft/Float.pdf <http://stephane.ducasse.free.fr/Web/Draft/Float.pdf> that using ScaledDecimal allows exact arithmetics. So I guess ScaledDecimal is the best class to use for playing with 20 decimals numbers ? :)
I always thought that we should look into using MPFR. There is no way that we have the knowledge or manpower to recreate that. http://www.mpfr.org <http://www.mpfr.org/> Marcus
Hi Pierre, you will find an ArbitraryPrecisionFloat package at sqeaksource that works eg in pharo3 & 4: http://www.squeaksource.com/ArbitraryPrecisionFl.html werner
2015-02-02 13:51 GMT-03:00 Werner Kassens <wkassens@libello.com>:
Hi Pierre, you will find an ArbitraryPrecisionFloat package at sqeaksource that works eg in pharo3 & 4: http://www.squeaksource.com/ArbitraryPrecisionFl.html
Thanks Werner, I will have a look
we should move it to scitalk ;) Le 2/2/15 17:51, Werner Kassens a écrit :
Hi Pierre, you will find an ArbitraryPrecisionFloat package at sqeaksource that works eg in pharo3 & 4: http://www.squeaksource.com/ArbitraryPrecisionFl.html werner
Hi Stephane, <g> it _is_ in scitalk, at the moment only in the #development version, but i'd guess, that will change in a while. Hi Pierre, the problem - as Stephane pointed out - is that ScaledDecimal essentially is a Fraction, which depending on which function you use can be transformed to Float, iow you _can_ loose precision with it, i'd be careful and look at the implementations of the functions you use in Fraction; as far as i can see, ScaledDecimals reason of existence is not really to make arbitrary precision calculations possible. otoh ArbitraryPrecisionFloat is a package, that is not really fast, but as precise as you want it to be (with the implemented functions). werner On 02/02/2015 09:43 PM, stepharo wrote:
we should move it to scitalk ;) Le 2/2/15 17:51, Werner Kassens a écrit :
Hi Pierre, you will find an ArbitraryPrecisionFloat package at sqeaksource that works eg in pharo3 & 4: http://www.squeaksource.com/ArbitraryPrecisionFl.html werner
Then I found in http://stephane.ducasse.free.fr/Web/Draft/Float.pdf that using ScaledDecimal allows exact arithmetics. So I guess ScaledDecimal is the best class to use for playing with 20 decimals numbers ? :)
I always thought that we should look into using MPFR.
There is no way that we have the knowledge or manpower to recreate that.
Indeed we could define a plugin.
Marcus
Pay attention ScaledDecimal are just fraction. Le 2/2/15 17:22, Pierre CHANSON a écrit :
Hi everyone, I was wondering if there was a package to manipulate floats like the MPFR library in C... Then I found in http://stephane.ducasse.free.fr/Web/Draft/Float.pdf that using ScaledDecimal allows exact arithmetics. So I guess ScaledDecimal is the best class to use for playing with 20 decimals numbers ? :)
Thanks !
Pierre
Le 02/02/2015 19:11, Pierre CHANSON a écrit :
2015-02-02 13:49 GMT-03:00 stepharo <stepharo@free.fr <mailto:stepharo@free.fr>>:
Pay attention ScaledDecimal are just fraction.
Yes sure but I think it would be ok for me later, for example using ScaledDecimal readFrom: '0.000006515031360099368', then I can manipulate this.
As informative as it could be, in computation it appears to me ScaledDecimal are slower than Float. Hilaire -- Dr. Geo - http://drgeo.eu iStoa - http://istoa.drgeo.eu
On Mon, Feb 2, 2015 at 5:22 PM, Pierre CHANSON <chans.pierre@gmail.com> wrote:
Hi everyone, I was wondering if there was a package to manipulate floats like the MPFR library in C...
One issue with MPFR is the licensing, which is GNU. I wonder if Pharo couldn't get a special licence for embedding as "MPFR has continuously been supported by the INRIA <http://www.inria.fr/>...". Pharo is now 32-bit and uses the floatplugin to do the actual fast math. Pharo with the 64-bit system will be able to do better and the float plugin will have to be rewritten anyway. But MPFR could be put into a plugin. As far as I am concerned, I'd rather get something based on GMP ( https://gmplib.org/) but we are there in GNU territory. Which is not what I want for commercial apps. This table: http://www.mpfr.org/mpfr-current/timings.html is showing some LGPL licencing that may be easier to deal with. But for sure, none of that is MIT :-( Phil
Then I found in http://stephane.ducasse.free.fr/Web/Draft/Float.pdf that using ScaledDecimal allows exact arithmetics. So I guess ScaledDecimal is the best class to use for playing with 20 decimals numbers ? :)
Thanks !
Pierre
On 02 Feb 2015, at 17:58, phil@highoctane.be wrote:
On Mon, Feb 2, 2015 at 5:22 PM, Pierre CHANSON <chans.pierre@gmail.com <mailto:chans.pierre@gmail.com>> wrote: Hi everyone, I was wondering if there was a package to manipulate floats like the MPFR library in C...
One issue with MPFR is the licensing, which is GNU.
I wonder if Pharo couldn't get a special licence for embedding as "MPFR has continuously been supported by the INRIA <http://www.inria.fr/>...".
Pharo is now 32-bit and uses the floatplugin to do the actual fast math.
Pharo with the 64-bit system will be able to do better and the float plugin will have to be rewritten anyway.
But MPFR could be put into a plugin.
As far as I am concerned, I'd rather get something based on GMP (https://gmplib.org/ <https://gmplib.org/>) but we are there in GNU territory. Which is not what I want for commercial apps.
This table: http://www.mpfr.org/mpfr-current/timings.html <http://www.mpfr.org/mpfr-current/timings.html> is showing some LGPL licencing that may be easier to deal with. But for sure, none of that is MIT :-(
Libc on unix is LGPL, too⦠it works well for C style libraries. Marcus
On Tue, Feb 3, 2015 at 12:58 AM, phil@highoctane.be <phil@highoctane.be> wrote:
On Mon, Feb 2, 2015 at 5:22 PM, Pierre CHANSON <chans.pierre@gmail.com> wrote:
Hi everyone, I was wondering if there was a package to manipulate floats like the MPFR library in C...
One issue with MPFR is the licensing, which is GNU.
No, its LGPL (http://www.mpfr.org/). Now something I didn't know and just read, you can even statically link an LGPL library, as long as you provide
I wonder if Pharo couldn't get a special licence for embedding as "MPFR has continuously been supported by the INRIA <http://www.inria.fr/>...".
Pharo is now 32-bit and uses the floatplugin to do the actual fast math.
Pharo with the 64-bit system will be able to do better and the float plugin will have to be rewritten anyway.
But MPFR could be put into a plugin.
As far as I am concerned, I'd rather get something based on GMP ( https://gmplib.org/) but we are there in GNU territory. Which is not what I want for commercial apps.
Why GMP? From the timings table it looks like GMP is missing trigonometric functions, and that MPFR is equally as fast as GMP. cheers -ben
This table: http://www.mpfr.org/mpfr-current/timings.html is showing some LGPL licencing that may be easier to deal with. But for sure, none of that is MIT :-(
Phil
Then I found in http://stephane.ducasse.free.fr/Web/Draft/Float.pdf that using ScaledDecimal allows exact arithmetics. So I guess ScaledDecimal is the best class to use for playing with 20 decimals numbers ? :)
Thanks !
Pierre
Hi Werner, you are right, I will try it 2015-02-03 10:22 GMT-03:00 Ben Coman <btc@openinworld.com>:
On Tue, Feb 3, 2015 at 12:58 AM, phil@highoctane.be <phil@highoctane.be> wrote:
On Mon, Feb 2, 2015 at 5:22 PM, Pierre CHANSON <chans.pierre@gmail.com> wrote:
Hi everyone, I was wondering if there was a package to manipulate floats like the MPFR library in C...
One issue with MPFR is the licensing, which is GNU.
No, its LGPL (http://www.mpfr.org/). Now something I didn't know and just read, you can even statically link an LGPL library, as long as you provide
I wonder if Pharo couldn't get a special licence for embedding as "MPFR has continuously been supported by the INRIA <http://www.inria.fr/>...".
Pharo is now 32-bit and uses the floatplugin to do the actual fast math.
Pharo with the 64-bit system will be able to do better and the float plugin will have to be rewritten anyway.
But MPFR could be put into a plugin.
As far as I am concerned, I'd rather get something based on GMP ( https://gmplib.org/) but we are there in GNU territory. Which is not what I want for commercial apps.
Why GMP? From the timings table it looks like GMP is missing trigonometric functions, and that MPFR is equally as fast as GMP. cheers -ben
This table: http://www.mpfr.org/mpfr-current/timings.html is showing some LGPL licencing that may be easier to deal with. But for sure, none of that is MIT :-(
Phil
Then I found in http://stephane.ducasse.free.fr/Web/Draft/Float.pdf that using ScaledDecimal allows exact arithmetics. So I guess ScaledDecimal is the best class to use for playing with 20 decimals numbers ? :)
Thanks !
Pierre
participants (7)
-
Ben Coman -
Hilaire -
Marcus Denker -
phil@highoctane.be -
Pierre CHANSON -
stepharo -
Werner Kassens