[Curious] Integer division => fraction

Diego Gomez Deck diegogomezdeck at consultar.com
Thu Jun 12 08:05:46 UTC 2003


Hi Andreas,

I found Fractions not only great for every-day use, but also a great 
entry-example for newbies.

Everytime I had to present Smalltalk to an audience, the 1 / 3 and 
1000 factorial examples are included.

Also I used to explain double-dispatch using the coercion mechanism 
behind the Number operations.

> Are you personally surprised if you get a fraction back?

Yes... and I use this "surprise" to show (in a nutshell) some of the 
strengths of Smalltalk.

My $ 1/50,

Diego


> Hi Guys,
>
> 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?
>
> Thanks for any info you can share.
>
> Cheers,
>   - Andreas




More information about the Squeak-dev mailing list