25 Avr
2013
25 Avr
'13
12:54
Hi! Aha. Is there any difference between ##flonum->fixnum , ##flonum.->fixnum and ##fl->fx? (And in the other direction, ##fixnum->flonum , ##flonum.<-fixnum and ##fl<-fx ) Brgds 2013/4/25 Marc Feeley <feeley@iro.umontreal.ca> > > On 2013-04-24, at 7:55 PM, Marc Feeley <feeley@iro.umontreal.ca> wrote: > > > > > On 2013-04-24, at 3:32 PM, Mikael <mikael.rcv@gmail.com> wrote: > > > >> Ah, realized that Gambit makes a difference internally between 1e25 and > 10000000000000000000000000 . So added a test also for the latter. > >> > >> > >> Got 6,794,405 per second for |->integer| - fair enough! > >> > >> And got 384,459 for |->flonum| - could be faster. > >> > >> > >>> (->integer-test5) > >> 6794405.8 > >>> (->flonum-test5) > >> 384459.2 > >> > >> > >> Def: > >> (define (->integer-test5) (test (->integer 10000000000000000000000000))) > >> > >> (define (->flonum-test5) (test (->flonum 10000000000000000000000000))) > >> > > > > Here are some other options: > > > >> (##flonum.->fixnum 1.5e6) > > 1500000 > >> (##flonum.->exact-int 1.5e20) > > 150000000000000000000 > >> (##flonum.<-fixnum 123456) > > 123456. > >> (##flonum.<-exact-int 1234567890123456) > > 1.234567890123456e15 > > And also these primitives: > > > (##flonum->fixnum 12.3) > 12 > > (##fixnum->flonum 123) > 123. > > These are inlined by gsc, so they should run at the same speed as C. > > Marc > >