All Manuals > LispWorks® User Guide and Reference Manual > 38 The LISPWORKS Package

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 => double-float

Arguments
float
A float.
Values
double-float
A double-float with single-float precision.
Description

The function round-to-single-precision rounds float to single-precision format (32 bits) and returns the value as a double-float (64 bits). This function allows you to model the rounding behavior of a machine or implementation that performs 32-bit floating point arithmetic.

LispWorks supports multiple floating point formats: short-float (only on 32-bit LispWorks), 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 evaluating:

(coerce float 'double-float)
Compatibility notes

LispWorks 4.4 and previous on Windows and Linux platforms supports just one floating point format. In LispWorks 5.0 and later, at least two floating point formats are supported on all platforms.

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

LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:41