~peterpall/maxima/+git/maxima.code:rtoy-add-stavros-ulp

Last commit made on 2023-02-27
Get this branch:
git clone -b rtoy-add-stavros-ulp https://git.launchpad.net/~peterpall/maxima/+git/maxima.code

Branch merges

Branch information

Name:
rtoy-add-stavros-ulp
Repository:
lp:~peterpall/maxima/+git/maxima.code

Recent commits

179a2d6... by Raymond Toy <email address hidden>

Add some rudimentary docs for is_power_of_two & unit_in_last_place

Just add some simple docs with examples for these two new functions.

e9deaf1... by Raymond Toy <email address hidden>

Support clisp which doesn't have denormals.

Adjust the value of `+most-negative-normalized-float-exponent+` for
clisp (and other lisps where `$least_positive_float` and
`$least_positive_normalized_float` are the same).

Update tests to use `$least_positive_float` as the result instead of
using an explicit numerical value that is wrong when Lisp doesn't
support denormals.

With these changes, clisp passes all the tests except the one
involving `unit_in_last_place(float((0+2^52)/2^1073))` because that
assumes denormals are supported.

83037ed... by Raymond Toy <email address hidden>

Change expected output to use least_positive_float.

For the cases that were expecting 4.94065...e-324, use
`least_positive_float` instead because not all Lisps (Clisp) have
denormal floats.

9ed6578... by Raymond Toy <email address hidden>

Use decode-float instead of integer-decode-float

Different Lisps return different values for `integer-decode-float` of
a denormal. These different values are valid return values because
they can be used with `scale-float` to get exactly the same number
back (modulo sign).

Instead, use `decode-float` which doesn't have such leeway in possible
values. There's only one way to represent a float with a mantissa in
the range [0.5, 1) with a given exponent.

Thus, use `decode-float` to compute the ULP.

This requires changing the constant `+most-negative-float-exponent+`
to `+most-negative-normalized-float-exponent+`.

(Note: note yet checked with clisp which has only normalized floats.)

dc1a71f... by Raymond Toy <email address hidden>

Use defmfun instead of defun; some minor tweaks

We want to use `defmfun` to define the functions so we get nice error
messages for wrong number of args.

Replace `least-positive-long-float` with `+least-positive-flonum+`.

Some minor indentation changes to make things a little easier to read.

d798169... by Raymond Toy <email address hidden>

Make ulp.lisp work in maxima.

First, add `in-package` to make this part of maxima.

Second, use `+least-positive-flonum+` to determine the most negative
float exponent. (And due to a bug in cmucl's compiler, it can't
compute this correctly, so just hard-wire a value of -1126.)

3a904e8... by Raymond Toy <email address hidden>

Add ulp_tests to testsuite

Modified ulp_tests.mac not to load ulp.lisp since it's part of the
core.

353be50... by Raymond Toy <email address hidden>

Add ulp.lisp from Stavros

Add the file ulp.lisp from Stavros, as is. Update maxima.system and
maxima.asd to add this file to the numerical-functions module. (For
no particular reason.)

Also add ulp_tests.mac to tests.

a539662... by Raymond Toy <email address hidden>

Use float_eps() instead the lisp value +flonum-epsilon+

Let's use the `float_eps()` function to get flonum epsilon instead of
referring to the lisp constant `+flonum-epsilon+`.

bd17f4d... by Raymond Toy <email address hidden>

Add documentation for float properties

Document float functions like `float_bits()`, and `float_eps()`.
Document the constants like `largest_float` and friends.