The real problem is not printing the float, is that VECTOR-MIN-ANGLE returns a value that seems to be incorrect. Upon trying to debug by FORMATing mocl crashes.
- simon, 2365 days ago
It appears that, due to ordinary float round-off issues, the argument to acos inside vector-min-angle is equal to (+ 1.0 double-float-epsilon) rather than exactly 1.0. For arguments greater than 1, acos should technically return a complex number; but, mocl does not support the ANSI complex number type, so it returns float NaN, which crashes the printer.
I've updated the mocl printer to print NaN, crash-free, in commit fdebed8.
NaN, +Infinity, and -Infinity will print as #<float NaN>, #<float +Infinity>, and #<float -Infinity>, respectively. I might add some additional stuff like error signaling for acos arguments > 1 in later commits but that's it for now.
You will probably want to round 'slightly above 1' to 'actually 1' in your calculation somehow, e.g. by (acos (min 1.0 FOO)).
Hope that all sounds reasonable... let me know if you have any questions/comments.
Wes