fixnum->flonum(3scm) Scheme Programmer's Manual fixnum->flonum(3scm)

fixnum->flonum - conversion from fixnum to flonum

(import (rnrs))                     ;R6RS
(import (rnrs arithmetic flonums))  ;R6RS

(fixnum->flonum fx)

Returns a flonum that is numerically closest to fx.

The result of this procedure may not be numerically equal to fx, because the fixnum precision may be greater than the flonum precision.

Returns a single value; a flonum.

(fixnum->flonum 1)
    =>  1.0

This procedure is unique to R6RS. An alternative is to use inexact(3scm).

This procedure can raise exceptions with the following condition types:
&assertion (R6RS)
The wrong number of arguments was passed or an argument was outside its domain.

inexact(3scm)

R6RS

This procedure is new in the flonum library in R6RS.

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.

2023-08-13