Node:Exactness, Next:, Previous:Complex Numbers, Up:Numbers

21.2.5 Exact and Inexact Numbers

R5RS requires that a calculation involving inexact numbers always produces an inexact result. To meet this requirement, Guile distinguishes between an exact integer value such as 5 and the corresponding inexact real value which, to the limited precision available, has no fractional part, and is printed as 5.0. Guile will only convert the latter value to the former when forced to do so by an invocation of the inexact->exact procedure.

exact? x Scheme Procedure
scm_exact_p (x) C Function
Return #t if x is an exact number, #f otherwise.

inexact? x Scheme Procedure
scm_inexact_p (x) C Function
Return #t if x is an inexact number, #f else.

inexact->exact z Scheme Procedure
scm_inexact_to_exact (z) C Function
Return an exact number that is numerically closest to z.

exact->inexact z Scheme Procedure
Convert the number z to its inexact representation.