diff --git a/collects/scribble/scribble.css b/collects/scribble/scribble.css index a13c34d0b7..f0eeb46478 100644 --- a/collects/scribble/scribble.css +++ b/collects/scribble/scribble.css @@ -5,6 +5,7 @@ max-width: 35em; margin-left: auto; margin-right: auto; + padding-left: 0.5em; font-family: Times; } diff --git a/collects/scribblings/guide/numbers.scrbl b/collects/scribblings/guide/numbers.scrbl index 071654d86d..2dfcebb0f8 100644 --- a/collects/scribblings/guide/numbers.scrbl +++ b/collects/scribblings/guide/numbers.scrbl @@ -76,9 +76,10 @@ types of numbers. (inexact->exact 0.1) ] -Inexact results are also produced by trancendental procedures such as -@scheme[sin] and @scheme[cos], in part because Scheme can only -represent rational numbers. +Inexact results are also produced by procedures such as @scheme[sqrt], +@scheme[log], and @scheme[sin] when an exact result would require +representing real numbers that are not rational. Scheme can represent +only rational numbers and complex numbers with rational parts. @examples[ (code:line (sin 0) (code:comment #, @t{rational...})) @@ -133,4 +134,16 @@ compares numbers considering both exactness and numerical equality. (eqv? 1 1.0) ] +Beware of comparisons involving inexact numbers, which by their nature +can have surprising behavior. Even apparently simple inexact numbers +may not mean what you think they mean; for example, while a base-2 +IEEE floating-point number can represent @scheme[1/2] exactly, it +can only approximate @scheme[1/10]: + +@examples[ +(= 1/2 0.5) +(= 1/10 0.1) +(inexact->exact 0.1) +] + @refdetails["mz:numbers"]{numbers and number procedures} diff --git a/collects/scribblings/guide/pairs.scrbl b/collects/scribblings/guide/pairs.scrbl index 0ed80d71aa..fc01e2a0ca 100644 --- a/collects/scribblings/guide/pairs.scrbl +++ b/collects/scribblings/guide/pairs.scrbl @@ -11,7 +11,7 @@ A @defterm{pair} joins two arbitrary values. The @scheme[cons] procedure constructs pairs, and the @scheme[car] and @scheme[cdr] procedures extract the first and second elements of the pair, -respectively. The @scheme[pair?] predicate recogizes pairs. +respectively. The @scheme[pair?] predicate recognizes pairs. Some pairs print by wrapping parentheses around the printed forms of the two pair elements, putting a @litchar{.} between them. diff --git a/collects/scribblings/reference/numbers.scrbl b/collects/scribblings/reference/numbers.scrbl index 5bc8a32fb2..21facb6bc5 100644 --- a/collects/scribblings/reference/numbers.scrbl +++ b/collects/scribblings/reference/numbers.scrbl @@ -61,7 +61,7 @@ infinity, or @scheme[+nan.0] if no such limit exists. A @pidefterm{fixnum} is an exact integer whose two's complement representation fit into 31 bits on a 32-bit platform or 63 bits on a 64-bit platform. Two fixnums that are @scheme[=] are also the same -according to @scheme[eq?]. Otherwise, the result of @scheme{eq?} +according to @scheme[eq?]. Otherwise, the result of @scheme[eq?] applied to two numbers is undefined. Two numbers are @scheme[eqv?] when they are both inexact or both