Re: [Chicken-users] Different factorial results
Thanks, John. --- On Fri, 6/3/11, Peter Bex wrote: > From: Peter Bex > Subject: Re: [Chicken-users] Different factorial results > To: "John Cowan" > Cc: "Steve Graham" , "Chicken-users" > > Date: Friday, June 3, 2011, 1:06 PM > On Fri, Jun 03, 2011 at 12:49:26PM > -0400, John Cowan wrote: > > Steve Graham scripsit: > > > > > Thanks, Mario. Worked like a charm. > Why is that not part of the base > > > package? > > > > Licensing. The numbers egg has to be GPL, > because it depends on the GMP > > (GNU Multi-precision Library) which is GPL. > > This is no longer true and hasn't been for over a year > now. > The current "numbers" code is a heavily modified version of > Scheme48's > code, which is itself based on the MIT Scheme code which > was BSD-licensed > at some point in time. > > > The overall license for Chicken, however, is BSD. > > There are alternatives to the GMP, but it is > > the gold standard: fast, accurate, space-conserving. > > The GMP-based numbers egg was actually very slow because it > made heavy > use of finalizers and malloc()ed memory. The new code > is a bit faster. > Probably a GMP-based numbers egg which uses Chicken-managed > memory would > be faster still, but the license annoys me and I still have > hopes to get > bignums in Chicken core someday :) > > It's not in core mostly because it would make things slower > (though I'm > not 100% convinced of that; there's type dispatching for > fixnums/flonums > already anyway) and because it is an extra-large additional > pile of code. > > Cheers, > Peter > -- > http://sjamaan.ath.cx > -- > "The process of preparing programs for a digital computer > is especially attractive, not only because it can be > economically > and scientifically rewarding, but also because it can be > an aesthetic > experience much like composing poetry or music." > > > -- Donald Knuth > ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Different factorial results
Hallo, On Fri, Jun 3, 2011 at 7:06 PM, Peter Bex wrote: > > It's not in core mostly because it would make things slower (though I'm > not 100% convinced of that; there's type dispatching for fixnums/flonums > already anyway) and because it is an extra-large additional pile of code. > Indeed, I don't buy the slowness argument either. Make fixnums be the fast path and branch prediction will do the rest. -- -alex http://www.artisancoder.com/ ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Different factorial results
On Fri, Jun 03, 2011 at 12:49:26PM -0400, John Cowan wrote: > Steve Graham scripsit: > > > Thanks, Mario. Worked like a charm. Why is that not part of the base > > package? > > Licensing. The numbers egg has to be GPL, because it depends on the GMP > (GNU Multi-precision Library) which is GPL. This is no longer true and hasn't been for over a year now. The current "numbers" code is a heavily modified version of Scheme48's code, which is itself based on the MIT Scheme code which was BSD-licensed at some point in time. > The overall license for Chicken, however, is BSD. > There are alternatives to the GMP, but it is > the gold standard: fast, accurate, space-conserving. The GMP-based numbers egg was actually very slow because it made heavy use of finalizers and malloc()ed memory. The new code is a bit faster. Probably a GMP-based numbers egg which uses Chicken-managed memory would be faster still, but the license annoys me and I still have hopes to get bignums in Chicken core someday :) It's not in core mostly because it would make things slower (though I'm not 100% convinced of that; there's type dispatching for fixnums/flonums already anyway) and because it is an extra-large additional pile of code. Cheers, Peter -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Different factorial results
Hi John, On Fri, 3 Jun 2011 12:49:26 -0400 John Cowan wrote: > Steve Graham scripsit: > >> Thanks, Mario. Worked like a charm. Why is that not part of the base >> package? > > Licensing. The numbers egg has to be GPL, because it depends on the GMP > (GNU Multi-precision Library) which is GPL. The overall license for > Chicken, however, is BSD. There are alternatives to the GMP, but it is > the gold standard: fast, accurate, space-conserving. Licensing is actually not the reason (see http://wiki.call-cc.org/eggref/4/numbers#license). The numbers egg is no longer based on libgmp. The full numeric tower support has some implications on performance, size and complexity of the core system. So far it's been decided that it should be left out of the core. Best wishes. Mario -- http://parenteses.org/mario ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Different factorial results
On Jun 3, 2011, at 11:49 AM, John Cowan wrote: > Steve Graham scripsit: > >> Thanks, Mario. Worked like a charm. Why is that not part of the base >> package? > > Licensing. The numbers egg has to be GPL, because it depends on the GMP > (GNU Multi-precision Library) which is GPL. numbers is BSD and hasn't depended on GMP since Peter rewrote it to use a heavily modified version of Scheme48's bignum code. numbers isn't in core mainly because Chicken tries to push functionality into eggs when possible. Jim ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Different factorial results
On Jun 3, 2011, at 9:49 AM, John Cowan wrote: Steve Graham scripsit: Thanks, Mario. Worked like a charm. Why is that not part of the base package? Licensing. The numbers egg has to be GPL, because it depends on the GMP (GNU Multi-precision Library) which is GPL. The overall license for Chicken, however, is BSD. There are alternatives to the GMP, but it is the gold standard: fast, accurate, space-conserving. Current numbers egg is w/o GMP. -- Si hoc legere scis, nimium eruditionis habes. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Different factorial results
Steve Graham scripsit: > Thanks, Mario. Worked like a charm. Why is that not part of the base > package? Licensing. The numbers egg has to be GPL, because it depends on the GMP (GNU Multi-precision Library) which is GPL. The overall license for Chicken, however, is BSD. There are alternatives to the GMP, but it is the gold standard: fast, accurate, space-conserving. -- Si hoc legere scis, nimium eruditionis habes. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Different factorial results
Thanks, Mario. Worked like a charm. Why is that not part of the base package? Eu morava nos estados de Sao Paolo e Parana desde 1971 a 1973. Eu me gostei muito desse tempo. Pardon my portuguese - it's been decades. Steve --- --- On Fri, 6/3/11, Mario Domenech Goulart wrote: > From: Mario Domenech Goulart > Subject: Re: [Chicken-users] Different factorial results > To: "Steve Graham" > Cc: "Chicken-users" > Date: Friday, June 3, 2011, 10:36 AM > Hi Steve, > > On Fri, 3 Jun 2011 07:26:58 -0700 (PDT) Steve Graham > wrote: > > > In running (factorial 50) > > > > (define (factorial n) (if (< n 2) 1 (* n (factorial > (- n 1) > > > > I found that Chicken Scheme's result differed from > Petite Chez, Kawa and Gambit. The former gave > > > > 3.04140932017134e+064 > > > > and the latter 3 gave > > > > > 30414093201713378043612608166064768844377641568960512 > > > > Why the difference? > > It seems that you are not using the numbers egg > (http://wiki.call-cc.org/egg/numbers). > > The full numeric tower support is provided as an > extension. > > Just > > $ chicken-install numbers > > csi> (use numbers) > csi> (define (factorial n) (if (< n 2) 1 (* n > (factorial (- n 1) > csi> (factorial 50) > 30414093201713378043612608166064768844377641568960512 > > > Best wishes. > Mario > -- > http://parenteses.org/mario > ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Different factorial results
Hi Steve, On Fri, 3 Jun 2011 07:26:58 -0700 (PDT) Steve Graham wrote: > In running (factorial 50) > > (define (factorial n) (if (< n 2) 1 (* n (factorial (- n 1) > > I found that Chicken Scheme's result differed from Petite Chez, Kawa and > Gambit. The former gave > > 3.04140932017134e+064 > > and the latter 3 gave > > 30414093201713378043612608166064768844377641568960512 > > Why the difference? It seems that you are not using the numbers egg (http://wiki.call-cc.org/egg/numbers). The full numeric tower support is provided as an extension. Just $ chicken-install numbers csi> (use numbers) csi> (define (factorial n) (if (< n 2) 1 (* n (factorial (- n 1) csi> (factorial 50) 30414093201713378043612608166064768844377641568960512 Best wishes. Mario -- http://parenteses.org/mario ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Different factorial results
In running (factorial 50) (define (factorial n) (if (< n 2) 1 (* n (factorial (- n 1) I found that Chicken Scheme's result differed from Petite Chez, Kawa and Gambit. The former gave 3.04140932017134e+064 and the latter 3 gave 30414093201713378043612608166064768844377641568960512 Why the difference? Steve ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users