NextPrevUpTopContentsIndex

round-to-single-precision

Function
Summary

Rounds the given float to single-precision format (32 bits) and returns it as a double-float (64 bits).

Package

lispworks

Signature

round-to-single-precision float => float

Arguments

float

A float

Values

float

A double-float with single-float precision.

Description

The argument is rounded to single-precision format (32 bits) and returned as a double-float (64 bits). This function allows you to model the rounding behaviour of a machine or implementation that performs 32-bit floating point arithmetic.

The default size on Windows and Linux is 64 bits as specified by the IEEE standard.

On LispWorks for UNIX only (not LispWorks for Linux), LispWorks supports 3 floating point formats, short-float, single-float and double-float. If this function is called with a single-float or a short-float, it returns the equivalent double-float, that is, it is the same as doing
(coerce float 'double-float)

Example
CL-USER 197 > pi
3.141592653589793D0
 
CL-USER 198 > round-to-single-precision pi
3.1415927410125732D0

LispWorks Reference Manual - 23 Jul 2004

NextPrevUpTopContentsIndex