chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] thoughts on alternate "posits" / "unums" instead of


From: John Cowan
Subject: Re: [Chicken-users] thoughts on alternate "posits" / "unums" instead of traditional floats?
Date: Tue, 9 Jul 2019 15:00:38 -0400



On Tue, Jul 9, 2019 at 2:07 PM Peter Bex <address@hidden> wrote:

They could be, but Scheme does not really allow for multiple types
of inexact numbers.

Actually it has no problem with them.  There are literals for up to four separate inexact types, using S, F, D,  and L as exponent markers, and arithmetic just requires that when two float types meet the shorter is widened  and that in systems without rationals, the widest available float is returned from division.  The flags and the widening coercion are inherited from Common Lisp.

Currently Kawa (which inherits its two floating types from Java) supports 32-bit floats with the S or F flag, as well as standard 64-bit floats with the E, D, or L flag.  So does Racket/C, but Racket/Chez does not, and it probably never will (since Chez does not) except perhaps as a separate type that doesn't participate in the numeric tower.

It would also slow everything down even further
due to even more dispatching.

That's for sure.  It's one of the reasons why ad hoc polymorphism is not really Scheme's thing, with the big exceptions of numbers and ports; the more types you support ad hoc, the worse your performance is.
 
So it sounds like a modified C compiler and/or FPU would be the way to go
for this.

Hardware support for posits will come shortly after the Devil dies of exposure.


John Cowan          http://vrici.lojban.org/~cowan        address@hidden
What asininity could I have uttered that they applaud me thus?
        --Phocion, Greek orator


reply via email to

[Prev in Thread] Current Thread [Next in Thread]