[plt-scheme] question about Scheme numbers

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Sat May 13 02:01:01 EDT 2006

> Calculating the hypotenuse of a 30-60-90 right triangle I get:
>
>> (hypo (sqrt 3) 1)
> 2.0
>
> but
>
>> (square (sqrt 3))
> 2.9999999999999996
>
> How come?

Hi Peter,

There's a chapter in "How to Design Programs" that talks about this. 
Here you go: it's under Section 33 (The Nature of Inexact Numbers):

     http://htdp.org/2003-09-26/Book/curriculum-Z-H-41.html#node_chap_33

Does this help?


Good luck!


Posted on the users mailing list.