## Floating-point features

This page describes the new floating-point features in Version 2.3 of uLisp for 32-bit processors.

The implementation uses 32-bit floats with a 24-bit mantissa and 8-bit exponent, giving a maximum value of approximately 3.402823 × 10^{38}.

### Size and performance

The code size of the floating-point version of uLisp is approximately double the integer version. However, all the supported platforms have enough flash memory space that this not an issue.

The performance of the floating-point version is identical to the integer version; for example, the **tak** benchmark runs in 7 seconds with version 2.3 on an Arduino Due, which is the same as for the integer version 2.2. For this reason I've decided not to maintain a separate integer-only version of 32-bit uLisp, and all future releases will include floating-point support.

The existing functions have been updated, where appropriate, to handle floating-point numbers in a sensible way. Where possible routines return an exact integer; for example:

> (expt 3 19) 1162261467 > (expt 3 20) 3.48679e+09

Some functions are extended to take advantage of floating point. For example, if the argument to **random** is a floating-point number the function will return a random float between 0 and that number:

> (random 1.5) 1.36925

### New functions

There are several new functions for working with floating-point numbers:

#### Arithmetic functions

sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, log, sqrt, expt

#### Rounding functions

ceil, floor, round, truncate

#### Type conversion

float

#### Tests

floatp, integerp

For a full description of the new functions see Floating-point extensions.

### Examples

For examples of using the floating-point features see Fast Fourier Transform. I hope to add some further examples in the near future.

### Acknowledgements

I'm very grateful to Steve Losh who developed an initial version of uLisp with floating-point support.