[Curious] Integer division => fraction

David T. Lewis lewis at mail.msen.com
Thu Jun 12 02:54:30 UTC 2003


On Thu, Jun 12, 2003 at 12:01:47AM +0200, Andreas Raab wrote:
> 
> Just had an interesting discussion with Dean (over on e-Lang) about integer
> division semantics. He pointed out (and I agree) that most people tend to
> find it it confusing that "3/4" results in a fraction rather than coercing
> to Float by default.
> 
> My questions: What do you think about this issue? Are you personally
> surprised if you get a fraction back? Has it bitten you in unexpected
> places? Have you actually ever had the need for coercing to fractions
> instead of floats? Can you think of "typical" applications that would be
> harmed by coercing to floats?

Yes, it did surprise me. And as soon as I stopped to think about it,
I was pleasantly surprised.

Lots of things in Smalltalk have surprised me.  I don't like to be
surprised for no good reason, but I'm very happy to be surprised
by something that is unexpectedly good, or that makes me thing about
something in a better way.
 
Dave



More information about the Squeak-dev mailing list