Implement the "unum" representation in D ?
Lionello Lunesu via Digitalmars-d
digitalmars-d at puremagic.com
Sat Nov 14 20:19:17 PST 2015
On 09/11/15 04:38, Richard Davies wrote:
> On Friday, 18 September 2015 at 03:19:26 UTC, Nick B wrote:
>> On Thursday, 17 September 2015 at 23:53:30 UTC, Anthony Di Franco wrote:
>>
>>>
>>> I read the whole book and did not regret it at all, but I was already
>>> looking for good interval arithmetic implementations. I found that
>>> the techniques are not too different (though improved in important
>>> ways) from what is mainstream in verified computing.
>>
>
> Hi,
>
> I haven't finished the book but have read over half of it and browsed
> the rest. I wanted to add that an implementation of unums would have
> advantages beyond verifiable computing. Some examples that spring to
> mind are:
>
> Using low precision (8-bit) unums to determine if an answer exists
> before using a higher precision representation to do the calculation
> (example briefly discussed in the book is ray tracing).
>
> More generally, unums can self-tune their precision which may be
> generally useful in getting high precision answers efficiently.
>
> It is possible for the programmer to specify the level of accuracy so
> that unums don't waste time calculating bits that have no meaning.
>
> Parallelisation - floating point ops are not associative but unum ops are.
>
> Tighter bounds on results than interval arithmetic or significance
> arithmetic.
>
> These are just a few areas where a software implementation could be
> useful. If you've ever had any issues with floating point, I'd recommend
> reading the book, not just because of the approach it proposes to solve
> these but also because it's very clearly written and quite entertaining
> (given the subject matter).
>
> Richard
Yeah, I got curious too. I spend some time on it yesterday and had a
stab at writing it in D. I was playing with the idea of using native
floating point types to store Unums. This would not have the full
benefit of the dynamically sized Unums, but would allow for the accuracy
benefits.
Still need to implement the basic arithmetic (interval) stuff:
https://github.com/lionello/unumd
L.
More information about the Digitalmars-d
mailing list