From: Ken A. <kan...@bb...> - 2002-05-31 01:02:24
|
At 08:07 PM 5/30/2002, Nathaniel Titterton wrote: >Thanks Ken. I don't know if I will ever get used to (/ 5 2) equaling 2, >though. Thats what quotient is for! It may be one of those areas where >java and lisp/scheme are at cultural odds... Yes, it is. I just tried the two common lisps on may machine and (/ 1 2) returned 1/2 in both. In fact, (/ 1 2) might be the simplest test to see if you are programming in a green pasture, or in the big city. >-nate > > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > Nathaniel Titterton na...@so... > CITRIS PostDoc 341 Soda Hall, U.C. Berkeley, Berkeley, CA 94720 > >On Thu, 30 May 2002, Ken Anderson wrote: > > > At 06:40 PM 5/30/2002, Nathaniel Titterton wrote: > > > > >(I've posted this on the open discussion on the sourceforge site, but read > > >that I should try here as well). > > > > > >I was playing with a random number generator, and was surpised to find > > >that in JScheme > > > > > >(/ 1 2) > > > > > >was returning 0. If jscheme doesn't have exact rational numbers (I'm > > >assuming it doesn't), wouldn't it make more sense to return 0.5 instead? > > >An implemenation is free to silently do this, it says in R4RS. > > > > We did this in an earlier version of Jscheme, then called Silk. > > We now adapt Java's arithmetic model so (/ 1 2) is 0 > > and (/ 1 2.0) is 0.5. > > > > Section 6.5.3 of R4RS gives some leeway in how numbers are implemented. > > > > >-nate > > > > > > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > > > Nathaniel Titterton na...@so... > > > CITRIS PostDoc 341 Soda Hall, U.C. Berkeley, Berkeley, CA 94720 > > > > > > > > >_______________________________________________________________ > > > > > >Don't miss the 2002 Sprint PCS Application Developer's Conference > > >August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > > > > >_______________________________________________ > > >Jscheme-user mailing list > > >Jsc...@li... > > >https://lists.sourceforge.net/lists/listinfo/jscheme-user > > > > > > _______________________________________________________________ > > > > Don't miss the 2002 Sprint PCS Application Developer's Conference > > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > > > _______________________________________________ > > Jscheme-user mailing list > > Jsc...@li... > > https://lists.sourceforge.net/lists/listinfo/jscheme-user > > |