Discussion:
[julia-users] John L. Gustafson's UNUMs
Job van der Zwan
2015-07-25 13:11:54 UTC
Permalink
So I came across the concept of UNUMs on the Pony language mailing list
<http://lists.ponylang.org/pipermail/ponydev/2015-July/000071.html> this
morning. I hadn't heard of them before, and a quick search doesn't show up
anything on this mailing list, so I guess most people here haven't either.
They're a proposed alternate encoding for numbers by John L. Gustafson.
This presentation by him sums it up nicely:

http://sites.ieee.org/scv-cs/files/2013/03/Right-SizingPrecision1.pdf

“Unums”(universal numbers) are to floating point what floating point is to
fixed point.
Floating-point values self-describe their scale factor, but fix the
exponent and fraction size. Unums self-describe the exponent size, fraction
size, and inexact state, and include fixed point and IEEE floats as special
cases.
The presentation can be seen here, provided you have the Silverlight plugin:

http://sites.ieee.org/scv-cs/archives/right-sizing-precision-to-save-energy-power-and-storage

Now, I don't know enough about this topic to say if they're a good or bad
idea, but I figured the idea is interesting/relevant enough to share with
the Julia crowd.

I'm also wondering if they could be implemented (relatively) easily within
Julia, given its flexible type system. If so, they might provide an
interesting advanced example, no?
Simon Danisch
2015-07-25 14:22:31 UTC
Permalink
How cool!
I don't know much about this matter, but this looks very exciting!
Julia seems to be a good fit to prototype this!
Post by Job van der Zwan
So I came across the concept of UNUMs on the Pony language mailing list
<http://lists.ponylang.org/pipermail/ponydev/2015-July/000071.html> this
morning. I hadn't heard of them before, and a quick search doesn't show up
anything on this mailing list, so I guess most people here haven't either.
They're a proposed alternate encoding for numbers by John L. Gustafson.
http://sites.ieee.org/scv-cs/files/2013/03/Right-SizingPrecision1.pdf
“Unums”(universal numbers) are to floating point what floating point is to
fixed point.
Floating-point values self-describe their scale factor, but fix the
exponent and fraction size. Unums self-describe the exponent size, fraction
size, and inexact state, and include fixed point and IEEE floats as special
cases.
http://sites.ieee.org/scv-cs/archives/right-sizing-precision-to-save-energy-power-and-storage
Now, I don't know enough about this topic to say if they're a good or bad
idea, but I figured the idea is interesting/relevant enough to share with
the Julia crowd.
I'm also wondering if they could be implemented (relatively) easily within
Julia, given its flexible type system. If so, they might provide an
interesting advanced example, no?
Simon Byrne
2015-07-25 20:34:45 UTC
Permalink
Some HN discussion here:
https://news.ycombinator.com/item?id=9943589

I'd be keen to know more but he hasn't really published any details other
than his book
<http://www.amazon.com/The-End-Error-Computing-Computational/dp/1482239868>. Based
on the free preview, it looks like a bit of a diatribe rather than a
detailed technical proposal, but you can look at his mathematica code here
<https://www.crcpress.com/The-End-of-Error-Unum-Computing/Gustafson/9781482239867>
.
Post by Simon Danisch
How cool!
I don't know much about this matter, but this looks very exciting!
Julia seems to be a good fit to prototype this!
Post by Job van der Zwan
So I came across the concept of UNUMs on the Pony language mailing list
<http://lists.ponylang.org/pipermail/ponydev/2015-July/000071.html> this
morning. I hadn't heard of them before, and a quick search doesn't show up
anything on this mailing list, so I guess most people here haven't either.
They're a proposed alternate encoding for numbers by John L. Gustafson.
http://sites.ieee.org/scv-cs/files/2013/03/Right-SizingPrecision1.pdf
“Unums”(universal numbers) are to floating point what floating point is
to fixed point.
Floating-point values self-describe their scale factor, but fix the
exponent and fraction size. Unums self-describe the exponent size, fraction
size, and inexact state, and include fixed point and IEEE floats as special
cases.
http://sites.ieee.org/scv-cs/archives/right-sizing-precision-to-save-energy-power-and-storage
Now, I don't know enough about this topic to say if they're a good or bad
idea, but I figured the idea is interesting/relevant enough to share with
the Julia crowd.
I'm also wondering if they could be implemented (relatively) easily
within Julia, given its flexible type system. If so, they might provide an
interesting advanced example, no?
Job van der Zwan
2015-07-25 21:46:32 UTC
Permalink
Post by Simon Byrne
https://news.ycombinator.com/item?id=9943589
Oh, hadn't seen that. The linked presentation is also more recent! I found
the "slidecast" version of it, where he presents the slides in podcast form.
He's evangelizing a bit, but,
well... I guess that makes sense given the topic.

I'd be keen to know more but he hasn't really published any details other
Post by Simon Byrne
than his book
<http://www.amazon.com/The-End-Error-Computing-Computational/dp/1482239868>. Based
on the free preview, it looks like a bit of a diatribe rather than a
detailed technical proposal, but you can look at his mathematica code here
<https://www.google.com/url?q=https%3A%2F%2Fwww.crcpress.com%2FThe-End-of-Error-Unum-Computing%2FGustafson%2F9781482239867&sa=D&sntz=1&usg=AFQjCNG9ezAr5A_BTmpUT6WdVBIYDvaIhA>
.
Well, if you decide to go against something as well-established as the way
we've been doing integer and floating point arithmetic, you're probably
going to need a lot of explanation in a very accessible style - because you
definitely won't have the experts on your side.
Scott Jones
2015-07-26 02:00:44 UTC
Permalink
This seems interesting, I'd like to know what David Sanders
(https://github.com/dpsanders) thinks of the math (I missed his talk at
JuliaCon, I'm waiting for the video, but the description made it sound
relevant).

There also doesn't seem to be any representation of -0.0, which from what
I've read, is important to represent negative underflows.
(however, I really don't understand why there isn't a corresponding value
for positive underflows in the IEEE formats, in addition to an exact 0)
Why it is displayed as -0.0, instead of something like -Und, 0, and Und,
similarly to -Inf and Inf, I just don't get.
(If any mathematicians would please explain that to me, I'd appreciate it!)

I also wonder how well this would work for all the array based math used in
Julia, where you'd really like all the values to have a fixed size
for fast indexing.
I can think of some ways, using an extra bit to say that the real value is
not in place, but rather in an overflow vector, and then have those
allocated with a big enough size to handle larger precision, I'm not sure
how that would perform though, it would depend a lot on how many values had
to be promoted to a larger size.

Finally, I'd wonder, in the absence of hardware that could directly handle
UNUMs, if this would really be any better than the packing I've been doing
for decades (to save space in a database and in in-memory structures, where
things are read much more than written or modified).
(in my old format, I used length/type bytes (which could be 1 or 2 bytes
normally, or more, to handle up to 8-byte lengths), followed by packed
data, for example, non-negative integers were represented by 0-n bytes
after the type/length info), negative integers represented by 0-n without
any trailing 0xFF bytes, scaled decimals had a 1 or 2 byte signed scale,
followed by 0-n bytes (same separation of negative/non-negative for ease of
packing/unpacking). The format also handles Null, packed strings (binary,
8-bit text, and Unicode), and binary floating point values
(also packed, first using float format instead of double, if (float)x == x,
and then eliminating LSBs of 0, which makes a 0 not take any extra bytes,
and many small values just take 1 or 2 extra bytes).

-Scott
Post by Job van der Zwan
Post by Simon Byrne
https://news.ycombinator.com/item?id=9943589
Oh, hadn't seen that. The linked presentation is also more recent! I found
the "slidecast" version of it, where he presents the slides in podcast
form. http://youtu.be/jN9L7TpMxeA He's evangelizing a
bit, but, well... I guess that makes sense given the topic.
I'd be keen to know more but he hasn't really published any details other
Post by Simon Byrne
than his book
<http://www.amazon.com/The-End-Error-Computing-Computational/dp/1482239868>. Based
on the free preview, it looks like a bit of a diatribe rather than a
detailed technical proposal, but you can look at his mathematica code here
<https://www.google.com/url?q=https%3A%2F%2Fwww.crcpress.com%2FThe-End-of-Error-Unum-Computing%2FGustafson%2F9781482239867&sa=D&sntz=1&usg=AFQjCNG9ezAr5A_BTmpUT6WdVBIYDvaIhA>
.
Well, if you decide to go against something as well-established as the way
we've been doing integer and floating point arithmetic, you're probably
going to need a lot of explanation in a very accessible style - because you
definitely won't have the experts on your side.
Job van der Zwan
2015-07-26 08:06:05 UTC
Permalink
Post by Scott Jones
There also doesn't seem to be any representation of -0.0, which from what
I've read, is important to represent negative underflows.
Apparently, his format doesn't have underflow, or overflow. I'm still
trying to wrap my head around it myself, but I *think* is that the trick is
that it alternates between exact numbers and intervals *between* exact
numbers. To do so it uses an "uncertainty" bit to indicate open ranges
*between* the numbers exact numbers. The result is that all numbers can be
represented *accurately*, but not necessarily *precise.* He kinda explains
it here
http://youtu.be/jN9L7TpMxeA

Supposedly, this solves a lot of mathematical issues.

I also wonder how well this would work for all the array based math used in
Post by Scott Jones
Julia, where you'd really like all the values to have a fixed size
for fast indexing.
You could also "box" them in a fixed maximum unum size, then load/store
them bytewise according to how big the actual numbers are. Memory-wise you
wouldn't lose anything over floating point (unless you're at the far ends
of the dynamic range *and* with all bits being significant digits, which I
think is unlikely), but you wouldn't gain anything either. So most of the
claimed energy/speed benefits would vanish, I guess, since the prefetcher
still loads in the whole memory chunk. But perhaps in-cache there might be
some benefits to performance. And keeping track of significant figures
might be worth it.

Finally, I'd wonder, in the absence of hardware that could directly handle
Post by Scott Jones
UNUMs, if this would really be any better than the packing I've been doing
for decades (to save space in a database and in in-memory structures, where
things are read much more than written or modified).
I guess that all depends on what you mean with "better". Better
compression? Probably not. But if the automatic-significant-figures part is
appealing, then maybe?
Scott Jones
2015-07-26 10:59:33 UTC
Permalink
Post by Job van der Zwan
Post by Scott Jones
There also doesn't seem to be any representation of -0.0, which from what
I've read, is important to represent negative underflows.
Apparently, his format doesn't have underflow, or overflow. I'm still
trying to wrap my head around it myself, but I *think* is that the trick
is that it alternates between exact numbers and intervals *between* exact
numbers. To do so it uses an "uncertainty" bit to indicate open ranges
*between* the numbers exact numbers. The result is that all numbers can
be represented *accurately*, but not necessarily *precise.* He kinda
explains it here
http://youtu.be/jN9L7TpMxeA
Supposedly, this solves a lot of mathematical issues.
Ah, yes, and this also solves my issue about really wanting -Underflow, 0,
+Underflow instead of -0.0 and +0.0, by having the inexact bit.
Post by Job van der Zwan
I also wonder how well this would work for all the array based math used
Post by Scott Jones
in Julia, where you'd really like all the values to have a fixed size
for fast indexing.
You could also "box" them in a fixed maximum unum size, then load/store
them bytewise according to how big the actual numbers are. Memory-wise you
wouldn't lose anything over floating point (unless you're at the far ends
of the dynamic range *and* with all bits being significant digits, which
I think is unlikely), but you wouldn't gain anything either. So most of the
claimed energy/speed benefits would vanish, I guess, since the prefetcher
still loads in the whole memory chunk. But perhaps in-cache there might be
some benefits to performance. And keeping track of significant figures
might be worth it.
Yes, I wasn't thinking so much about what happens during the calculation,
good point about keeping track of the significant figures.
Post by Job van der Zwan
Finally, I'd wonder, in the absence of hardware that could directly handle
Post by Scott Jones
UNUMs, if this would really be any better than the packing I've been doing
for decades (to save space in a database and in in-memory structures, where
things are read much more than written or modified).
I guess that all depends on what you mean with "better". Better
compression? Probably not. But if the automatic-significant-figures part is
appealing, then maybe?
Yes, but I could add the information about "inexact" vs. "exact" and
keeping track of significant figures to my format as well, while still
storing many common values in just 1 byte (including Null, "", and markers
for binary and packed Unicode text).
In my work, performance was more related to how much information you could
keep in cache (not L1/L2/L3 cache, so much, but in buffers in RAM as
opposed to on disk).
Job van der Zwan
2015-07-26 11:51:51 UTC
Permalink
So on an impulse I got the ebook, and even for a physics dropout like me
it's surprisingly engaging and accessible! There's some stuff in there that
isn't mentioned in the online slides that might clarify the idea better.

For example, floats already have a way to represent the largest
representable number (maxreal) and positive infinity. Add a ubit gives you
the following:

- maxreal without ubit: largest rep. number
- maxreal with ubit: interval between maxreal and infinity
- infinity without ubit: infinity
- infinity with ubit: the interval between... infinity and beyond?

So what that gives you is a way to represent a number that is bigger than
what you can represent, but not infinite (maxreal + ubit), and NaN
(infinity + ubit). For negative numbers, just add sign bit.
Post by Scott Jones
Yes, but I could add the information about "inexact" vs. "exact" and
keeping track of significant figures to my format as well, while still
storing many common values in just 1 byte (including Null, "", and markers
for binary and packed Unicode text).
Well, at the very least it seems to inspire some ways you might improve
your format! :)
Scott Jones
2015-07-26 12:14:27 UTC
Permalink
Post by Job van der Zwan
So on an impulse I got the ebook, and even for a physics dropout like me
it's surprisingly engaging and accessible! There's some stuff in there that
isn't mentioned in the online slides that might clarify the idea better.
For example, floats already have a way to represent the largest
representable number (maxreal) and positive infinity. Add a ubit gives you
- maxreal without ubit: largest rep. number
- maxreal with ubit: interval between maxreal and infinity
- infinity without ubit: infinity
- infinity with ubit: the interval between... infinity and beyond?
So what that gives you is a way to represent a number that is bigger than
what you can represent, but not infinite (maxreal + ubit), and NaN
(infinity + ubit). For negative numbers, just add sign bit.
Post by Scott Jones
Yes, but I could add the information about "inexact" vs. "exact" and
keeping track of significant figures to my format as well, while still
storing many common values in just 1 byte (including Null, "", and markers
for binary and packed Unicode text).
Well, at the very least it seems to inspire some ways you might improve
your format! :)
Yes, and I am interested in hearing about hardware support for the UNUM
format.
I'm also curious about how these ideas interact with decimal floating point
(which is what I'm more familiar with, because for the sorts of operations
important for the use cases I was concerned with, not having
rounding/conversion issues between decimal <-> binary floating point or
string <-> binary floating point was critical).
Tom Breloff
2015-07-26 13:09:15 UTC
Permalink
Unums as a general concept seem really interesting. I ordered the book, and
may start a julia implementation (unless someone else gets there first).
Unified integer and floating point with clear accuracy information could
provide nice solutions for certain problems in finance and statistics. For
example, I have a specialized solution to represent financial prices which
have a fixed accuracy, but I want to be able to do floating point
arithmetic on them. This requires lots of converting between int and float,
rounding, etc. Unums may completely change those operations.

If anyone starts an implementation, please post the package link here so we
don't duplicate efforts.
Post by Scott Jones
Post by Job van der Zwan
So on an impulse I got the ebook, and even for a physics dropout like me
it's surprisingly engaging and accessible! There's some stuff in there that
isn't mentioned in the online slides that might clarify the idea better.
For example, floats already have a way to represent the largest
representable number (maxreal) and positive infinity. Add a ubit gives you
- maxreal without ubit: largest rep. number
- maxreal with ubit: interval between maxreal and infinity
- infinity without ubit: infinity
- infinity with ubit: the interval between... infinity and beyond?
So what that gives you is a way to represent a number that is bigger than
what you can represent, but not infinite (maxreal + ubit), and NaN
(infinity + ubit). For negative numbers, just add sign bit.
Post by Scott Jones
Yes, but I could add the information about "inexact" vs. "exact" and
keeping track of significant figures to my format as well, while still
storing many common values in just 1 byte (including Null, "", and markers
for binary and packed Unicode text).
Well, at the very least it seems to inspire some ways you might improve
your format! :)
Yes, and I am interested in hearing about hardware support for the UNUM
format.
I'm also curious about how these ideas interact with decimal floating
point (which is what I'm more familiar with, because for the sorts of
operations important for the use cases I was concerned with, not having
rounding/conversion issues between decimal <-> binary floating point or
string <-> binary floating point was critical).
Scott Jones
2015-07-26 13:50:52 UTC
Permalink
If you add support for this to Julia, I want to make sure I can add the
format to my own record storage format efficiently.
(This sounds great!)
Post by Tom Breloff
Unums as a general concept seem really interesting. I ordered the book,
and may start a julia implementation (unless someone else gets there
first). Unified integer and floating point with clear accuracy information
could provide nice solutions for certain problems in finance and
statistics. For example, I have a specialized solution to represent
financial prices which have a fixed accuracy, but I want to be able to do
floating point arithmetic on them. This requires lots of converting between
int and float, rounding, etc. Unums may completely change those operations.
If anyone starts an implementation, please post the package link here so
we don't duplicate efforts.
Post by Scott Jones
Post by Job van der Zwan
So on an impulse I got the ebook, and even for a physics dropout like me
it's surprisingly engaging and accessible! There's some stuff in there that
isn't mentioned in the online slides that might clarify the idea better.
For example, floats already have a way to represent the largest
representable number (maxreal) and positive infinity. Add a ubit gives you
- maxreal without ubit: largest rep. number
- maxreal with ubit: interval between maxreal and infinity
- infinity without ubit: infinity
- infinity with ubit: the interval between... infinity and beyond?
So what that gives you is a way to represent a number that is bigger
than what you can represent, but not infinite (maxreal + ubit), and NaN
(infinity + ubit). For negative numbers, just add sign bit.
Post by Scott Jones
Yes, but I could add the information about "inexact" vs. "exact" and
keeping track of significant figures to my format as well, while still
storing many common values in just 1 byte (including Null, "", and markers
for binary and packed Unicode text).
Well, at the very least it seems to inspire some ways you might improve
your format! :)
Yes, and I am interested in hearing about hardware support for the UNUM
format.
I'm also curious about how these ideas interact with decimal floating
point (which is what I'm more familiar with, because for the sorts of
operations important for the use cases I was concerned with, not having
rounding/conversion issues between decimal <-> binary floating point or
string <-> binary floating point was critical).
Job van der Zwan
2015-07-26 21:06:56 UTC
Permalink
Here's a Python port (found in the HN comments), might be worth checking
out:

https://github.com/jrmuizel/pyunum
Post by Scott Jones
If you add support for this to Julia, I want to make sure I can add the
format to my own record storage format efficiently.
(This sounds great!)
Post by Tom Breloff
Unums as a general concept seem really interesting. I ordered the book,
and may start a julia implementation (unless someone else gets there
first). Unified integer and floating point with clear accuracy information
could provide nice solutions for certain problems in finance and
statistics. For example, I have a specialized solution to represent
financial prices which have a fixed accuracy, but I want to be able to do
floating point arithmetic on them. This requires lots of converting between
int and float, rounding, etc. Unums may completely change those operations.
If anyone starts an implementation, please post the package link here so
we don't duplicate efforts.
Post by Scott Jones
Post by Job van der Zwan
So on an impulse I got the ebook, and even for a physics dropout like
me it's surprisingly engaging and accessible! There's some stuff in there
that isn't mentioned in the online slides that might clarify the idea
better.
For example, floats already have a way to represent the largest
representable number (maxreal) and positive infinity. Add a ubit gives you
- maxreal without ubit: largest rep. number
- maxreal with ubit: interval between maxreal and infinity
- infinity without ubit: infinity
- infinity with ubit: the interval between... infinity and beyond?
So what that gives you is a way to represent a number that is bigger
than what you can represent, but not infinite (maxreal + ubit), and NaN
(infinity + ubit). For negative numbers, just add sign bit.
Post by Scott Jones
Yes, but I could add the information about "inexact" vs. "exact" and
keeping track of significant figures to my format as well, while still
storing many common values in just 1 byte (including Null, "", and markers
for binary and packed Unicode text).
Well, at the very least it seems to inspire some ways you might improve
your format! :)
Yes, and I am interested in hearing about hardware support for the UNUM
format.
I'm also curious about how these ideas interact with decimal floating
point (which is what I'm more familiar with, because for the sorts of
operations important for the use cases I was concerned with, not having
rounding/conversion issues between decimal <-> binary floating point or
string <-> binary floating point was critical).
Scott Jones
2015-07-27 19:56:13 UTC
Permalink
I ended up buying the book, haven't got too far into it yet, definitely am
going to work these ideas into my storage format.
I've actually been using a form of "universal numbers" for decades, where
unlike C, etc. numbers were not typed with certain sizes, actually, numbers
originally
weren't even a type - semantically, everything was a string, and the
operations you performed determined whether you got a "numeric"
interpretation of the string.
(typed numbers were added much later, to support IEEE binary floating
point, instead of just decimal floating point).
Post by Job van der Zwan
Here's a Python port (found in the HN comments), might be worth checking
https://github.com/jrmuizel/pyunum
Post by Scott Jones
If you add support for this to Julia, I want to make sure I can add the
format to my own record storage format efficiently.
(This sounds great!)
Post by Tom Breloff
Unums as a general concept seem really interesting. I ordered the book,
and may start a julia implementation (unless someone else gets there
first). Unified integer and floating point with clear accuracy information
could provide nice solutions for certain problems in finance and
statistics. For example, I have a specialized solution to represent
financial prices which have a fixed accuracy, but I want to be able to do
floating point arithmetic on them. This requires lots of converting between
int and float, rounding, etc. Unums may completely change those operations.
If anyone starts an implementation, please post the package link here so
we don't duplicate efforts.
Post by Scott Jones
Post by Job van der Zwan
So on an impulse I got the ebook, and even for a physics dropout like
me it's surprisingly engaging and accessible! There's some stuff in there
that isn't mentioned in the online slides that might clarify the idea
better.
For example, floats already have a way to represent the largest
representable number (maxreal) and positive infinity. Add a ubit gives you
- maxreal without ubit: largest rep. number
- maxreal with ubit: interval between maxreal and infinity
- infinity without ubit: infinity
- infinity with ubit: the interval between... infinity and beyond?
So what that gives you is a way to represent a number that is bigger
than what you can represent, but not infinite (maxreal + ubit), and NaN
(infinity + ubit). For negative numbers, just add sign bit.
Post by Scott Jones
Yes, but I could add the information about "inexact" vs. "exact" and
keeping track of significant figures to my format as well, while still
storing many common values in just 1 byte (including Null, "", and markers
for binary and packed Unicode text).
Well, at the very least it seems to inspire some ways you might
improve your format! :)
Yes, and I am interested in hearing about hardware support for the UNUM
format.
I'm also curious about how these ideas interact with decimal floating
point (which is what I'm more familiar with, because for the sorts of
operations important for the use cases I was concerned with, not having
rounding/conversion issues between decimal <-> binary floating point or
string <-> binary floating point was critical).
Tom Breloff
2015-07-29 13:32:00 UTC
Permalink
I'm going to start work on an unum prototype today, but first... a quick
poll: what package name is preferred? Unum.jl? Unums.jl? Something else?
I expect there to be an "Unum" type, so following other conventions I
think maybe Unums.jl is proper.

Also... please get in touch with me if you have interest in
collaborating/contributing, or if you have specific test cases you'd like
me to try out.
Post by Scott Jones
I ended up buying the book, haven't got too far into it yet, definitely am
going to work these ideas into my storage format.
I've actually been using a form of "universal numbers" for decades, where
unlike C, etc. numbers were not typed with certain sizes, actually, numbers
originally
weren't even a type - semantically, everything was a string, and the
operations you performed determined whether you got a "numeric"
interpretation of the string.
(typed numbers were added much later, to support IEEE binary floating
point, instead of just decimal floating point).
Post by Job van der Zwan
Here's a Python port (found in the HN comments), might be worth checking
https://github.com/jrmuizel/pyunum
Post by Scott Jones
If you add support for this to Julia, I want to make sure I can add the
format to my own record storage format efficiently.
(This sounds great!)
Post by Tom Breloff
Unums as a general concept seem really interesting. I ordered the book,
and may start a julia implementation (unless someone else gets there
first). Unified integer and floating point with clear accuracy information
could provide nice solutions for certain problems in finance and
statistics. For example, I have a specialized solution to represent
financial prices which have a fixed accuracy, but I want to be able to do
floating point arithmetic on them. This requires lots of converting between
int and float, rounding, etc. Unums may completely change those operations.
If anyone starts an implementation, please post the package link here
so we don't duplicate efforts.
Post by Scott Jones
Post by Job van der Zwan
So on an impulse I got the ebook, and even for a physics dropout like
me it's surprisingly engaging and accessible! There's some stuff in there
that isn't mentioned in the online slides that might clarify the idea
better.
For example, floats already have a way to represent the largest
representable number (maxreal) and positive infinity. Add a ubit gives you
- maxreal without ubit: largest rep. number
- maxreal with ubit: interval between maxreal and infinity
- infinity without ubit: infinity
- infinity with ubit: the interval between... infinity and beyond?
So what that gives you is a way to represent a number that is bigger
than what you can represent, but not infinite (maxreal + ubit), and NaN
(infinity + ubit). For negative numbers, just add sign bit.
Post by Scott Jones
Yes, but I could add the information about "inexact" vs. "exact" and
keeping track of significant figures to my format as well, while still
storing many common values in just 1 byte (including Null, "", and markers
for binary and packed Unicode text).
Well, at the very least it seems to inspire some ways you might
improve your format! :)
Yes, and I am interested in hearing about hardware support for the
UNUM format.
I'm also curious about how these ideas interact with decimal floating
point (which is what I'm more familiar with, because for the sorts of
operations important for the use cases I was concerned with, not having
rounding/conversion issues between decimal <-> binary floating point or
string <-> binary floating point was critical).
Steven G. Johnson
2015-07-29 13:50:21 UTC
Permalink
For example, I have a specialized solution to represent financial prices
which have a fixed accuracy, but I want to be able to do floating point
arithmetic on them.
Why not use decimal floating-point for that?

Regarding, unums, without hardware support, at first glance they don't
sound practical compared to the present alternatives (hardware or software
fixed-precision float types, or arbitrary precision if you need it). And
the "ubox" method for error analysis, even if it overcomes the problems of
interval arithmetic as claimed, sounds too expensive to use on anything
except for the smallest-scale problems because of the large number of boxes
that you seem to need for each value whose error is being tracked.
Job van der Zwan
2015-07-29 14:10:53 UTC
Permalink
Post by Steven G. Johnson
Regarding, unums, without hardware support, at first glance they don't
sound practical compared to the present alternatives (hardware or software
fixed-precision float types, or arbitrary precision if you need it). And
the "ubox" method for error analysis, even if it overcomes the problems of
interval arithmetic as claimed, sounds too expensive to use on anything
except for the smallest-scale problems because of the large number of boxes
that you seem to need for each value whose error is being tracked.
Well, I don't know enough about traditional methods to say if they're
really as limited as Gustafson claims in his book, or if he's just
cherry-picking. Same about the cost of using uboxe

However, ubound arithmetic tells you that 1 / (0, 1] = [1, inf), and that
[1, inf) / inf = 0. The ubounds describing those interval results are
effectively just a pair of floating point numbers, plus a ubit to signal
whether an endpoint is open or not. That's a very simple thing to
implement. Not sure if there's any arbitrary precision method that deal
with this so elegantly - you probably know better than I do.
Tom Breloff
2015-07-29 14:30:38 UTC
Permalink
Correct me if I'm wrong, but (fixed-size) decimal floating-point has most
of the same issues as floating point in terms of accumulation of errors,
right? For certain cases, such as adding 2 prices together, I agree that
decimal floating point would work ($1.01 + $2.02 == $3.03), but for those
cases it's easier to represent the values as integers: (101 + 202 == 303 ;
prec=2), which is basically what I do now.

In terms of storage and complexity, I would expect that decimal floating
point numbers are bloated as compared to floats. You're giving up speed
and memory in order to guarantee an exact representation falls in base
10... I could understand how this is occasionally useful, but I can't
imagine you'd want that in the general case.

In terms of hardware support... obviously it doesn't exist today, but it
could in the future:
http://www.theplatform.net/2015/03/12/the-little-chip-that-could-disrupt-exascale-computing/

Either way, I would think there's enough potential to the idea to at least
prototype and test, and maybe it will prove to be more useful than you
expect.
Post by Job van der Zwan
Post by Steven G. Johnson
Regarding, unums, without hardware support, at first glance they don't
sound practical compared to the present alternatives (hardware or software
fixed-precision float types, or arbitrary precision if you need it). And
the "ubox" method for error analysis, even if it overcomes the problems of
interval arithmetic as claimed, sounds too expensive to use on anything
except for the smallest-scale problems because of the large number of boxes
that you seem to need for each value whose error is being tracked.
Well, I don't know enough about traditional methods to say if they're
really as limited as Gustafson claims in his book, or if he's just
cherry-picking. Same about the cost of using uboxe
However, ubound arithmetic tells you that 1 / (0, 1] = [1, inf), and that
[1, inf) / inf = 0. The ubounds describing those interval results are
effectively just a pair of floating point numbers, plus a ubit to signal
whether an endpoint is open or not. That's a very simple thing to
implement. Not sure if there's any arbitrary precision method that deal
with this so elegantly - you probably know better than I do.
Tom Breloff
2015-07-29 14:38:52 UTC
Permalink
Scott: Is your number format a public (open source) specification? How
does it differ from decimal floating point?
Post by Tom Breloff
Correct me if I'm wrong, but (fixed-size) decimal floating-point has most
of the same issues as floating point in terms of accumulation of errors,
right? For certain cases, such as adding 2 prices together, I agree that
decimal floating point would work ($1.01 + $2.02 == $3.03), but for those
cases it's easier to represent the values as integers: (101 + 202 == 303 ;
prec=2), which is basically what I do now.
In terms of storage and complexity, I would expect that decimal floating
point numbers are bloated as compared to floats. You're giving up speed
and memory in order to guarantee an exact representation falls in base
10... I could understand how this is occasionally useful, but I can't
imagine you'd want that in the general case.
In terms of hardware support... obviously it doesn't exist today, but it
http://www.theplatform.net/2015/03/12/the-little-chip-that-could-disrupt-exascale-computing/
Either way, I would think there's enough potential to the idea to at least
prototype and test, and maybe it will prove to be more useful than you
expect.
On Wed, Jul 29, 2015 at 10:10 AM, Job van der Zwan <
Post by Job van der Zwan
Post by Steven G. Johnson
Regarding, unums, without hardware support, at first glance they don't
sound practical compared to the present alternatives (hardware or software
fixed-precision float types, or arbitrary precision if you need it). And
the "ubox" method for error analysis, even if it overcomes the problems of
interval arithmetic as claimed, sounds too expensive to use on anything
except for the smallest-scale problems because of the large number of boxes
that you seem to need for each value whose error is being tracked.
Well, I don't know enough about traditional methods to say if they're
really as limited as Gustafson claims in his book, or if he's just
cherry-picking. Same about the cost of using uboxe
However, ubound arithmetic tells you that 1 / (0, 1] = [1, inf), and that
[1, inf) / inf = 0. The ubounds describing those interval results are
effectively just a pair of floating point numbers, plus a ubit to signal
whether an endpoint is open or not. That's a very simple thing to
implement. Not sure if there's any arbitrary precision method that deal
with this so elegantly - you probably know better than I do.
Tom Breloff
2015-07-29 14:54:59 UTC
Permalink
Also to add to Scotts list... there are precisely 2 representations of NaN,
and we could potentially use them as a replacement for Nullable. i.e. the
first NaN could represent 0/0 and similar, while the second NaN could
represent a missing value. So instead of a "Array{Nullable{Float64},N}",
you would just have "Array{Unum{4,7},N}". isnan(u) and isnull(u) could be
mutually exclusive.

I foresee the potential of specialized arrays as well, which could strip
out the "size" fields of the unum and put that metadata in the array type,
keeping the format fixed within the array. This allows constant indexing
and other niceties, but still allowing for arbitrary-precision intermediate
calcs, with exactness tracking.
Post by Tom Breloff
Scott: Is your number format a public (open source) specification? How
does it differ from decimal floating point?
Post by Tom Breloff
Correct me if I'm wrong, but (fixed-size) decimal floating-point has most
of the same issues as floating point in terms of accumulation of errors,
right? For certain cases, such as adding 2 prices together, I agree that
decimal floating point would work ($1.01 + $2.02 == $3.03), but for those
cases it's easier to represent the values as integers: (101 + 202 == 303 ;
prec=2), which is basically what I do now.
In terms of storage and complexity, I would expect that decimal floating
point numbers are bloated as compared to floats. You're giving up speed
and memory in order to guarantee an exact representation falls in base
10... I could understand how this is occasionally useful, but I can't
imagine you'd want that in the general case.
In terms of hardware support... obviously it doesn't exist today, but it
http://www.theplatform.net/2015/03/12/the-little-chip-that-could-disrupt-exascale-computing/
Either way, I would think there's enough potential to the idea to at
least prototype and test, and maybe it will prove to be more useful than
you expect.
On Wed, Jul 29, 2015 at 10:10 AM, Job van der Zwan <
Post by Job van der Zwan
Post by Steven G. Johnson
Regarding, unums, without hardware support, at first glance they don't
sound practical compared to the present alternatives (hardware or software
fixed-precision float types, or arbitrary precision if you need it). And
the "ubox" method for error analysis, even if it overcomes the problems of
interval arithmetic as claimed, sounds too expensive to use on anything
except for the smallest-scale problems because of the large number of boxes
that you seem to need for each value whose error is being tracked.
Well, I don't know enough about traditional methods to say if they're
really as limited as Gustafson claims in his book, or if he's just
cherry-picking. Same about the cost of using uboxe
However, ubound arithmetic tells you that 1 / (0, 1] = [1, inf), and
that [1, inf) / inf = 0. The ubounds describing those interval results are
effectively just a pair of floating point numbers, plus a ubit to signal
whether an endpoint is open or not. That's a very simple thing to
implement. Not sure if there's any arbitrary precision method that deal
with this so elegantly - you probably know better than I do.
Scott Jones
2015-07-29 15:09:11 UTC
Permalink
For my stuff, I really want to distinguish between a Null value (i.e.
missing), and any NaN value that could be produced from floating point
calculations.
What would you do about NaN payloads? I want to be able to store them, as
is, just in case somebody has encoded anything important in them (NaN
payloads from the
IEEE binary and floating point standards, that is, the UNUM format doesn't
seem to have NaN payloads, AFAICT).

For efficient handling of "Array{Nullable{Float64},N}", I think you are
right, "Array{Unum{4,7},N}" would be very good.
Post by Tom Breloff
Also to add to Scotts list... there are precisely 2 representations of
NaN, and we could potentially use them as a replacement for Nullable. i.e.
the first NaN could represent 0/0 and similar, while the second NaN could
represent a missing value. So instead of a "Array{Nullable{Float64},N}",
you would just have "Array{Unum{4,7},N}". isnan(u) and isnull(u) could be
mutually exclusive.
I foresee the potential of specialized arrays as well, which could strip
out the "size" fields of the unum and put that metadata in the array type,
keeping the format fixed within the array. This allows constant indexing
and other niceties, but still allowing for arbitrary-precision intermediate
calcs, with exactness tracking.
Post by Tom Breloff
Scott: Is your number format a public (open source) specification? How
does it differ from decimal floating point?
Post by Tom Breloff
Correct me if I'm wrong, but (fixed-size) decimal floating-point has
most of the same issues as floating point in terms of accumulation of
errors, right? For certain cases, such as adding 2 prices together, I
agree that decimal floating point would work ($1.01 + $2.02 == $3.03), but
for those cases it's easier to represent the values as integers: (101 + 202
== 303 ; prec=2), which is basically what I do now.
In terms of storage and complexity, I would expect that decimal floating
point numbers are bloated as compared to floats. You're giving up speed
and memory in order to guarantee an exact representation falls in base
10... I could understand how this is occasionally useful, but I can't
imagine you'd want that in the general case.
In terms of hardware support... obviously it doesn't exist today, but it
http://www.theplatform.net/2015/03/12/the-little-chip-that-could-disrupt-exascale-computing/
Either way, I would think there's enough potential to the idea to at
least prototype and test, and maybe it will prove to be more useful than
you expect.
Post by Job van der Zwan
Post by Steven G. Johnson
Regarding, unums, without hardware support, at first glance they don't
sound practical compared to the present alternatives (hardware or software
fixed-precision float types, or arbitrary precision if you need it). And
the "ubox" method for error analysis, even if it overcomes the problems of
interval arithmetic as claimed, sounds too expensive to use on anything
except for the smallest-scale problems because of the large number of boxes
that you seem to need for each value whose error is being tracked.
Well, I don't know enough about traditional methods to say if they're
really as limited as Gustafson claims in his book, or if he's just
cherry-picking. Same about the cost of using uboxe
However, ubound arithmetic tells you that 1 / (0, 1] = [1, inf), and
that [1, inf) / inf = 0. The ubounds describing those interval results are
effectively just a pair of floating point numbers, plus a ubit to signal
whether an endpoint is open or not. That's a very simple thing to
implement. Not sure if there's any arbitrary precision method that deal
with this so elegantly - you probably know better than I do.
John Gustafson
2015-07-31 16:38:16 UTC
Permalink
Unum format specifically eliminates NaN "payloads" as one of the worst
decisions made in the IEEE 754 standard. They break just about every rule
there is about good engineering. There are two kinds of NaN in unum math:
quiet and signaling. The other bit patterns are used to represent actual
numbers, very much like using "subnormal" floats instead of clipping
subnormal numbers to zero and wasting trillions of useful bit patterns. The
two values of NaN can be used to distinguish between an empty set result
(Null) and a floating point exception like division by zero.
Post by Scott Jones
For my stuff, I really want to distinguish between a Null value (i.e.
missing), and any NaN value that could be produced from floating point
calculations.
What would you do about NaN payloads? I want to be able to store them, as
is, just in case somebody has encoded anything important in them (NaN
payloads from the
IEEE binary and floating point standards, that is, the UNUM format doesn't
seem to have NaN payloads, AFAICT).
For efficient handling of "Array{Nullable{Float64},N}", I think you are
right, "Array{Unum{4,7},N}" would be very good.
Post by Tom Breloff
Also to add to Scotts list... there are precisely 2 representations of
NaN, and we could potentially use them as a replacement for Nullable. i.e.
the first NaN could represent 0/0 and similar, while the second NaN could
represent a missing value. So instead of a "Array{Nullable{Float64},N}",
you would just have "Array{Unum{4,7},N}". isnan(u) and isnull(u) could be
mutually exclusive.
I foresee the potential of specialized arrays as well, which could strip
out the "size" fields of the unum and put that metadata in the array type,
keeping the format fixed within the array. This allows constant indexing
and other niceties, but still allowing for arbitrary-precision intermediate
calcs, with exactness tracking.
Post by Tom Breloff
Scott: Is your number format a public (open source) specification? How
does it differ from decimal floating point?
Post by Tom Breloff
Correct me if I'm wrong, but (fixed-size) decimal floating-point has
most of the same issues as floating point in terms of accumulation of
errors, right? For certain cases, such as adding 2 prices together, I
agree that decimal floating point would work ($1.01 + $2.02 == $3.03), but
for those cases it's easier to represent the values as integers: (101 + 202
== 303 ; prec=2), which is basically what I do now.
In terms of storage and complexity, I would expect that decimal
floating point numbers are bloated as compared to floats. You're giving up
speed and memory in order to guarantee an exact representation falls in
base 10... I could understand how this is occasionally useful, but I can't
imagine you'd want that in the general case.
In terms of hardware support... obviously it doesn't exist today, but
http://www.theplatform.net/2015/03/12/the-little-chip-that-could-disrupt-exascale-computing/
Either way, I would think there's enough potential to the idea to at
least prototype and test, and maybe it will prove to be more useful than
you expect.
On Wed, Jul 29, 2015 at 10:10 AM, Job van der Zwan <
Post by Job van der Zwan
Post by Steven G. Johnson
Regarding, unums, without hardware support, at first glance they
don't sound practical compared to the present alternatives (hardware or
software fixed-precision float types, or arbitrary precision if you need
it). And the "ubox" method for error analysis, even if it overcomes the
problems of interval arithmetic as claimed, sounds too expensive to use on
anything except for the smallest-scale problems because of the large number
of boxes that you seem to need for each value whose error is being tracked.
Well, I don't know enough about traditional methods to say if they're
really as limited as Gustafson claims in his book, or if he's just
cherry-picking. Same about the cost of using uboxe
However, ubound arithmetic tells you that 1 / (0, 1] = [1, inf), and
that [1, inf) / inf = 0. The ubounds describing those interval results are
effectively just a pair of floating point numbers, plus a ubit to signal
whether an endpoint is open or not. That's a very simple thing to
implement. Not sure if there's any arbitrary precision method that deal
with this so elegantly - you probably know better than I do.
Scott Jones
2015-07-29 15:04:30 UTC
Permalink
Post by Tom Breloff
Scott: Is your number format a public (open source) specification? How
does it differ from decimal floating point?
It was just a packed storage format (think serialize/deserialize in Julia),
that I invented to be able to efficiently store Mumps values, some 20+
years ago.
The format was documented by sales engineers, and customers certainly
figured it out easily enough, even though I wanted it kept opaque (so that
I could add things later).
It was trivial, a length byte (which included the length byte itself, so 0
was available as a special marker to indicate a longer length was stored
(unsigned, LE) in the next two bytes
(and later on, that was changed so that if the 2-byte length was 0, it was
followed by a 4 byte unsigned length), followed optionally by a type byte,
and optionally further data.
(a length byte of 1 indicated an undefined or null value). Storing a 0
only took 2 bytes, a length of 2, and the marker for non-negative integer.
-1 also took only 2 bytes, length of 2, marker for negative integer.
The *format* could handle any arbitrary length integers, although the code
only supported 0-8 bytes after the type, so 64-bit max, and values >= 2^63,
or < -2^64, would get an error if read in.
Other type bytes indicated binary or 8-bit text string, or UTF16LE Unicode
values, or a 1 byte power of 10 scale followed by 0-8 bytes, and later on,
IEEE doubles.

No big deal, many people have come up with similar schemes, but I optimized
it for space, which made it very useful for getting good performance,
packing as much data as possible into the B+ tree nodes.
Scott Jones
2015-07-29 14:52:17 UTC
Permalink
Post by Tom Breloff
Correct me if I'm wrong, but (fixed-size) decimal floating-point has most
of the same issues as floating point in terms of accumulation of errors,
right? For certain cases, such as adding 2 prices together, I agree that
decimal floating point would work ($1.01 + $2.02 == $3.03), but for those
cases it's easier to represent the values as integers: (101 + 202 == 303 ;
prec=2), which is basically what I do now.
Programming wise, it's a lot easier to deal with decimal floating point
instead of decimal fixed point, you don't need to worry about making sure
you've scaled things correctly.
I implemented a full decimal floating point package (one 32-bit version in
IBM/370 assembly, another 16-bit 8086/8, and also pure pre-ANSI C (which
worked at 16 or 32, then later 64 bit chunks)),
where all the numbers were either: native sized signed integers (16-bit,
32-bit, and 0later 64-bit), or scaled decimal (64-bit value, scaled by 1
byte signed value (10**x)).
This was actually faster than binary floating point for most things,
because at the time, many of the machines did not have floating point
hardware (think PDP-11, and PCs without the 8087 coprocessor),
and because of the use case, frequently you were doing things like
adding/subtracting things that had the same scale. (like your $1.01 + $2.02
case).

You don't have to rewrite your code, if the currency uses 1000ths instead
of 100ths, for example, or doesn't use fractions at all, all platforms, no
matter the native machine word size, all got exactly the same results,
with up to ~19 digits precision, *and* you avoided all binary <-> decimal
conversion issues.
(Note: at the time, using binary floating point hardware, on the machines
where it was available, like the VAX or IBM or PCs with 8087 chip, would
have given different results on each platform, which was not acceptable.
Even with the IEEE standard, I think you still can get varying results on
different platforms :-( )

In terms of storage and complexity, I would expect that decimal floating
Post by Tom Breloff
point numbers are bloated as compared to floats. You're giving up speed
and memory in order to guarantee an exact representation falls in base
10... I could understand how this is occasionally useful, but I can't
imagine you'd want that in the general case.
Why bloated? There's not really that much difference, a few bits I think,
if you are comparing IEEE 64-bit binary to IEEE 64-bit decimal float
formats.
As far as storage, they actually took less space in the decimal format,
because it was also the format for integers (talking about my storage
format here)
Post by Tom Breloff
In terms of hardware support... obviously it doesn't exist today, but it
http://www.theplatform.net/2015/03/12/the-little-chip-that-could-disrupt-exascale-computing/
Either way, I would think there's enough potential to the idea to at least
prototype and test, and maybe it will prove to be more useful than you
expect.
I really would like to see this!
Post by Tom Breloff
Post by Job van der Zwan
Post by Steven G. Johnson
Regarding, unums, without hardware support, at first glance they don't
sound practical compared to the present alternatives (hardware or software
fixed-precision float types, or arbitrary precision if you need it). And
the "ubox" method for error analysis, even if it overcomes the problems of
interval arithmetic as claimed, sounds too expensive to use on anything
except for the smallest-scale problems because of the large number of boxes
that you seem to need for each value whose error is being tracked.
Well, I don't know enough about traditional methods to say if they're
really as limited as Gustafson claims in his book, or if he's just
cherry-picking. Same about the cost of using uboxe
However, ubound arithmetic tells you that 1 / (0, 1] = [1, inf), and that
[1, inf) / inf = 0. The ubounds describing those interval results are
effectively just a pair of floating point numbers, plus a ubit to signal
whether an endpoint is open or not. That's a very simple thing to
implement. Not sure if there's any arbitrary precision method that deal
with this so elegantly - you probably know better than I do.
John Gustafson
2015-07-31 16:32:39 UTC
Permalink
Regarding REX Computing (the reference to
http://www.theplatform.net/2015/03/12/the-little-chip-that-could-disrupt-exascale-computing/),
the two founders are putting unum arithmetic into their processor design,
and I am working closely with them. But the thing to do first is to convert
the Mathematica definition into a language that is much closer to the
hardware level, like C or Julia, and *then* think about the processor
architecture.

An ideal processor architecture would use bit addressing instead of byte or
word addressing, and would support variable size integers up to some limit
like 128 bits. It also would embrace variable execution time for
operations, something that has been preached against by old-school CPU
architects. With bandwidth and watts the big design constraints in
computing in 2015, it's time to get away from the tyranny of fixed size
data and fixed time execution.
Post by Scott Jones
Post by Tom Breloff
Correct me if I'm wrong, but (fixed-size) decimal floating-point has most
of the same issues as floating point in terms of accumulation of errors,
right? For certain cases, such as adding 2 prices together, I agree that
decimal floating point would work ($1.01 + $2.02 == $3.03), but for those
cases it's easier to represent the values as integers: (101 + 202 == 303 ;
prec=2), which is basically what I do now.
Programming wise, it's a lot easier to deal with decimal floating point
instead of decimal fixed point, you don't need to worry about making sure
you've scaled things correctly.
I implemented a full decimal floating point package (one 32-bit version in
IBM/370 assembly, another 16-bit 8086/8, and also pure pre-ANSI C (which
worked at 16 or 32, then later 64 bit chunks)),
where all the numbers were either: native sized signed integers (16-bit,
32-bit, and 0later 64-bit), or scaled decimal (64-bit value, scaled by 1
byte signed value (10**x)).
This was actually faster than binary floating point for most things,
because at the time, many of the machines did not have floating point
hardware (think PDP-11, and PCs without the 8087 coprocessor),
and because of the use case, frequently you were doing things like
adding/subtracting things that had the same scale. (like your $1.01 + $2.02
case).
You don't have to rewrite your code, if the currency uses 1000ths instead
of 100ths, for example, or doesn't use fractions at all, all platforms, no
matter the native machine word size, all got exactly the same results,
with up to ~19 digits precision, *and* you avoided all binary <-> decimal
conversion issues.
(Note: at the time, using binary floating point hardware, on the machines
where it was available, like the VAX or IBM or PCs with 8087 chip, would
have given different results on each platform, which was not acceptable.
Even with the IEEE standard, I think you still can get varying results on
different platforms :-( )
In terms of storage and complexity, I would expect that decimal floating
Post by Tom Breloff
point numbers are bloated as compared to floats. You're giving up speed
and memory in order to guarantee an exact representation falls in base
10... I could understand how this is occasionally useful, but I can't
imagine you'd want that in the general case.
Why bloated? There's not really that much difference, a few bits I think,
if you are comparing IEEE 64-bit binary to IEEE 64-bit decimal float
formats.
As far as storage, they actually took less space in the decimal format,
because it was also the format for integers (talking about my storage
format here)
Post by Tom Breloff
In terms of hardware support... obviously it doesn't exist today, but it
http://www.theplatform.net/2015/03/12/the-little-chip-that-could-disrupt-exascale-computing/
Either way, I would think there's enough potential to the idea to at
least prototype and test, and maybe it will prove to be more useful than
you expect.
I really would like to see this!
Post by Tom Breloff
Post by Job van der Zwan
Post by Steven G. Johnson
Regarding, unums, without hardware support, at first glance they don't
sound practical compared to the present alternatives (hardware or software
fixed-precision float types, or arbitrary precision if you need it). And
the "ubox" method for error analysis, even if it overcomes the problems of
interval arithmetic as claimed, sounds too expensive to use on anything
except for the smallest-scale problems because of the large number of boxes
that you seem to need for each value whose error is being tracked.
Well, I don't know enough about traditional methods to say if they're
really as limited as Gustafson claims in his book, or if he's just
cherry-picking. Same about the cost of using uboxe
However, ubound arithmetic tells you that 1 / (0, 1] = [1, inf), and
that [1, inf) / inf = 0. The ubounds describing those interval results are
effectively just a pair of floating point numbers, plus a ubit to signal
whether an endpoint is open or not. That's a very simple thing to
implement. Not sure if there's any arbitrary precision method that deal
with this so elegantly - you probably know better than I do.
Scott Jones
2015-07-29 15:42:59 UTC
Permalink
For me, the nice thing (if I understand this correctly) is that UNUMs let
me know that there *was* roundoff error, whereas with currently IEEE binary
*and* decimal standards, you have no way of telling.
IEEE floating-point has the inexact exception flag to signal that a
roundoff error occurred. The unum proposal would store an inexact bit in
each number, and I'm skeptical that this adds much value. (In practice,
almost all nontrivial computations with a fixed precision will incur a
rounding error, and if one output is inexact usually all of them are.)
Right, if you *do* set the exception flag, but I don't think I've ever seen
anybody run with that flag set.

About the nontrivial computation part, I think that really depends on your
use cases.
A large part of the calculations done in Caché were exact (think of simple
stuff like adding up a bunch of numbers).
(I know this, since I wrote the math package myself, and did a lot of
testing to see just what sorts of operations were being done [so I could
optimize the more frequent ones more],
and to make sure I did handle the rounding correctly).
Tom Breloff
2015-07-29 15:47:39 UTC
Permalink
The inexact exception flag isn't quite the same. That flag just signifies
that at some point in the calculation there was rounding. It doesn't give
any indication of how wrong the final number may be. The "ubit" coupled
with variable-sized unums allows for potentially very precise interval
arithmetic, but without requiring the full storage. For example, if we
want to represent the value "1e-1000000", the unum would effectively be the
range (0, smallnum), where smallnum is the smallest positive number we can
represent exactly. This actually requires very little actual storage for a
packed unum, although it can be an extremely precise range.
For me, the nice thing (if I understand this correctly) is that UNUMs let
me know that there *was* roundoff error, whereas with currently IEEE binary
*and* decimal standards, you have no way of telling.
IEEE floating-point has the inexact exception flag to signal that a
roundoff error occurred. The unum proposal would store an inexact bit in
each number, and I'm skeptical that this adds much value. (In practice,
almost all nontrivial computations with a fixed precision will incur a
rounding error, and if one output is inexact usually all of them are.)
Steven G. Johnson
2015-07-29 15:55:56 UTC
Permalink
Post by Tom Breloff
The inexact exception flag isn't quite the same. That flag just signifies
that at some point in the calculation there was rounding. It doesn't give
any indication of how wrong the final number may be. The "ubit" coupled
with variable-sized unums allows for potentially very precise interval
arithmetic, but without requiring the full storage.
Interval arithmetic is usually considered to be useless for error analysis
in most cases unless it is coupled with sophisticated additional analysis
(e.g. Taylor arithmetic) because of the dependency problem; that's why they
are proposing "uboxes" but with vastly greater memory and computation
requirements than interval arithmetic. (Interval arithmetic has other
applications outside error analysis, though.)

And the slight memory gain of using fewer than 64 bits will be completely
swamped for any large computation (i.e., any computation where the memory
matters) by the cost of software unums. If someone makes an efficient
hardware implementation, matters would be different, but I'm not going to
hold my breath for that.
Job van der Zwan
2015-07-29 16:01:34 UTC
Permalink
Steven, have you read the book or are you basing your judgment on the available presentations linked so far? Because you seem to be saying the same things Gustafson says, except with opposite conclusions about unums, ubounds and uboxes.
Scott Jones
2015-07-29 17:06:10 UTC
Permalink
If you really want me to, I will ;-) (but as you already know, I'm known as
being a big PITA!)
https://github.com/tbreloff/Unums.jl
Post by Job van der Zwan
Steven, have you read the book or are you basing your judgment on the
available presentations linked so far? Because you seem to be saying the
same things Gustafson says, except with opposite conclusions about unums,
ubounds and uboxes.
Spencer Lyon
2015-07-29 17:53:50 UTC
Permalink
I'll keep an eye on it and potentially pitch in!
https://github.com/tbreloff/Unums.jl
Post by Job van der Zwan
Steven, have you read the book or are you basing your judgment on the
available presentations linked so far? Because you seem to be saying the
same things Gustafson says, except with opposite conclusions about unums,
ubounds and uboxes.
Steven G. Johnson
2015-07-29 21:00:56 UTC
Permalink
Job, I'm basing my judgement on the presentation.
Job van der Zwan
2015-07-29 21:47:49 UTC
Permalink
Post by Steven G. Johnson
Job, I'm basing my judgement on the presentation.
Ah ok, I was wondering I feel like those presentations give a general
impression, but don't really explain the details enough. And like I said,
your critique overlaps with Gustafson's own critique of traditional
interval arithmetic, so I wasn't sure if you meant that you don't buy his
suggested alternative ubox method after reading the book, or indicated
scepticism based on earlier experience, but without full knowledge of what
his suggested alternative is.

To be clear, it wasn't a "you should read the book" putdown - I hate
comments like that, they destroy every meaningful discussion.

The more I think about it, the more I think the ubit is actually the big
breakthrough. As a thought experiment, let's ignore the whole
flexible-bitsize bit and just take an existing float, but replace the last
bit of the fraction with a ubit. What happens?

Well.. we give up one bit of *precision* in the fraction, but *our set of
representations is still the same size*. We still have the same number of
floats as before! It's just that half of them is now exact (with one bit
less precision), and the other half represents open intervals between these
exact numbers. Which lets you represent the entire real number line
accurately (but with limited precision, unless they happen to be equal to
an exact float).

Compare that to traditional floating point numbers, which are all exact,
but unless your calculation is exactly that floating point representation
(which is very rare) guaranteed to be off.

Think about it this way: regular floats represent a finite subset of
rational numbers. More bits increase that finite subset. But add a ubit,
and you got the entire real number line. With limited precision, and using
the same finite number of representations as a float that has the same
number of bits, but still.

I'd like to hear some feedback on the example I used earlier from people
more versed in this topic than me:

ubound arithmetic tells you that 1 / (0, 1] = [1, inf), and that [1, inf)
Post by Steven G. Johnson
/ inf = 0
Thanks to the ubit, the arithmetic is as simple as "divide by both
endpoints to get the new interval endpoints". It's so simple that I have a
hard time believing this was not possible with interval arithmetic before,
and again I don't know that much about the topic.

So is it really true, like Gustafson claims, that interval arithmetic so
far always used *closed* intervals that accepted *rounded* answers? Because
if that is true, and even is that is the only thing unums solve... well
then I'm sold :P
Tom Breloff
2015-07-29 22:08:00 UTC
Permalink
Job: I think you're on the right track. Given current hardware
optimizations, you might as well create a mostly fixed-length
specification, but with the advantages of "truth" that the ubit provides.
I'm thinking through an implementation that uses generated functions and
parameterized Unum types, which provide as much precision/accuracy that you
need, filling up a standard bit size (8/16/32/64/128), very similar to the
"unpacked unums" that Gustafson describes.
Post by Job van der Zwan
Post by Steven G. Johnson
Job, I'm basing my judgement on the presentation.
Ah ok, I was wondering I feel like those presentations give a general
impression, but don't really explain the details enough. And like I said,
your critique overlaps with Gustafson's own critique of traditional
interval arithmetic, so I wasn't sure if you meant that you don't buy his
suggested alternative ubox method after reading the book, or indicated
scepticism based on earlier experience, but without full knowledge of what
his suggested alternative is.
To be clear, it wasn't a "you should read the book" putdown - I hate
comments like that, they destroy every meaningful discussion.
The more I think about it, the more I think the ubit is actually the big
breakthrough. As a thought experiment, let's ignore the whole
flexible-bitsize bit and just take an existing float, but replace the last
bit of the fraction with a ubit. What happens?
Well.. we give up one bit of *precision* in the fraction, but *our set of
representations is still the same size*. We still have the same number of
floats as before! It's just that half of them is now exact (with one bit
less precision), and the other half represents open intervals between these
exact numbers. Which lets you represent the entire real number line
accurately (but with limited precision, unless they happen to be equal to
an exact float).
Compare that to traditional floating point numbers, which are all exact,
but unless your calculation is exactly that floating point representation
(which is very rare) guaranteed to be off.
Think about it this way: regular floats represent a finite subset of
rational numbers. More bits increase that finite subset. But add a ubit,
and you got the entire real number line. With limited precision, and using
the same finite number of representations as a float that has the same
number of bits, but still.
I'd like to hear some feedback on the example I used earlier from people
ubound arithmetic tells you that 1 / (0, 1] = [1, inf), and that [1, inf)
Post by Steven G. Johnson
/ inf = 0
Thanks to the ubit, the arithmetic is as simple as "divide by both
endpoints to get the new interval endpoints". It's so simple that I have a
hard time believing this was not possible with interval arithmetic before,
and again I don't know that much about the topic.
So is it really true, like Gustafson claims, that interval arithmetic so
far always used *closed* intervals that accepted *rounded* answers?
Because if that is true, and even is that is the only thing unums solve...
well then I'm sold :P
Job van der Zwan
2015-07-29 22:33:52 UTC
Permalink
BTW, Tom, I was already working on a summary of the book (on an IJulia notebook). I'm on mobile right now so don't have access to it, but I can share it later. I think something like that might be useful to attract more collaborators - we can't expect everyone to read it.
Spencer Lyon
2015-07-29 23:14:43 UTC
Permalink
I would love to read a summary.  I don't think I have time to read the whole book AND contribute, but I might be able to find time to read a summary and contribute. 

// Spencer

BTW, Tom, I was already working on a summary of the book (on an IJulia notebook). I'm on mobile right now so don't have access to it, but I can share it later. I think something like that might be useful to attract more collaborators - we can't expect everyone to read it.
Tom Breloff
2015-07-29 23:57:55 UTC
Permalink
Just thinking out loud... I think it would be feasible to implement a
"decimal unum", in which everything is essentially the same except it's
base 10. This "may" give a lot of benefits while still maintaining exact
numbers in many situations (But decimal intervals when inexact). Since
we're already talking about doing operations in software, it may net out to
be better/faster?
Post by Spencer Lyon
I would love to read a summary.
I don't think I have time to read the whole book AND contribute, but I
might be able to find time to read a summary and contribute.
// Spencer
On July 29, 2015 at 6:33:52 PM EDT, Job van der Zwan <
BTW, Tom, I was already working on a summary of the book (on an IJulia
notebook). I'm on mobile right now so don't have access to it, but I can
share it later. I think something like that might be useful to attract more
collaborators - we can't expect everyone to read it.
Scott Jones
2015-07-30 00:20:37 UTC
Permalink
That would be great for my purposes.
Post by Tom Breloff
Just thinking out loud... I think it would be feasible to implement a
"decimal unum", in which everything is essentially the same except it's
base 10. This "may" give a lot of benefits while still maintaining exact
numbers in many situations (But decimal intervals when inexact). Since
we're already talking about doing operations in software, it may net out to
be better/faster?
Post by Spencer Lyon
I would love to read a summary.
I don't think I have time to read the whole book AND contribute, but I
might be able to find time to read a summary and contribute.
// Spencer
On July 29, 2015 at 6:33:52 PM EDT, Job van der Zwan <
BTW, Tom, I was already working on a summary of the book (on an IJulia
notebook). I'm on mobile right now so don't have access to it, but I can
share it later. I think something like that might be useful to attract more
collaborators - we can't expect everyone to read it.
Job van der Zwan
2015-07-30 22:51:24 UTC
Permalink
Post by Job van der Zwan
BTW, Tom, I was already working on a summary of the book (on an IJulia
notebook). I'm on mobile right now so don't have access to it, but I can
share it later. I think something like that might be useful to attract more
collaborators - we can't expect everyone to read it.
Ok, so since Tom is already working on a package, I moved my
summary-in-progress to Google Drive where it's easier for people to leave
comments:

https://docs.google.com/document/d/1d36_ppKeZDuYRadLm9-Ty8Ai2XZE5MS5bwIuEKBJ1WE/edit?usp=sharing

For others who have read the book, please correct any errors or
misunderstandings on my part that you see. Expanding sections is also
encouraged :P

Right now it's very bare-bones (since the meat is what you *can do* with
unums, not the definition of the format itself), but I'll hopefully get
around to expanding it a bit in the coming weeks.
Tom Breloff
2015-07-31 13:43:02 UTC
Permalink
I added some info to the readme at https://github.com/tbreloff/Unums.jl. I
talk a little bit about how I'm intending to build the package, the
available types, etc. There is also a stub issue for continuing the
discussion of how unums fit into the world of numerical analysis:
https://github.com/tbreloff/Unums.jl/issues/2. I'd love collaboration from
anyone that wants to help implement some of the conversion functions and
operations. I don't claim to be an authority on floating point arithmetic,
so any and all comments are welcome.

Job: Any chance you can move your google doc to a wiki or something more
accessible? I'm happy to include it in my package if you want.
Post by Job van der Zwan
Post by Job van der Zwan
BTW, Tom, I was already working on a summary of the book (on an IJulia
notebook). I'm on mobile right now so don't have access to it, but I can
share it later. I think something like that might be useful to attract more
collaborators - we can't expect everyone to read it.
Ok, so since Tom is already working on a package, I moved my
summary-in-progress to Google Drive where it's easier for people to leave
https://docs.google.com/document/d/1d36_ppKeZDuYRadLm9-Ty8Ai2XZE5MS5bwIuEKBJ1WE/edit?usp=sharing
For others who have read the book, please correct any errors or
misunderstandings on my part that you see. Expanding sections is also
encouraged :P
Right now it's very bare-bones (since the meat is what you *can do* with
unums, not the definition of the format itself), but I'll hopefully get
around to expanding it a bit in the coming weeks.
Job van der Zwan
2015-07-31 14:41:36 UTC
Permalink
Hey Tom,

Well, I could change the setting to "anyone with the link can edit" - we
risk vandalism in that case, but as long as we keep the document link to
here the risk is minimal.
Post by Tom Breloff
I added some info to the readme at https://github.com/tbreloff/Unums.jl.
I talk a little bit about how I'm intending to build the package, the
available types, etc. There is also a stub issue for continuing the
https://github.com/tbreloff/Unums.jl/issues/2. I'd love collaboration
from anyone that wants to help implement some of the conversion functions
and operations. I don't claim to be an authority on floating point
arithmetic, so any and all comments are welcome.
Job: Any chance you can move your google doc to a wiki or something more
accessible? I'm happy to include it in my package if you want.
Post by Job van der Zwan
Post by Job van der Zwan
BTW, Tom, I was already working on a summary of the book (on an IJulia
notebook). I'm on mobile right now so don't have access to it, but I can
share it later. I think something like that might be useful to attract more
collaborators - we can't expect everyone to read it.
Ok, so since Tom is already working on a package, I moved my
summary-in-progress to Google Drive where it's easier for people to leave
https://docs.google.com/document/d/1d36_ppKeZDuYRadLm9-Ty8Ai2XZE5MS5bwIuEKBJ1WE/edit?usp=sharing
For others who have read the book, please correct any errors or
misunderstandings on my part that you see. Expanding sections is also
encouraged :P
Right now it's very bare-bones (since the meat is what you *can do* with
unums, not the definition of the format itself), but I'll hopefully get
around to expanding it a bit in the coming weeks.
Waldir Pimenta
2015-07-31 15:01:56 UTC
Permalink
A github wiki in the Unums.jl package would seem ideal. You get the "anyone
can edit" feature, with accountability of who made each edit (github wikis
are git repos, and to make edits people need to have a github account) and
easy reversal of eventual bad changes.
Post by Job van der Zwan
Hey Tom,
Well, I could change the setting to "anyone with the link can edit" - we
risk vandalism in that case, but as long as we keep the document link to
here the risk is minimal.
Post by Tom Breloff
I added some info to the readme at https://github.com/tbreloff/Unums.jl.
I talk a little bit about how I'm intending to build the package, the
available types, etc. There is also a stub issue for continuing the
https://github.com/tbreloff/Unums.jl/issues/2. I'd love collaboration
from anyone that wants to help implement some of the conversion functions
and operations. I don't claim to be an authority on floating point
arithmetic, so any and all comments are welcome.
Job: Any chance you can move your google doc to a wiki or something more
accessible? I'm happy to include it in my package if you want.
Post by Job van der Zwan
Post by Job van der Zwan
BTW, Tom, I was already working on a summary of the book (on an IJulia
notebook). I'm on mobile right now so don't have access to it, but I can
share it later. I think something like that might be useful to attract more
collaborators - we can't expect everyone to read it.
Ok, so since Tom is already working on a package, I moved my
summary-in-progress to Google Drive where it's easier for people to leave
https://docs.google.com/document/d/1d36_ppKeZDuYRadLm9-Ty8Ai2XZE5MS5bwIuEKBJ1WE/edit?usp=sharing
For others who have read the book, please correct any errors or
misunderstandings on my part that you see. Expanding sections is also
encouraged :P
Right now it's very bare-bones (since the meat is what you *can do* with
unums, not the definition of the format itself), but I'll hopefully get
around to expanding it a bit in the coming weeks.
Job van der Zwan
2015-07-31 15:20:30 UTC
Permalink
Ah, that sounds good. So I should just fork Tom's package, copy the
document we have so far into the wiki, then make a pull request?
Post by Waldir Pimenta
A github wiki in the Unums.jl package would seem ideal. You get the
"anyone can edit" feature, with accountability of who made each edit
(github wikis are git repos, and to make edits people need to have a github
account) and easy reversal of eventual bad changes.
Post by Job van der Zwan
Hey Tom,
Well, I could change the setting to "anyone with the link can edit" - we
risk vandalism in that case, but as long as we keep the document link to
here the risk is minimal.
Post by Tom Breloff
I added some info to the readme at https://github.com/tbreloff/Unums.jl.
I talk a little bit about how I'm intending to build the package, the
available types, etc. There is also a stub issue for continuing the
https://github.com/tbreloff/Unums.jl/issues/2. I'd love collaboration
from anyone that wants to help implement some of the conversion functions
and operations. I don't claim to be an authority on floating point
arithmetic, so any and all comments are welcome.
Job: Any chance you can move your google doc to a wiki or something more
accessible? I'm happy to include it in my package if you want.
Post by Job van der Zwan
Post by Job van der Zwan
BTW, Tom, I was already working on a summary of the book (on an IJulia
notebook). I'm on mobile right now so don't have access to it, but I can
share it later. I think something like that might be useful to attract more
collaborators - we can't expect everyone to read it.
Ok, so since Tom is already working on a package, I moved my
summary-in-progress to Google Drive where it's easier for people to leave
https://docs.google.com/document/d/1d36_ppKeZDuYRadLm9-Ty8Ai2XZE5MS5bwIuEKBJ1WE/edit?usp=sharing
For others who have read the book, please correct any errors or
misunderstandings on my part that you see. Expanding sections is also
encouraged :P
Right now it's very bare-bones (since the meat is what you *can do* with
unums, not the definition of the format itself), but I'll hopefully get
around to expanding it a bit in the coming weeks.
Waldir Pimenta
2015-07-31 17:39:59 UTC
Permalink
The wiki in github projects is a separate git repository from the code one,
so I'm not sure you can add it to the upstream repo with a PR like that.
The easiest way is for Tom to activate the wiki in the repo settings, then
anyone with a github account can add and edit pages directly in the web
interface.
Post by Job van der Zwan
Ah, that sounds good. So I should just fork Tom's package, copy the
document we have so far into the wiki, then make a pull request?
Post by Waldir Pimenta
A github wiki in the Unums.jl package would seem ideal. You get the
"anyone can edit" feature, with accountability of who made each edit
(github wikis are git repos, and to make edits people need to have a github
account) and easy reversal of eventual bad changes.
Post by Job van der Zwan
Hey Tom,
Well, I could change the setting to "anyone with the link can edit" - we
risk vandalism in that case, but as long as we keep the document link to
here the risk is minimal.
Post by Tom Breloff
I added some info to the readme at https://github.com/tbreloff/Unums.jl.
I talk a little bit about how I'm intending to build the package, the
available types, etc. There is also a stub issue for continuing the
https://github.com/tbreloff/Unums.jl/issues/2. I'd love collaboration
from anyone that wants to help implement some of the conversion functions
and operations. I don't claim to be an authority on floating point
arithmetic, so any and all comments are welcome.
Job: Any chance you can move your google doc to a wiki or something
more accessible? I'm happy to include it in my package if you want.
Post by Job van der Zwan
Post by Job van der Zwan
BTW, Tom, I was already working on a summary of the book (on an
IJulia notebook). I'm on mobile right now so don't have access to it, but I
can share it later. I think something like that might be useful to attract
more collaborators - we can't expect everyone to read it.
Ok, so since Tom is already working on a package, I moved my
summary-in-progress to Google Drive where it's easier for people to leave
https://docs.google.com/document/d/1d36_ppKeZDuYRadLm9-Ty8Ai2XZE5MS5bwIuEKBJ1WE/edit?usp=sharing
For others who have read the book, please correct any errors or
misunderstandings on my part that you see. Expanding sections is also
encouraged :P
Right now it's very bare-bones (since the meat is what you *can do* with
unums, not the definition of the format itself), but I'll hopefully get
around to expanding it a bit in the coming weeks.
John Gustafson
2015-07-31 19:49:36 UTC
Permalink
Guys, this reminds me: There used to be a Wikipedia page on Unum
(arithmetic), but it was taken down for some reason and now searches just
direct to my Wikipedia page. Maybe it's time to revive it. Then we could
start building a concise explanation there.
Post by Waldir Pimenta
A github wiki in the Unums.jl package would seem ideal. You get the
"anyone can edit" feature, with accountability of who made each edit
(github wikis are git repos, and to make edits people need to have a github
account) and easy reversal of eventual bad changes.
Post by Job van der Zwan
Hey Tom,
Well, I could change the setting to "anyone with the link can edit" - we
risk vandalism in that case, but as long as we keep the document link to
here the risk is minimal.
Post by Tom Breloff
I added some info to the readme at https://github.com/tbreloff/Unums.jl.
I talk a little bit about how I'm intending to build the package, the
available types, etc. There is also a stub issue for continuing the
https://github.com/tbreloff/Unums.jl/issues/2. I'd love collaboration
from anyone that wants to help implement some of the conversion functions
and operations. I don't claim to be an authority on floating point
arithmetic, so any and all comments are welcome.
Job: Any chance you can move your google doc to a wiki or something more
accessible? I'm happy to include it in my package if you want.
Post by Job van der Zwan
Post by Job van der Zwan
BTW, Tom, I was already working on a summary of the book (on an IJulia
notebook). I'm on mobile right now so don't have access to it, but I can
share it later. I think something like that might be useful to attract more
collaborators - we can't expect everyone to read it.
Ok, so since Tom is already working on a package, I moved my
summary-in-progress to Google Drive where it's easier for people to leave
https://docs.google.com/document/d/1d36_ppKeZDuYRadLm9-Ty8Ai2XZE5MS5bwIuEKBJ1WE/edit?usp=sharing
For others who have read the book, please correct any errors or
misunderstandings on my part that you see. Expanding sections is also
encouraged :P
Right now it's very bare-bones (since the meat is what you *can do* with
unums, not the definition of the format itself), but I'll hopefully get
around to expanding it a bit in the coming weeks.
John Gustafson
2015-07-31 18:30:49 UTC
Permalink
It would be wonderful if someone else would create a super-concise
explanation of unums! Thank you, thank you! I can't seem to do it. I must
be getting long-winded in my old age.

I looked a

https://github.com/tbreloff/Unums.jl

and saw that it erroneously says the sign bit field can have flexible size.
Nope, that's always a single bit. Otherwise, it looks like the web site is
on the right track. Expand the variable size fields up to some maximum
(like the example in the book for a 64-bit fixed size unum) but still
follow the rules of correct unum math within that bound. This is likely how
the first hardware versions will do things, also, and they will save power
by knowing which bits are not in use.

One thing any language implementation will want is to expand a packed set
of unums (using the utag as a linked list pointer) into unpacked ones of
fixed size, and the reverse operation. That way, block stores and loads can
be optimized. I did not put that in the Mathematica reference
implementation, but it needs to be there.
Post by Job van der Zwan
BTW, Tom, I was already working on a summary of the book (on an IJulia
notebook). I'm on mobile right now so don't have access to it, but I can
share it later. I think something like that might be useful to attract more
collaborators - we can't expect everyone to read it.
Tom Breloff
2015-07-31 18:34:07 UTC
Permalink
Thanks for the catch about the signbit... already changed.
Post by John Gustafson
It would be wonderful if someone else would create a super-concise
explanation of unums! Thank you, thank you! I can't seem to do it. I must
be getting long-winded in my old age.
I looked a
https://github.com/tbreloff/Unums.jl
and saw that it erroneously says the sign bit field can have flexible
size. Nope, that's always a single bit. Otherwise, it looks like the web
site is on the right track. Expand the variable size fields up to some
maximum (like the example in the book for a 64-bit fixed size unum) but
still follow the rules of correct unum math within that bound. This is
likely how the first hardware versions will do things, also, and they will
save power by knowing which bits are not in use.
One thing any language implementation will want is to expand a packed set
of unums (using the utag as a linked list pointer) into unpacked ones of
fixed size, and the reverse operation. That way, block stores and loads can
be optimized. I did not put that in the Mathematica reference
implementation, but it needs to be there.
Post by Job van der Zwan
BTW, Tom, I was already working on a summary of the book (on an IJulia
notebook). I'm on mobile right now so don't have access to it, but I can
share it later. I think something like that might be useful to attract more
collaborators - we can't expect everyone to read it.
Steven G. Johnson
2015-07-30 14:07:46 UTC
Permalink
Post by Job van der Zwan
Post by Steven G. Johnson
Job, I'm basing my judgement on the presentation.
Ah ok, I was wondering I feel like those presentations give a general
impression, but don't really explain the details enough. And like I said,
your critique overlaps with Gustafson's own critique of traditional
interval arithmetic, so I wasn't sure if you meant that you don't buy his
suggested alternative ubox method after reading the book, or indicated
scepticism based on earlier experience, but without full knowledge of what
his suggested alternative is.
From the presentation, it seemed pretty explicit that the "ubox" method
replaces a single interval or pair of intervals with a rapidly expanding
set of boxes. I just don't see any conceivable way that this could be
practical for large-scale problems involving many variables.
Post by Job van der Zwan
Well.. we give up one bit of *precision* in the fraction, but *our set of
representations is still the same size*. We still have the same number of
floats as before! It's just that half of them is now exact (with one bit
less precision), and the other half represents open intervals between these
exact numbers. Which lets you represent the entire real number line
accurately (but with limited precision, unless they happen to be equal to
an exact float).
Sorry, but that just does not and cannot work.

The problem is that if you interpret an exact unum as the open interval
between two adjacent exact values, what you have is essentially the same as
interval arithmetic. The result of each operation will produce intervals
that are broader and broader (necessitating lower and lower precision
unums), with the well known problem that the interval quickly becomes
absurdly pessimistic in real problems (i.e. you quickly and prematurely
discard all of your precision in a variable-precision format like unums).

The real problem with interval arithmetic is not open vs. closed intervals,
it is this growth of the error bounds in realistic computations (due to the
dependency problem and similar). (The focus on infinite and semi-infinite
open intervals is a sideshow. If you want useful error bounds, the
important things are the *small* intervals.)

If you discard the interval interpretation with its rapid loss of
precision, what you are left with is an inexact flag per value, but with no
useful error bounds. And I don't believe that this is much more useful
than a single inexact flag for a set of computations as in IEEE.
Tom Breloff
2015-07-30 14:27:36 UTC
Permalink
Steven: There is a section in the book dedicated to writing dynamically
scaling precision/accuracy into your algorithms. The idea is this:

- Pick a small format unum at the start of your algorithm.
- During the algorithm, check your unums for insufficient
precision/accuracy in the final interval.
- As soon as you discover the intervals getting too large, restart with a
new "unum environment".

Obviously this type of resetting shouldn't be default behavior, but the
point is that you have as much flexibility as you need to precisely define
the level of detail that you care about, and there is sufficient
information in your result that you can re-run with better settings if the
result is unsatisfactory.

The problem with floats is that you can get the result of a black-box
calculation and have NO IDEA how wrong you are... only that your solution
is not exact. This concept should make you skeptical of every float
calculation that results with the inexact flag being set.
Post by Steven G. Johnson
Post by Job van der Zwan
Post by Steven G. Johnson
Job, I'm basing my judgement on the presentation.
Ah ok, I was wondering I feel like those presentations give a general
impression, but don't really explain the details enough. And like I said,
your critique overlaps with Gustafson's own critique of traditional
interval arithmetic, so I wasn't sure if you meant that you don't buy his
suggested alternative ubox method after reading the book, or indicated
scepticism based on earlier experience, but without full knowledge of what
his suggested alternative is.
From the presentation, it seemed pretty explicit that the "ubox" method
replaces a single interval or pair of intervals with a rapidly expanding
set of boxes. I just don't see any conceivable way that this could be
practical for large-scale problems involving many variables.
Post by Job van der Zwan
Well.. we give up one bit of *precision* in the fraction, but *our set
of representations is still the same size*. We still have the same
number of floats as before! It's just that half of them is now exact (with
one bit less precision), and the other half represents open intervals
between these exact numbers. Which lets you represent the entire real
number line accurately (but with limited precision, unless they happen to
be equal to an exact float).
Sorry, but that just does not and cannot work.
The problem is that if you interpret an exact unum as the open interval
between two adjacent exact values, what you have is essentially the same as
interval arithmetic. The result of each operation will produce intervals
that are broader and broader (necessitating lower and lower precision
unums), with the well known problem that the interval quickly becomes
absurdly pessimistic in real problems (i.e. you quickly and prematurely
discard all of your precision in a variable-precision format like unums).
The real problem with interval arithmetic is not open vs. closed
intervals, it is this growth of the error bounds in realistic computations
(due to the dependency problem and similar). (The focus on infinite and
semi-infinite open intervals is a sideshow. If you want useful error
bounds, the important things are the *small* intervals.)
If you discard the interval interpretation with its rapid loss of
precision, what you are left with is an inexact flag per value, but with no
useful error bounds. And I don't believe that this is much more useful
than a single inexact flag for a set of computations as in IEEE.
Stefan Karpinski
2015-07-30 14:58:43 UTC
Permalink
This doesn't seem any better than "try the computation with Float128s".
Post by Tom Breloff
Steven: There is a section in the book dedicated to writing dynamically
- Pick a small format unum at the start of your algorithm.
- During the algorithm, check your unums for insufficient
precision/accuracy in the final interval.
- As soon as you discover the intervals getting too large, restart with a
new "unum environment".
Obviously this type of resetting shouldn't be default behavior, but the
point is that you have as much flexibility as you need to precisely define
the level of detail that you care about, and there is sufficient
information in your result that you can re-run with better settings if the
result is unsatisfactory.
The problem with floats is that you can get the result of a black-box
calculation and have NO IDEA how wrong you are... only that your solution
is not exact. This concept should make you skeptical of every float
calculation that results with the inexact flag being set.
Post by Steven G. Johnson
Post by Job van der Zwan
Post by Steven G. Johnson
Job, I'm basing my judgement on the presentation.
Ah ok, I was wondering I feel like those presentations give a general
impression, but don't really explain the details enough. And like I said,
your critique overlaps with Gustafson's own critique of traditional
interval arithmetic, so I wasn't sure if you meant that you don't buy his
suggested alternative ubox method after reading the book, or indicated
scepticism based on earlier experience, but without full knowledge of what
his suggested alternative is.
From the presentation, it seemed pretty explicit that the "ubox" method
replaces a single interval or pair of intervals with a rapidly expanding
set of boxes. I just don't see any conceivable way that this could be
practical for large-scale problems involving many variables.
Post by Job van der Zwan
Well.. we give up one bit of *precision* in the fraction, but *our set
of representations is still the same size*. We still have the same
number of floats as before! It's just that half of them is now exact (with
one bit less precision), and the other half represents open intervals
between these exact numbers. Which lets you represent the entire real
number line accurately (but with limited precision, unless they happen to
be equal to an exact float).
Sorry, but that just does not and cannot work.
The problem is that if you interpret an exact unum as the open interval
between two adjacent exact values, what you have is essentially the same as
interval arithmetic. The result of each operation will produce intervals
that are broader and broader (necessitating lower and lower precision
unums), with the well known problem that the interval quickly becomes
absurdly pessimistic in real problems (i.e. you quickly and prematurely
discard all of your precision in a variable-precision format like unums).
The real problem with interval arithmetic is not open vs. closed
intervals, it is this growth of the error bounds in realistic computations
(due to the dependency problem and similar). (The focus on infinite and
semi-infinite open intervals is a sideshow. If you want useful error
bounds, the important things are the *small* intervals.)
If you discard the interval interpretation with its rapid loss of
precision, what you are left with is an inexact flag per value, but with no
useful error bounds. And I don't believe that this is much more useful
than a single inexact flag for a set of computations as in IEEE.
Tom Breloff
2015-07-30 15:08:47 UTC
Permalink
It's better in the sense that you have a reason to try it with a larger
type. You know exactly how much precision you've lost, and so you can
decide to use up to 1024 bits for intermediate calculations if you need
to. If "sqrt(2)" is part of your calculation, the inexact field for floats
will be set no matter the calculation, and you only know that "my answer is
always wrong". I wouldn't exactly call this a useful/actionable statement.
Post by Stefan Karpinski
This doesn't seem any better than "try the computation with Float128s".
Post by Tom Breloff
Steven: There is a section in the book dedicated to writing dynamically
- Pick a small format unum at the start of your algorithm.
- During the algorithm, check your unums for insufficient
precision/accuracy in the final interval.
- As soon as you discover the intervals getting too large, restart with a
new "unum environment".
Obviously this type of resetting shouldn't be default behavior, but the
point is that you have as much flexibility as you need to precisely define
the level of detail that you care about, and there is sufficient
information in your result that you can re-run with better settings if the
result is unsatisfactory.
The problem with floats is that you can get the result of a black-box
calculation and have NO IDEA how wrong you are... only that your solution
is not exact. This concept should make you skeptical of every float
calculation that results with the inexact flag being set.
On Thu, Jul 30, 2015 at 10:07 AM, Steven G. Johnson <
Post by Steven G. Johnson
Post by Job van der Zwan
Post by Steven G. Johnson
Job, I'm basing my judgement on the presentation.
Ah ok, I was wondering I feel like those presentations give a general
impression, but don't really explain the details enough. And like I said,
your critique overlaps with Gustafson's own critique of traditional
interval arithmetic, so I wasn't sure if you meant that you don't buy his
suggested alternative ubox method after reading the book, or indicated
scepticism based on earlier experience, but without full knowledge of what
his suggested alternative is.
From the presentation, it seemed pretty explicit that the "ubox" method
replaces a single interval or pair of intervals with a rapidly expanding
set of boxes. I just don't see any conceivable way that this could be
practical for large-scale problems involving many variables.
Post by Job van der Zwan
Well.. we give up one bit of *precision* in the fraction, but *our set
of representations is still the same size*. We still have the same
number of floats as before! It's just that half of them is now exact (with
one bit less precision), and the other half represents open intervals
between these exact numbers. Which lets you represent the entire real
number line accurately (but with limited precision, unless they happen to
be equal to an exact float).
Sorry, but that just does not and cannot work.
The problem is that if you interpret an exact unum as the open interval
between two adjacent exact values, what you have is essentially the same as
interval arithmetic. The result of each operation will produce intervals
that are broader and broader (necessitating lower and lower precision
unums), with the well known problem that the interval quickly becomes
absurdly pessimistic in real problems (i.e. you quickly and prematurely
discard all of your precision in a variable-precision format like unums).
The real problem with interval arithmetic is not open vs. closed
intervals, it is this growth of the error bounds in realistic computations
(due to the dependency problem and similar). (The focus on infinite and
semi-infinite open intervals is a sideshow. If you want useful error
bounds, the important things are the *small* intervals.)
If you discard the interval interpretation with its rapid loss of
precision, what you are left with is an inexact flag per value, but with no
useful error bounds. And I don't believe that this is much more useful
than a single inexact flag for a set of computations as in IEEE.
Jeffrey Sarnoff
2015-07-30 16:44:05 UTC
Permalink
If correct rounding is a goal:

For almost all Float64 arguments to elementary functions, working with
120bit significands will assure an accurately rounded result almost always
and working with 168bit significand obtains a correctly rounded Float64
value all the time (at least for the functions I have seen analyzed). An
accurately rounded result is obtainable working with less precision much of
the time, say 80bits of significand (just a guess); rarely will the
required precision be that of the input.

see the papers of Vincent Lefevre e.g.
Worst Cases for Rounding Elementary Functions in Double Precision
<http://perso.ens-lyon.fr/jean-michel.muller/TMDworstcases.pdf>
Worst Cases for the Exponential Function in decimal64
<http://perso.ens-lyon.fr/damien.stehle/downloads/decimalexp.pdf>
Post by Tom Breloff
It's better in the sense that you have a reason to try it with a larger
type. You know exactly how much precision you've lost, and so you can
decide to use up to 1024 bits for intermediate calculations if you need
to. If "sqrt(2)" is part of your calculation, the inexact field for floats
will be set no matter the calculation, and you only know that "my answer is
always wrong". I wouldn't exactly call this a useful/actionable statement.
Post by Stefan Karpinski
This doesn't seem any better than "try the computation with Float128s".
Post by Tom Breloff
Steven: There is a section in the book dedicated to writing dynamically
- Pick a small format unum at the start of your algorithm.
- During the algorithm, check your unums for insufficient
precision/accuracy in the final interval.
- As soon as you discover the intervals getting too large, restart with
a new "unum environment".
Obviously this type of resetting shouldn't be default behavior, but the
point is that you have as much flexibility as you need to precisely define
the level of detail that you care about, and there is sufficient
information in your result that you can re-run with better settings if the
result is unsatisfactory.
The problem with floats is that you can get the result of a black-box
calculation and have NO IDEA how wrong you are... only that your solution
is not exact. This concept should make you skeptical of every float
calculation that results with the inexact flag being set.
Post by Steven G. Johnson
Post by Job van der Zwan
Post by Steven G. Johnson
Job, I'm basing my judgement on the presentation.
Ah ok, I was wondering I feel like those presentations give a general
impression, but don't really explain the details enough. And like I said,
your critique overlaps with Gustafson's own critique of traditional
interval arithmetic, so I wasn't sure if you meant that you don't buy his
suggested alternative ubox method after reading the book, or indicated
scepticism based on earlier experience, but without full knowledge of what
his suggested alternative is.
From the presentation, it seemed pretty explicit that the "ubox" method
replaces a single interval or pair of intervals with a rapidly expanding
set of boxes. I just don't see any conceivable way that this could be
practical for large-scale problems involving many variables.
Post by Job van der Zwan
Well.. we give up one bit of *precision* in the fraction, but *our
set of representations is still the same size*. We still have the
same number of floats as before! It's just that half of them is now exact
(with one bit less precision), and the other half represents open intervals
between these exact numbers. Which lets you represent the entire real
number line accurately (but with limited precision, unless they happen to
be equal to an exact float).
Sorry, but that just does not and cannot work.
The problem is that if you interpret an exact unum as the open interval
between two adjacent exact values, what you have is essentially the same as
interval arithmetic. The result of each operation will produce intervals
that are broader and broader (necessitating lower and lower precision
unums), with the well known problem that the interval quickly becomes
absurdly pessimistic in real problems (i.e. you quickly and prematurely
discard all of your precision in a variable-precision format like unums).
The real problem with interval arithmetic is not open vs. closed
intervals, it is this growth of the error bounds in realistic computations
(due to the dependency problem and similar). (The focus on infinite and
semi-infinite open intervals is a sideshow. If you want useful error
bounds, the important things are the *small* intervals.)
If you discard the interval interpretation with its rapid loss of
precision, what you are left with is an inexact flag per value, but with no
useful error bounds. And I don't believe that this is much more useful
than a single inexact flag for a set of computations as in IEEE.
Steven G. Johnson
2015-07-30 17:20:29 UTC
Permalink
Post by Tom Breloff
It's better in the sense that you have a reason to try it with a larger
type. You know exactly how much precision you've lost, and so you can
decide to use up to 1024 bits for intermediate calculations if you need to.
No, it's worse, because you will likely use much more precision than you
need. You don't know "exactly how much precision you've lost," you have a
(probably) grossly pessimistic estimate of how much precision you've lost.

Compared to that, performing the calculation in Float32, then Float64, then
(rarely) Float128 (or better, rearrange your calculation to avoid the
catastrophic loss of accuracy that is necessitating > double precision)
until the answer stops changing to your desired tolerance is vastly more
efficient.
Job van der Zwan
2015-07-30 19:10:24 UTC
Permalink
Post by Steven G. Johnson
The problem is that if you interpret an exact unum as the open interval
between two adjacent exact values, what you have is essentially the same as
interval arithmetic. The result of each operation will produce intervals
that are broader and broader (necessitating lower and lower precision
unums), with the well known problem that the interval quickly becomes
absurdly pessimistic in real problems (i.e. you quickly and prematurely
discard all of your precision in a variable-precision format like unums).
The real problem with interval arithmetic is not open vs. closed
intervals, it is this growth of the error bounds in realistic computations
(due to the dependency problem and similar). (The focus on infinite and
semi-infinite open intervals is a sideshow. If you want useful error
bounds, the important things are the *small* intervals.)
If you discard the interval interpretation with its rapid loss of
precision, what you are left with is an inexact flag per value, but with no
useful error bounds. And I don't believe that this is much more useful than
a single inexact flag for a set of computations as in IEEE.
The thing is, these are *exactly *the criticisms Gustafson has of
traditional interval arithmetic. In fact, he's even more critical of
interval arithmetic than he is of floats, as far as I can see. However, he
claims that ubounds don't share the "absurd pessimism" problem. Supposedly,
traditional interval arithmetic by necessity needs to be more pessimistic
about its boundaries due to rounding, and only using closed endpoint
instead of allowing for open intervals. Unums instead are (supposedly) more
precise about the information loss they have, and thus (supposedly) don't
blow up as badly. Again, his claims, not mine. I'm not saying you're wrong,
or even sure if you disagree as much as you might think you are (although
I'm pretty sure you wouldn't like the tone he uses when describing
traditional methods though).

I agree with the others about the grain of salt (unums/ubounds/uboxes *always
*come out on top in his examples, which does make you wonder), but on the
other hand: given that the mathematica implementation of his methods are
open source, his claims *should* be verifiable (they can be found here
under Downloads/Updates
<https://www.google.com/url?q=https%3A%2F%2Fwww.crcpress.com%2FThe-End-of-Error-Unum-Computing%2FGustafson%2F9781482239867&sa=D&sntz=1&usg=AFQjCNG9ezAr5A_BTmpUT6WdVBIYDvaIhA>,
Simon Byrne linked it earlier. I also found a Python port
<https://github.com/jrmuizel/pyunum>).
Jason Merrill
2015-07-30 19:54:39 UTC
Permalink
Post by Job van der Zwan
Post by Steven G. Johnson
The problem is that if you interpret an exact unum as the open interval
between two adjacent exact values, what you have is essentially the same as
interval arithmetic. The result of each operation will produce intervals
that are broader and broader (necessitating lower and lower precision
unums), with the well known problem that the interval quickly becomes
absurdly pessimistic in real problems (i.e. you quickly and prematurely
discard all of your precision in a variable-precision format like unums).
The real problem with interval arithmetic is not open vs. closed
intervals, it is this growth of the error bounds in realistic computations
(due to the dependency problem and similar). (The focus on infinite and
semi-infinite open intervals is a sideshow. If you want useful error
bounds, the important things are the *small* intervals.)
If you discard the interval interpretation with its rapid loss of
precision, what you are left with is an inexact flag per value, but with no
useful error bounds. And I don't believe that this is much more useful than
a single inexact flag for a set of computations as in IEEE.
The thing is, these are *exactly *the criticisms Gustafson has of
traditional interval arithmetic. In fact, he's even more critical of
interval arithmetic than he is of floats, as far as I can see. However, he
claims that ubounds don't share the "absurd pessimism" problem. Supposedly,
traditional interval arithmetic by necessity needs to be more pessimistic
about its boundaries due to rounding, and only using closed endpoint
instead of allowing for open intervals. Unums instead are (supposedly) more
precise about the information loss they have, and thus (supposedly) don't
blow up as badly. Again, his claims, not mine. I'm not saying you're wrong,
or even sure if you disagree as much as you might think you are (although
I'm pretty sure you wouldn't like the tone he uses when describing
traditional methods though).
I agree with the others about the grain of salt (unums/ubounds/uboxes *always
*come out on top in his examples, which does make you wonder), but on the
other hand: given that the mathematica implementation of his methods are
open source, his claims *should* be verifiable (they can be found here
under Downloads/Updates
<https://www.google.com/url?q=https%3A%2F%2Fwww.crcpress.com%2FThe-End-of-Error-Unum-Computing%2FGustafson%2F9781482239867&sa=D&sntz=1&usg=AFQjCNG9ezAr5A_BTmpUT6WdVBIYDvaIhA>,
Simon Byrne linked it earlier. I also found a Python port
<https://github.com/jrmuizel/pyunum>).
If you inspect the specific examples of challenge problems that Gustafson
gives in Chapter 14 of his book, the open vs. closed interval distinction
doesn't actually make an important appearance. The main ways that ubounds
do better than Mathematica's Intervals are

1. Fused operations allow getting around specific cases of the dependency
problem. E.g. using squareu[x] instead of x*x allows putting 0 as a lower
bound of the result, and fdotu allows avoiding cancelation in dot products
(and as a special case, sums and differences).
2. Sometimes the unums are allowed to have more bits in their mantissa than
the bounds of the float Intervals.
3. The ubounds often use fewer bits in their representation (averaged over
a whole calculation) than Interval alternatives.

Only the first two are relevant to correctness/precision. Number 3 is a
performance issue that I don't want to discuss.

Looking at the specific examples,

* "Wrath of Kahan, 1"
Intervals eventually blow up to [-Inf, Inf]. Ubounds also diverge (from the
text, "If you keep going, the left endpoint falls below 6, and then
diverges towards -Inf, but remember that a unum environment can
automatically detect when relative width gets to high..."). They diverge
slightly more slowly in this case because he has allowed 2^6=64 bits in the
mantissa of the ubounds endpoints, whereas the double Interval bounds have
only 52 bits in their mantissa.

* "Wrath of Kahan, 2"
In the unum computation, squaring operations are fused with squareu, but
float Interval calculations are not fused. I also believe the check for the
ubounds containing zero in e[z] is erroneous in a way that makes this
example very deceiving, but I don't want to go into that detail here.

* "Rump's royal pain"
Uses fused powu and squareu operations, and allows up to 2^7=128 bits in
the mantissa for ubounds, whereas double intervals are computed without
fused operations and only allow 52 bits in their mantissa. The fused
operations are critical here.

* "Quadratic formula"
Main advantage comes from using fused squareu operations, and allowing more
bits in the mantissa of the unums than in the mantissa of the single
precision floats. No comparison to float Intervals here.

* "Bailey's numerical nightmare"
Unum Computation is first scaled, and then done almost entirely using fused
dot products, which makes this into an integer computation until the final
division in the case of unums. The float Interval computation wasn't ever
scaled, and the float computation was scaled, but used no fused operations.

* "Fast Fourier Transforms"
I haven't read this example very closely so no comment.

My conclusion is that in all of these specific test cases, Intervals with
float endpoints could get answers that are just as precise/accurate, if
they used the same fused operations, and if their mantissa size was as
large as the maximum mantissa size allowed for the unums. Even so, this is
a useful observation. Environments that provide Intervals should provide a
useful set of fused operations over them to reduce the dependency problem
in a usefully large set of cases. If open vs. closed endpoints are
important, those could easily be added to any type of Interval
representation at the cost of 2 extra bits per interval.

The performance claims might eventually be legitimate (with new hardware),
but I can't personally evaluate them.
Stefan Karpinski
2015-07-30 20:13:09 UTC
Permalink
It seems like you could apply all of these tricks to intervals to the same
effect, and it would still be faster since Float64 ops are implemented in
hardware. For example, given an Interval type, you can define
square(::Interval) so that the lower bound is 0; you can also define
dot(::Vector{Interval}, ::Vector{Interval}) cleverly, etc. (In fact, these
things seem better done at the language level than at the hardware level.
Moreover, none of this really addresses the fundamental issue – there is no
systematic solution to the divergence problem is provided, just a
collection of hacks to make slightly less bad in certain special
circumstances.
Post by Jason Merrill
Post by Job van der Zwan
Post by Steven G. Johnson
The problem is that if you interpret an exact unum as the open interval
between two adjacent exact values, what you have is essentially the same as
interval arithmetic. The result of each operation will produce intervals
that are broader and broader (necessitating lower and lower precision
unums), with the well known problem that the interval quickly becomes
absurdly pessimistic in real problems (i.e. you quickly and prematurely
discard all of your precision in a variable-precision format like unums).
The real problem with interval arithmetic is not open vs. closed
intervals, it is this growth of the error bounds in realistic computations
(due to the dependency problem and similar). (The focus on infinite and
semi-infinite open intervals is a sideshow. If you want useful error
bounds, the important things are the *small* intervals.)
If you discard the interval interpretation with its rapid loss of
precision, what you are left with is an inexact flag per value, but with no
useful error bounds. And I don't believe that this is much more useful than
a single inexact flag for a set of computations as in IEEE.
The thing is, these are *exactly *the criticisms Gustafson has of
traditional interval arithmetic. In fact, he's even more critical of
interval arithmetic than he is of floats, as far as I can see. However, he
claims that ubounds don't share the "absurd pessimism" problem. Supposedly,
traditional interval arithmetic by necessity needs to be more pessimistic
about its boundaries due to rounding, and only using closed endpoint
instead of allowing for open intervals. Unums instead are (supposedly) more
precise about the information loss they have, and thus (supposedly) don't
blow up as badly. Again, his claims, not mine. I'm not saying you're wrong,
or even sure if you disagree as much as you might think you are (although
I'm pretty sure you wouldn't like the tone he uses when describing
traditional methods though).
I agree with the others about the grain of salt (unums/ubounds/uboxes *always
*come out on top in his examples, which does make you wonder), but on
the other hand: given that the mathematica implementation of his methods
are open source, his claims *should* be verifiable (they can be found here
under Downloads/Updates
<https://www.google.com/url?q=https%3A%2F%2Fwww.crcpress.com%2FThe-End-of-Error-Unum-Computing%2FGustafson%2F9781482239867&sa=D&sntz=1&usg=AFQjCNG9ezAr5A_BTmpUT6WdVBIYDvaIhA>,
Simon Byrne linked it earlier. I also found a Python port
<https://github.com/jrmuizel/pyunum>).
If you inspect the specific examples of challenge problems that Gustafson
gives in Chapter 14 of his book, the open vs. closed interval distinction
doesn't actually make an important appearance. The main ways that ubounds
do better than Mathematica's Intervals are
1. Fused operations allow getting around specific cases of the dependency
problem. E.g. using squareu[x] instead of x*x allows putting 0 as a lower
bound of the result, and fdotu allows avoiding cancelation in dot products
(and as a special case, sums and differences).
2. Sometimes the unums are allowed to have more bits in their mantissa
than the bounds of the float Intervals.
3. The ubounds often use fewer bits in their representation (averaged over
a whole calculation) than Interval alternatives.
Only the first two are relevant to correctness/precision. Number 3 is a
performance issue that I don't want to discuss.
Looking at the specific examples,
* "Wrath of Kahan, 1"
Intervals eventually blow up to [-Inf, Inf]. Ubounds also diverge (from
the text, "If you keep going, the left endpoint falls below 6, and then
diverges towards -Inf, but remember that a unum environment can
automatically detect when relative width gets to high..."). They diverge
slightly more slowly in this case because he has allowed 2^6=64 bits in the
mantissa of the ubounds endpoints, whereas the double Interval bounds have
only 52 bits in their mantissa.
* "Wrath of Kahan, 2"
In the unum computation, squaring operations are fused with squareu, but
float Interval calculations are not fused. I also believe the check for the
ubounds containing zero in e[z] is erroneous in a way that makes this
example very deceiving, but I don't want to go into that detail here.
* "Rump's royal pain"
Uses fused powu and squareu operations, and allows up to 2^7=128 bits in
the mantissa for ubounds, whereas double intervals are computed without
fused operations and only allow 52 bits in their mantissa. The fused
operations are critical here.
* "Quadratic formula"
Main advantage comes from using fused squareu operations, and allowing
more bits in the mantissa of the unums than in the mantissa of the single
precision floats. No comparison to float Intervals here.
* "Bailey's numerical nightmare"
Unum Computation is first scaled, and then done almost entirely using
fused dot products, which makes this into an integer computation until the
final division in the case of unums. The float Interval computation wasn't
ever scaled, and the float computation was scaled, but used no fused
operations.
* "Fast Fourier Transforms"
I haven't read this example very closely so no comment.
My conclusion is that in all of these specific test cases, Intervals with
float endpoints could get answers that are just as precise/accurate, if
they used the same fused operations, and if their mantissa size was as
large as the maximum mantissa size allowed for the unums. Even so, this is
a useful observation. Environments that provide Intervals should provide a
useful set of fused operations over them to reduce the dependency problem
in a usefully large set of cases. If open vs. closed endpoints are
important, those could easily be added to any type of Interval
representation at the cost of 2 extra bits per interval.
The performance claims might eventually be legitimate (with new hardware),
but I can't personally evaluate them.
Tom Breloff
2015-07-30 20:50:17 UTC
Permalink
So I see a few recurring themes in this discussion:

1) "Floats can do anything Unums can do if you make them big enough".
I mostly agree with this... But that's a similar argument to saying that we
could just represent a UInt64 by an immutable with 8 UInt8 fields. Sure you
could do it, but its not a very elegant solution.

2) "Unum intervals and float intervals are the same thing if they have the
same precision." This I don't think I agree with, if there is an exact unum
involved in the calc. I feel like incorporating this flag for exactness
(the ubit) is the key point, and changes the results immensely. You could
just make an immutable with a Float64 and a Bool (the ubit) and
mostly accomplish the same thing... So the Unum is just one way to
accomplish this.

3) "we shouldn't explore alternatives to floats, because floats are what is
currently optimized in hardware." Really? Where's your adventurous spirit?
There are some good ideas that, if embraced by a community of
forward-thinking scientists, could most certainly be optimized in hardware
someday.

All this to say... I see promise in the concepts of flexible precision and
exactness information, and I think it can be a more elegant medium to
attack some problems.

If unums and floats were both optimized in hardware and equivalently fast,
I would likely choose unums all the time. With a software implementation,
it would depend on the application whether there's any value. Either way,
I'm working on a prototype and you can decide for yourself if you see any
value in it.
Post by Stefan Karpinski
It seems like you could apply all of these tricks to intervals to the same
effect, and it would still be faster since Float64 ops are implemented in
hardware. For example, given an Interval type, you can define
square(::Interval) so that the lower bound is 0; you can also define
dot(::Vector{Interval}, ::Vector{Interval}) cleverly, etc. (In fact, these
things seem better done at the language level than at the hardware level.
Moreover, none of this really addresses the fundamental issue – there is no
systematic solution to the divergence problem is provided, just a
collection of hacks to make slightly less bad in certain special
circumstances.
Post by Jason Merrill
Post by Job van der Zwan
Post by Steven G. Johnson
The problem is that if you interpret an exact unum as the open interval
between two adjacent exact values, what you have is essentially the same as
interval arithmetic. The result of each operation will produce intervals
that are broader and broader (necessitating lower and lower precision
unums), with the well known problem that the interval quickly becomes
absurdly pessimistic in real problems (i.e. you quickly and prematurely
discard all of your precision in a variable-precision format like unums).
The real problem with interval arithmetic is not open vs. closed
intervals, it is this growth of the error bounds in realistic computations
(due to the dependency problem and similar). (The focus on infinite and
semi-infinite open intervals is a sideshow. If you want useful error
bounds, the important things are the *small* intervals.)
If you discard the interval interpretation with its rapid loss of
precision, what you are left with is an inexact flag per value, but with no
useful error bounds. And I don't believe that this is much more useful than
a single inexact flag for a set of computations as in IEEE.
The thing is, these are *exactly *the criticisms Gustafson has of
traditional interval arithmetic. In fact, he's even more critical of
interval arithmetic than he is of floats, as far as I can see. However, he
claims that ubounds don't share the "absurd pessimism" problem. Supposedly,
traditional interval arithmetic by necessity needs to be more pessimistic
about its boundaries due to rounding, and only using closed endpoint
instead of allowing for open intervals. Unums instead are (supposedly) more
precise about the information loss they have, and thus (supposedly) don't
blow up as badly. Again, his claims, not mine. I'm not saying you're wrong,
or even sure if you disagree as much as you might think you are (although
I'm pretty sure you wouldn't like the tone he uses when describing
traditional methods though).
I agree with the others about the grain of salt (unums/ubounds/uboxes *always
*come out on top in his examples, which does make you wonder), but on
the other hand: given that the mathematica implementation of his methods
are open source, his claims *should* be verifiable (they can be found here
under Downloads/Updates
<https://www.google.com/url?q=https%3A%2F%2Fwww.crcpress.com%2FThe-End-of-Error-Unum-Computing%2FGustafson%2F9781482239867&sa=D&sntz=1&usg=AFQjCNG9ezAr5A_BTmpUT6WdVBIYDvaIhA>,
Simon Byrne linked it earlier. I also found a Python port
<https://github.com/jrmuizel/pyunum>).
If you inspect the specific examples of challenge problems that Gustafson
gives in Chapter 14 of his book, the open vs. closed interval distinction
doesn't actually make an important appearance. The main ways that ubounds
do better than Mathematica's Intervals are
1. Fused operations allow getting around specific cases of the dependency
problem. E.g. using squareu[x] instead of x*x allows putting 0 as a lower
bound of the result, and fdotu allows avoiding cancelation in dot products
(and as a special case, sums and differences).
2. Sometimes the unums are allowed to have more bits in their mantissa
than the bounds of the float Intervals.
3. The ubounds often use fewer bits in their representation (averaged
over a whole calculation) than Interval alternatives.
Only the first two are relevant to correctness/precision. Number 3 is a
performance issue that I don't want to discuss.
Looking at the specific examples,
* "Wrath of Kahan, 1"
Intervals eventually blow up to [-Inf, Inf]. Ubounds also diverge (from
the text, "If you keep going, the left endpoint falls below 6, and then
diverges towards -Inf, but remember that a unum environment can
automatically detect when relative width gets to high..."). They diverge
slightly more slowly in this case because he has allowed 2^6=64 bits in the
mantissa of the ubounds endpoints, whereas the double Interval bounds have
only 52 bits in their mantissa.
* "Wrath of Kahan, 2"
In the unum computation, squaring operations are fused with squareu, but
float Interval calculations are not fused. I also believe the check for the
ubounds containing zero in e[z] is erroneous in a way that makes this
example very deceiving, but I don't want to go into that detail here.
* "Rump's royal pain"
Uses fused powu and squareu operations, and allows up to 2^7=128 bits in
the mantissa for ubounds, whereas double intervals are computed without
fused operations and only allow 52 bits in their mantissa. The fused
operations are critical here.
* "Quadratic formula"
Main advantage comes from using fused squareu operations, and allowing
more bits in the mantissa of the unums than in the mantissa of the single
precision floats. No comparison to float Intervals here.
* "Bailey's numerical nightmare"
Unum Computation is first scaled, and then done almost entirely using
fused dot products, which makes this into an integer computation until the
final division in the case of unums. The float Interval computation wasn't
ever scaled, and the float computation was scaled, but used no fused
operations.
* "Fast Fourier Transforms"
I haven't read this example very closely so no comment.
My conclusion is that in all of these specific test cases, Intervals with
float endpoints could get answers that are just as precise/accurate, if
they used the same fused operations, and if their mantissa size was as
large as the maximum mantissa size allowed for the unums. Even so, this is
a useful observation. Environments that provide Intervals should provide a
useful set of fused operations over them to reduce the dependency problem
in a usefully large set of cases. If open vs. closed endpoints are
important, those could easily be added to any type of Interval
representation at the cost of 2 extra bits per interval.
The performance claims might eventually be legitimate (with new
hardware), but I can't personally evaluate them.
Stefan Karpinski
2015-07-30 21:05:16 UTC
Permalink
Personally, I'm just trying to figure out what the "secret sauce" is.

- Are unum operations associative? If so, then how is that accomplished?
It seems like the answer is "not really", at least not in the sense that
one usually means it – i.e. that doing the operations in different orders
produces the same results.


- Is there some fundamental reason why unum's are better than intervals
when it comes to limit divergence? The answer seems to be no – or at least
that unums don't do anything that you couldn't also do to limit the
divergence of intervals.

What do seem like interesting ideas are the inexact bit and variable
precision.

- Using the inexact bit to represent either a value or an interval with
the same type is clever and I do like how it covers *all* of the real
number line. On the other hand, you can represent an exact value with a
closed interval and equal endpoints.


- Variable precision gives the type more flexibility than floats in much
the same way that floats are more flexible than fixed-point numbers – it's
a point even further on the flexibility versus complexity tradeoff. These
days, probably a good tradeoff, given that we have more transistors than we
know what to do with.

Are these things enough to warrant changing how all the hardware everywhere
in the world does arithmetic? It's certainly worth implementing and seeing
how well it works, and Julia is a uniquely good language for doing such
experiments.
Post by Tom Breloff
1) "Floats can do anything Unums can do if you make them big enough".
I mostly agree with this... But that's a similar argument to saying that we
could just represent a UInt64 by an immutable with 8 UInt8 fields. Sure you
could do it, but its not a very elegant solution.
2) "Unum intervals and float intervals are the same thing if they have the
same precision." This I don't think I agree with, if there is an exact unum
involved in the calc. I feel like incorporating this flag for exactness
(the ubit) is the key point, and changes the results immensely. You could
just make an immutable with a Float64 and a Bool (the ubit) and
mostly accomplish the same thing... So the Unum is just one way to
accomplish this.
3) "we shouldn't explore alternatives to floats, because floats are what
is currently optimized in hardware." Really? Where's your adventurous
spirit? There are some good ideas that, if embraced by a community of
forward-thinking scientists, could most certainly be optimized in hardware
someday.
All this to say... I see promise in the concepts of flexible precision and
exactness information, and I think it can be a more elegant medium to
attack some problems.
If unums and floats were both optimized in hardware and equivalently fast,
I would likely choose unums all the time. With a software implementation,
it would depend on the application whether there's any value. Either way,
I'm working on a prototype and you can decide for yourself if you see any
value in it.
Post by Stefan Karpinski
It seems like you could apply all of these tricks to intervals to the
same effect, and it would still be faster since Float64 ops are implemented
in hardware. For example, given an Interval type, you can define
square(::Interval) so that the lower bound is 0; you can also define
dot(::Vector{Interval}, ::Vector{Interval}) cleverly, etc. (In fact, these
things seem better done at the language level than at the hardware level.
Moreover, none of this really addresses the fundamental issue – there is no
systematic solution to the divergence problem is provided, just a
collection of hacks to make slightly less bad in certain special
circumstances.
Post by Jason Merrill
Post by Job van der Zwan
Post by Steven G. Johnson
The problem is that if you interpret an exact unum as the open
interval between two adjacent exact values, what you have is essentially
the same as interval arithmetic. The result of each operation will produce
intervals that are broader and broader (necessitating lower and lower
precision unums), with the well known problem that the interval quickly
becomes absurdly pessimistic in real problems (i.e. you quickly and
prematurely discard all of your precision in a variable-precision format
like unums).
The real problem with interval arithmetic is not open vs. closed
intervals, it is this growth of the error bounds in realistic computations
(due to the dependency problem and similar). (The focus on infinite and
semi-infinite open intervals is a sideshow. If you want useful error
bounds, the important things are the *small* intervals.)
If you discard the interval interpretation with its rapid loss of
precision, what you are left with is an inexact flag per value, but with no
useful error bounds. And I don't believe that this is much more useful than
a single inexact flag for a set of computations as in IEEE.
The thing is, these are *exactly *the criticisms Gustafson has of
traditional interval arithmetic. In fact, he's even more critical of
interval arithmetic than he is of floats, as far as I can see. However, he
claims that ubounds don't share the "absurd pessimism" problem. Supposedly,
traditional interval arithmetic by necessity needs to be more pessimistic
about its boundaries due to rounding, and only using closed endpoint
instead of allowing for open intervals. Unums instead are (supposedly) more
precise about the information loss they have, and thus (supposedly) don't
blow up as badly. Again, his claims, not mine. I'm not saying you're wrong,
or even sure if you disagree as much as you might think you are (although
I'm pretty sure you wouldn't like the tone he uses when describing
traditional methods though).
I agree with the others about the grain of salt (unums/ubounds/uboxes *always
*come out on top in his examples, which does make you wonder), but on
the other hand: given that the mathematica implementation of his methods
are open source, his claims *should* be verifiable (they can be found here
under Downloads/Updates
<https://www.google.com/url?q=https%3A%2F%2Fwww.crcpress.com%2FThe-End-of-Error-Unum-Computing%2FGustafson%2F9781482239867&sa=D&sntz=1&usg=AFQjCNG9ezAr5A_BTmpUT6WdVBIYDvaIhA>,
Simon Byrne linked it earlier. I also found a Python port
<https://github.com/jrmuizel/pyunum>).
If you inspect the specific examples of challenge problems that
Gustafson gives in Chapter 14 of his book, the open vs. closed interval
distinction doesn't actually make an important appearance. The main ways
that ubounds do better than Mathematica's Intervals are
1. Fused operations allow getting around specific cases of the
dependency problem. E.g. using squareu[x] instead of x*x allows putting 0
as a lower bound of the result, and fdotu allows avoiding cancelation in
dot products (and as a special case, sums and differences).
2. Sometimes the unums are allowed to have more bits in their mantissa
than the bounds of the float Intervals.
3. The ubounds often use fewer bits in their representation (averaged
over a whole calculation) than Interval alternatives.
Only the first two are relevant to correctness/precision. Number 3 is a
performance issue that I don't want to discuss.
Looking at the specific examples,
* "Wrath of Kahan, 1"
Intervals eventually blow up to [-Inf, Inf]. Ubounds also diverge (from
the text, "If you keep going, the left endpoint falls below 6, and then
diverges towards -Inf, but remember that a unum environment can
automatically detect when relative width gets to high..."). They diverge
slightly more slowly in this case because he has allowed 2^6=64 bits in the
mantissa of the ubounds endpoints, whereas the double Interval bounds have
only 52 bits in their mantissa.
* "Wrath of Kahan, 2"
In the unum computation, squaring operations are fused with squareu, but
float Interval calculations are not fused. I also believe the check for the
ubounds containing zero in e[z] is erroneous in a way that makes this
example very deceiving, but I don't want to go into that detail here.
* "Rump's royal pain"
Uses fused powu and squareu operations, and allows up to 2^7=128 bits in
the mantissa for ubounds, whereas double intervals are computed without
fused operations and only allow 52 bits in their mantissa. The fused
operations are critical here.
* "Quadratic formula"
Main advantage comes from using fused squareu operations, and allowing
more bits in the mantissa of the unums than in the mantissa of the single
precision floats. No comparison to float Intervals here.
* "Bailey's numerical nightmare"
Unum Computation is first scaled, and then done almost entirely using
fused dot products, which makes this into an integer computation until the
final division in the case of unums. The float Interval computation wasn't
ever scaled, and the float computation was scaled, but used no fused
operations.
* "Fast Fourier Transforms"
I haven't read this example very closely so no comment.
My conclusion is that in all of these specific test cases, Intervals
with float endpoints could get answers that are just as precise/accurate,
if they used the same fused operations, and if their mantissa size was as
large as the maximum mantissa size allowed for the unums. Even so, this is
a useful observation. Environments that provide Intervals should provide a
useful set of fused operations over them to reduce the dependency problem
in a usefully large set of cases. If open vs. closed endpoints are
important, those could easily be added to any type of Interval
representation at the cost of 2 extra bits per interval.
The performance claims might eventually be legitimate (with new
hardware), but I can't personally evaluate them.
John Gustafson
2015-07-31 19:33:21 UTC
Permalink
I'll try to answer this concisely.

Unum addition and multiplication are associative; they give bitwise
identical results if performed in the *g*-layer (fused operations) and if
not fused, will produce the same answer but possibly with different
accuracy. When (*a* + *b*) + *c* is not identical to *a* + (*b* + *c*), the
results will always overlap and the intersection of the two is a
mathematically valid refinement of the answer. It is not possible for (*a*
+ *b*) + *c ≠ **a* + (*b* + *c*) to happen. Similarly for multiplication.
Unums also obey the distributive law of algebra. The only "not really" part
of the associativity is the possibility of different accuracies, which can
be eliminated by using fused operations.

The quick explanation for why unums/ubounds don't diverge like intervals do
is that when the result gets wider, it divides like an amoeba into a
collection of unums that alternate between exact and inexact values that
tile the interval. That keeps a lid on the dependency problem, and for
multidimensional problems, it keeps a lid on the wrapping problem (which is
the point of Part 2 of the book, The Ubox Method). Attempts to use interval
arithmetic to solve the *n*-body problem fail miserably because the bounds
grow so fast; the uncertainty feeds on itself. With unums you always start
a time step with an exact or ULP-wide value, and it can only expand by the
same amount. The resulting set of ULPs overlaps, and the union of them only
grows linearly. Floating-point methods for ordinary differential equations
can provide estimates of error that are order N after N time steps, but
they cannot tell you what the bound *is*, only an estimate for the order.
That's sort of the "secret sauce." I actually developed the ubox method
first, using floats and traditional intervals, and discovered I could not
make them work unless I could distinguish between open and closed endpoints
and exact versus inexact reals. That forced me to tear computer arithmetic
down to its foundations and re-build it, respecting compatibility with
existing floats as much as possible but adding what I needed to make it
possible to solve standard numerical analysis problems.

One reason we need unum arithmetic now is that we are stymied by "the
Memory Wall". Too little bandwidth, and the memory bandwidth also costs too
much energy/power. But we are schlepping around far more bits than we need,
as insurance in case we need the precision somewhere but of course do not
have the time or expertise to identify exactly where. And we have more
transistors on-chip than we know what to do with these days. That's why it
makes sense to move to a format that uses fewer bits on average, even if it
takes more gates to implement.
Post by Stefan Karpinski
Personally, I'm just trying to figure out what the "secret sauce" is.
- Are unum operations associative? If so, then how is that
accomplished? It seems like the answer is "not really", at least not in the
sense that one usually means it – i.e. that doing the operations in
different orders produces the same results.
- Is there some fundamental reason why unum's are better than
intervals when it comes to limit divergence? The answer seems to be no – or
at least that unums don't do anything that you couldn't also do to limit
the divergence of intervals.
What do seem like interesting ideas are the inexact bit and variable
precision.
- Using the inexact bit to represent either a value or an interval
with the same type is clever and I do like how it covers *all* of the real
number line. On the other hand, you can represent an exact value with a
closed interval and equal endpoints.
- Variable precision gives the type more flexibility than floats in
much the same way that floats are more flexible than fixed-point numbers –
it's a point even further on the flexibility versus complexity tradeoff.
These days, probably a good tradeoff, given that we have more transistors
than we know what to do with.
Are these things enough to warrant changing how all the hardware
everywhere in the world does arithmetic? It's certainly worth implementing
and seeing how well it works, and Julia is a uniquely good language for
doing such experiments.
Post by Tom Breloff
1) "Floats can do anything Unums can do if you make them big enough".
I mostly agree with this... But that's a similar argument to saying that we
could just represent a UInt64 by an immutable with 8 UInt8 fields. Sure you
could do it, but its not a very elegant solution.
2) "Unum intervals and float intervals are the same thing if they have
the same precision." This I don't think I agree with, if there is an exact
unum involved in the calc. I feel like incorporating this flag for
exactness (the ubit) is the key point, and changes the results immensely.
You could just make an immutable with a Float64 and a Bool (the ubit) and
mostly accomplish the same thing... So the Unum is just one way to
accomplish this.
3) "we shouldn't explore alternatives to floats, because floats are what
is currently optimized in hardware." Really? Where's your adventurous
spirit? There are some good ideas that, if embraced by a community of
forward-thinking scientists, could most certainly be optimized in hardware
someday.
All this to say... I see promise in the concepts of flexible precision
and exactness information, and I think it can be a more elegant medium to
attack some problems.
If unums and floats were both optimized in hardware and equivalently
fast, I would likely choose unums all the time. With a software
implementation, it would depend on the application whether there's any
value. Either way, I'm working on a prototype and you can decide for
yourself if you see any value in it.
Post by Stefan Karpinski
It seems like you could apply all of these tricks to intervals to the
same effect, and it would still be faster since Float64 ops are implemented
in hardware. For example, given an Interval type, you can define
square(::Interval) so that the lower bound is 0; you can also define
dot(::Vector{Interval}, ::Vector{Interval}) cleverly, etc. (In fact, these
things seem better done at the language level than at the hardware level.
Moreover, none of this really addresses the fundamental issue – there is no
systematic solution to the divergence problem is provided, just a
collection of hacks to make slightly less bad in certain special
circumstances.
Post by Jason Merrill
Post by Job van der Zwan
Post by Steven G. Johnson
The problem is that if you interpret an exact unum as the open
interval between two adjacent exact values, what you have is essentially
the same as interval arithmetic. The result of each operation will produce
intervals that are broader and broader (necessitating lower and lower
precision unums), with the well known problem that the interval quickly
becomes absurdly pessimistic in real problems (i.e. you quickly and
prematurely discard all of your precision in a variable-precision format
like unums).
The real problem with interval arithmetic is not open vs. closed
intervals, it is this growth of the error bounds in realistic computations
(due to the dependency problem and similar). (The focus on infinite and
semi-infinite open intervals is a sideshow. If you want useful error
bounds, the important things are the *small* intervals.)
If you discard the interval interpretation with its rapid loss of
precision, what you are left with is an inexact flag per value, but with no
useful error bounds. And I don't believe that this is much more useful than
a single inexact flag for a set of computations as in IEEE.
The thing is, these are *exactly *the criticisms Gustafson has of
traditional interval arithmetic. In fact, he's even more critical of
interval arithmetic than he is of floats, as far as I can see. However, he
claims that ubounds don't share the "absurd pessimism" problem. Supposedly,
traditional interval arithmetic by necessity needs to be more pessimistic
about its boundaries due to rounding, and only using closed endpoint
instead of allowing for open intervals. Unums instead are (supposedly) more
precise about the information loss they have, and thus (supposedly) don't
blow up as badly. Again, his claims, not mine. I'm not saying you're wrong,
or even sure if you disagree as much as you might think you are (although
I'm pretty sure you wouldn't like the tone he uses when describing
traditional methods though).
I agree with the others about the grain of salt (unums/ubounds/uboxes *always
*come out on top in his examples, which does make you wonder), but on
the other hand: given that the mathematica implementation of his methods
are open source, his claims *should* be verifiable (they can be found here
under Downloads/Updates
<https://www.google.com/url?q=https%3A%2F%2Fwww.crcpress.com%2FThe-End-of-Error-Unum-Computing%2FGustafson%2F9781482239867&sa=D&sntz=1&usg=AFQjCNG9ezAr5A_BTmpUT6WdVBIYDvaIhA>,
Simon Byrne linked it earlier. I also found a Python port
<https://github.com/jrmuizel/pyunum>).
If you inspect the specific examples of challenge problems that
Gustafson gives in Chapter 14 of his book, the open vs. closed interval
distinction doesn't actually make an important appearance. The main ways
that ubounds do better than Mathematica's Intervals are
1. Fused operations allow getting around specific cases of the
dependency problem. E.g. using squareu[x] instead of x*x allows putting 0
as a lower bound of the result, and fdotu allows avoiding cancelation in
dot products (and as a special case, sums and differences).
2. Sometimes the unums are allowed to have more bits in their mantissa
than the bounds of the float Intervals.
3. The ubounds often use fewer bits in their representation (averaged
over a whole calculation) than Interval alternatives.
Only the first two are relevant to correctness/precision. Number 3 is a
performance issue that I don't want to discuss.
Looking at the specific examples,
* "Wrath of Kahan, 1"
Intervals eventually blow up to [-Inf, Inf]. Ubounds also diverge (from
the text, "If you keep going, the left endpoint falls below 6, and then
diverges towards -Inf, but remember that a unum environment can
automatically detect when relative width gets to high..."). They diverge
slightly more slowly in this case because he has allowed 2^6=64 bits in the
mantissa of the ubounds endpoints, whereas the double Interval bounds have
only 52 bits in their mantissa.
* "Wrath of Kahan, 2"
In the unum computation, squaring operations are fused with squareu,
but float Interval calculations are not fused. I also believe the check for
the ubounds containing zero in e[z] is erroneous in a way that makes this
example very deceiving, but I don't want to go into that detail here.
* "Rump's royal pain"
Uses fused powu and squareu operations, and allows up to 2^7=128 bits
in the mantissa for ubounds, whereas double intervals are computed without
fused operations and only allow 52 bits in their mantissa. The fused
operations are critical here.
* "Quadratic formula"
Main advantage comes from using fused squareu operations, and allowing
more bits in the mantissa of the unums than in the mantissa of the single
precision floats. No comparison to float Intervals here.
* "Bailey's numerical nightmare"
Unum Computation is first scaled, and then done almost entirely using
fused dot products, which makes this into an integer computation until the
final division in the case of unums. The float Interval computation wasn't
ever scaled, and the float computation was scaled, but used no fused
operations.
* "Fast Fourier Transforms"
I haven't read this example very closely so no comment.
My conclusion is that in all of these specific test cases, Intervals
with float endpoints could get answers that are just as precise/accurate,
if they used the same fused operations, and if their mantissa size was as
large as the maximum mantissa size allowed for the unums. Even so, this is
a useful observation. Environments that provide Intervals should provide a
useful set of fused operations over them to reduce the dependency problem
in a usefully large set of cases. If open vs. closed endpoints are
important, those could easily be added to any type of Interval
representation at the cost of 2 extra bits per interval.
The performance claims might eventually be legitimate (with new
hardware), but I can't personally evaluate them.
Job van der Zwan
2015-07-30 20:22:33 UTC
Permalink
<Analysis of examples in the book>
Thanks for correcting me! The open/closed element becomes pretty crucial
later on though, when he claims on page 225 that:

a general approach for evaluating polynomials with interval arguments
without any information loss is presented here for the first time.
Two pages later he gives the general scheme for it (see attached picture -
it was too much of a pain to extract that text with proper formatting. This
is ok under fair use right?).

Do you have any thoughts on that?

<Loading Image...>
Jason Merrill
2015-07-30 21:20:38 UTC
Permalink
Post by Job van der Zwan
<Analysis of examples in the book>
Thanks for correcting me! The open/closed element becomes pretty crucial
a general approach for evaluating polynomials with interval arguments
without any information loss is presented here for the first time.
Two pages later he gives the general scheme for it (see attached picture -
it was too much of a pain to extract that text with proper formatting. This
is ok under fair use right?).
Do you have any thoughts on that?
The fused polynomial evaluation seems pretty brilliant to me. He later goes
on to suggest having a fused product ratio, which should largely allow
eliminating the dependency problem from evaluating rational functions. You
can get an awful lot done with rational functions.

<https://lh3.googleusercontent.com/-f-sYnCMJFpQ/VbqE8zbN5AI/AAAAAAAAHOk/cNTnxAUAyoU/s1600/polynomial.png>I
actually think keeping track of open vs. closed intervals sounds like a
pretty good idea. It might also be worth doing for other kinds of interval
arithmetic, and I don't see any major reason that that would be impossible.
I didn't meant to say that open vs closed intervals doesn't matter--I just
meant that it doesn't seem to be the "secret sauce" in any of the challenge
problems in Chapter 14. To me, the fused operations are the secret sauce in
terms of precision, and the variable length representation *might be* the
secret sauce for performance, but I can't really comment on that.
Stefan Karpinski
2015-07-30 22:43:43 UTC
Permalink
Fused polynomials do seem like a good idea (again, can be done for
intervals too), but what is the end game of this approach? Is there some
set of primitives that are sufficient to express all computations you might
want to do in a way that doesn't lose accuracy too rapidly to be useful? It
seems like the reductio ad absurdum is producing a fused version of your
entire program that cleverly produces a correct interval.
Post by Jason Merrill
Post by Job van der Zwan
<Analysis of examples in the book>
Thanks for correcting me! The open/closed element becomes pretty crucial
a general approach for evaluating polynomials with interval arguments
without any information loss is presented here for the first time.
Two pages later he gives the general scheme for it (see attached picture
- it was too much of a pain to extract that text with proper formatting.
This is ok under fair use right?).
Do you have any thoughts on that?
The fused polynomial evaluation seems pretty brilliant to me. He later
goes on to suggest having a fused product ratio, which should largely allow
eliminating the dependency problem from evaluating rational functions. You
can get an awful lot done with rational functions.
<https://lh3.googleusercontent.com/-f-sYnCMJFpQ/VbqE8zbN5AI/AAAAAAAAHOk/cNTnxAUAyoU/s1600/polynomial.png>I
actually think keeping track of open vs. closed intervals sounds like a
pretty good idea. It might also be worth doing for other kinds of interval
arithmetic, and I don't see any major reason that that would be impossible.
I didn't meant to say that open vs closed intervals doesn't matter--I just
meant that it doesn't seem to be the "secret sauce" in any of the challenge
problems in Chapter 14. To me, the fused operations are the secret sauce in
terms of precision, and the variable length representation *might be* the
secret sauce for performance, but I can't really comment on that.
John Gustafson
2015-07-31 19:39:01 UTC
Permalink
I discuss this in the book; there have to be strict bounds on how long a
computation remains in the *g*-layer (fused) or people would dump their
entire calculation in there. I think i got most of the fused operations
that make sense, and I pointed out some that do not make sense. It is key
that you should have a finite and predictable bound on the memory
requirement of the *g*-layer where scratch work is done. It cannot be
regarded as unlimited, or limited only by available system memory. For
every fused operation, I can predict how many bits will be needed to return
a correct answer, which means there is hope for a hardware implementation
someday.
Post by Stefan Karpinski
Fused polynomials do seem like a good idea (again, can be done for
intervals too), but what is the end game of this approach? Is there some
set of primitives that are sufficient to express all computations you might
want to do in a way that doesn't lose accuracy too rapidly to be useful? It
seems like the reductio ad absurdum is producing a fused version of your
entire program that cleverly produces a correct interval.
Post by Jason Merrill
Post by Job van der Zwan
<Analysis of examples in the book>
Thanks for correcting me! The open/closed element becomes pretty crucial
a general approach for evaluating polynomials with interval arguments
without any information loss is presented here for the first time.
Two pages later he gives the general scheme for it (see attached picture
- it was too much of a pain to extract that text with proper formatting.
This is ok under fair use right?).
Do you have any thoughts on that?
The fused polynomial evaluation seems pretty brilliant to me. He later
goes on to suggest having a fused product ratio, which should largely allow
eliminating the dependency problem from evaluating rational functions. You
can get an awful lot done with rational functions.
<https://lh3.googleusercontent.com/-f-sYnCMJFpQ/VbqE8zbN5AI/AAAAAAAAHOk/cNTnxAUAyoU/s1600/polynomial.png>I
actually think keeping track of open vs. closed intervals sounds like a
pretty good idea. It might also be worth doing for other kinds of interval
arithmetic, and I don't see any major reason that that would be impossible.
I didn't meant to say that open vs closed intervals doesn't matter--I just
meant that it doesn't seem to be the "secret sauce" in any of the challenge
problems in Chapter 14. To me, the fused operations are the secret sauce in
terms of precision, and the variable length representation *might be* the
secret sauce for performance, but I can't really comment on that.
Jeffrey Sarnoff
2015-07-31 19:51:21 UTC
Permalink
What would be the first problem you address with this made hardware?
Post by John Gustafson
I discuss this in the book; there have to be strict bounds on how long a
computation remains in the *g*-layer (fused) or people would dump their
entire calculation in there. I think i got most of the fused operations
that make sense, and I pointed out some that do not make sense. It is key
that you should have a finite and predictable bound on the memory
requirement of the *g*-layer where scratch work is done. It cannot be
regarded as unlimited, or limited only by available system memory. For
every fused operation, I can predict how many bits will be needed to return
a correct answer, which means there is hope for a hardware implementation
someday.
Post by Stefan Karpinski
Fused polynomials do seem like a good idea (again, can be done for
intervals too), but what is the end game of this approach? Is there some
set of primitives that are sufficient to express all computations you might
want to do in a way that doesn't lose accuracy too rapidly to be useful? It
seems like the reductio ad absurdum is producing a fused version of your
entire program that cleverly produces a correct interval.
Post by Jason Merrill
Post by Job van der Zwan
<Analysis of examples in the book>
Thanks for correcting me! The open/closed element becomes pretty
a general approach for evaluating polynomials with interval arguments
without any information loss is presented here for the first time.
Two pages later he gives the general scheme for it (see attached
picture - it was too much of a pain to extract that text with proper
formatting. This is ok under fair use right?).
Do you have any thoughts on that?
The fused polynomial evaluation seems pretty brilliant to me. He later
goes on to suggest having a fused product ratio, which should largely allow
eliminating the dependency problem from evaluating rational functions. You
can get an awful lot done with rational functions.
<https://lh3.googleusercontent.com/-f-sYnCMJFpQ/VbqE8zbN5AI/AAAAAAAAHOk/cNTnxAUAyoU/s1600/polynomial.png>I
actually think keeping track of open vs. closed intervals sounds like a
pretty good idea. It might also be worth doing for other kinds of interval
arithmetic, and I don't see any major reason that that would be impossible.
I didn't meant to say that open vs closed intervals doesn't matter--I just
meant that it doesn't seem to be the "secret sauce" in any of the challenge
problems in Chapter 14. To me, the fused operations are the secret sauce in
terms of precision, and the variable length representation *might be* the
secret sauce for performance, but I can't really comment on that.
John Gustafson
2015-07-31 21:17:07 UTC
Permalink
I would probably attempt an n-body calculation first. That would allow us
to check the hypothesis that uboxes form ellipsoidal clouds as the
computation progresses, which is why Kahan came up with a form of
arithmetic based on hyperellipsoids.
Post by Jeffrey Sarnoff
What would be the first problem you address with this made hardware?
Post by John Gustafson
I discuss this in the book; there have to be strict bounds on how long a
computation remains in the *g*-layer (fused) or people would dump their
entire calculation in there. I think i got most of the fused operations
that make sense, and I pointed out some that do not make sense. It is key
that you should have a finite and predictable bound on the memory
requirement of the *g*-layer where scratch work is done. It cannot be
regarded as unlimited, or limited only by available system memory. For
every fused operation, I can predict how many bits will be needed to return
a correct answer, which means there is hope for a hardware implementation
someday.
Post by Stefan Karpinski
Fused polynomials do seem like a good idea (again, can be done for
intervals too), but what is the end game of this approach? Is there some
set of primitives that are sufficient to express all computations you might
want to do in a way that doesn't lose accuracy too rapidly to be useful? It
seems like the reductio ad absurdum is producing a fused version of your
entire program that cleverly produces a correct interval.
Post by Jason Merrill
Post by Job van der Zwan
<Analysis of examples in the book>
Thanks for correcting me! The open/closed element becomes pretty
a general approach for evaluating polynomials with interval arguments
without any information loss is presented here for the first time.
Two pages later he gives the general scheme for it (see attached
picture - it was too much of a pain to extract that text with proper
formatting. This is ok under fair use right?).
Do you have any thoughts on that?
The fused polynomial evaluation seems pretty brilliant to me. He later
goes on to suggest having a fused product ratio, which should largely allow
eliminating the dependency problem from evaluating rational functions. You
can get an awful lot done with rational functions.
<https://lh3.googleusercontent.com/-f-sYnCMJFpQ/VbqE8zbN5AI/AAAAAAAAHOk/cNTnxAUAyoU/s1600/polynomial.png>I
actually think keeping track of open vs. closed intervals sounds like a
pretty good idea. It might also be worth doing for other kinds of interval
arithmetic, and I don't see any major reason that that would be impossible.
I didn't meant to say that open vs closed intervals doesn't matter--I just
meant that it doesn't seem to be the "secret sauce" in any of the challenge
problems in Chapter 14. To me, the fused operations are the secret sauce in
terms of precision, and the variable length representation *might be* the
secret sauce for performance, but I can't really comment on that.
Steven G. Johnson
2015-07-30 22:46:51 UTC
Permalink
People have devised methods for evaluation of polynomials with interval
arithmetic, too (google it). Not sure how his method compares. It is well
known that you can often work around the dependency problem for very
specific expressions.

However, is not practical to tell people that they need to solve a new
numerical-analysis research problem every time they have a new program in
which a variable is used more than once (used more than once => dependency
problem).

And if you don't solve the dependency problem, your error bounds are
useless for general-purpose tasks. And without accurate error bounds,
adaptive precision is a non-starter.
John Gustafson
2015-07-31 19:45:32 UTC
Permalink
Existing methods for evaluation of polynomials do not produce tight bounds.
There is indeed a mountain of papers written about doing it, all with the
flavor of "our method sucks less" because it usually gets somewhat tighter
bound, though still not as tight as possible. I was surprised to learn
this, because I expected to just Google the evaluation of polynomials of
intervals and make a unum version of it. That's when I discovered no one
had solved the problem, and had even published proofs that it is NP-hard.
Gulp! So it took me an extra *three months* to solve that problem, and I
wondered if I should publish it as a standalone paper, but no, I needed to
get the book done.

I strongly agree that people cannot be asked to solve a new numerical
analysis problem every time they program a new function. That is *exactly* the
point I make over and over in Part 2. We need to simply express what we
want calculated, and let the *computer* do all the work to get an answer
that satisfies the environment setting of maximum allowed relative error.
The last thing we need is a set of "numerical recipes" to choose from.
Post by Steven G. Johnson
People have devised methods for evaluation of polynomials with interval
arithmetic, too (google it). Not sure how his method compares. It is well
known that you can often work around the dependency problem for very
specific expressions.
However, is not practical to tell people that they need to solve a new
numerical-analysis research problem every time they have a new program in
which a variable is used more than once (used more than once => dependency
problem).
And if you don't solve the dependency problem, your error bounds are
useless for general-purpose tasks. And without accurate error bounds,
adaptive precision is a non-starter.
Zenna Tavares
2015-07-31 19:54:29 UTC
Permalink
Post by John Gustafson
The quick explanation for why unums/ubounds don't diverge like intervals
do is that when the result gets wider, it divides like an amoeba into a
collection of unums that alternate between exact and inexact values that
tile the interval
It seems like this will incur another problem: doing Cartesian-product
computations with an ever increasing number of boxes. In other words, if
at some intermediate stage, you split your unum into N uboxes, now you do
some operation with M other uboxes, you now have N*M uboxes in the output.
This will continue until your memory explodes. Is the unum solution to
try to merge boxes at every stage?

In higher dimensions it gets worse. Fundamentally, you cannot approximate
(i.e. cover) high dimensional geometric shapes efficiently with many boxes
- you need a number exponential in the dimension for most shapes.

Zenna
Post by John Gustafson
Existing methods for evaluation of polynomials do not produce tight
bounds. There is indeed a mountain of papers written about doing it, all
with the flavor of "our method sucks less" because it usually gets somewhat
tighter bound, though still not as tight as possible. I was surprised to
learn this, because I expected to just Google the evaluation of polynomials
of intervals and make a unum version of it. That's when I discovered no one
had solved the problem, and had even published proofs that it is NP-hard.
Gulp! So it took me an extra *three months* to solve that problem, and I
wondered if I should publish it as a standalone paper, but no, I needed to
get the book done.
I strongly agree that people cannot be asked to solve a new numerical
analysis problem every time they program a new function. That is *exactly* the
point I make over and over in Part 2. We need to simply express what we
want calculated, and let the *computer* do all the work to get an answer
that satisfies the environment setting of maximum allowed relative error.
The last thing we need is a set of "numerical recipes" to choose from.
Post by Steven G. Johnson
People have devised methods for evaluation of polynomials with interval
arithmetic, too (google it). Not sure how his method compares. It is well
known that you can often work around the dependency problem for very
specific expressions.
However, is not practical to tell people that they need to solve a new
numerical-analysis research problem every time they have a new program in
which a variable is used more than once (used more than once => dependency
problem).
And if you don't solve the dependency problem, your error bounds are
useless for general-purpose tasks. And without accurate error bounds,
adaptive precision is a non-starter.
Jeffrey Sarnoff
2015-07-31 20:10:10 UTC
Permalink
Zenna, I had been wondering if there might be something in the tiling
nature that makes unums particularly well suited to solving problems posed
on higher dimensional surfaces?
Post by John Gustafson
The quick explanation for why unums/ubounds don't diverge like intervals
Post by John Gustafson
do is that when the result gets wider, it divides like an amoeba into a
collection of unums that alternate between exact and inexact values that
tile the interval
It seems like this will incur another problem: doing Cartesian-product
computations with an ever increasing number of boxes. In other words, if
at some intermediate stage, you split your unum into N uboxes, now you do
some operation with M other uboxes, you now have N*M uboxes in the output.
This will continue until your memory explodes. Is the unum solution to
try to merge boxes at every stage?
In higher dimensions it gets worse. Fundamentally, you cannot approximate
(i.e. cover) high dimensional geometric shapes efficiently with many boxes
- you need a number exponential in the dimension for most shapes.
Zenna
Post by John Gustafson
Existing methods for evaluation of polynomials do not produce tight
bounds. There is indeed a mountain of papers written about doing it, all
with the flavor of "our method sucks less" because it usually gets somewhat
tighter bound, though still not as tight as possible. I was surprised to
learn this, because I expected to just Google the evaluation of polynomials
of intervals and make a unum version of it. That's when I discovered no one
had solved the problem, and had even published proofs that it is NP-hard.
Gulp! So it took me an extra *three months* to solve that problem, and I
wondered if I should publish it as a standalone paper, but no, I needed to
get the book done.
I strongly agree that people cannot be asked to solve a new numerical
analysis problem every time they program a new function. That is
*exactly* the point I make over and over in Part 2. We need to simply
express what we want calculated, and let the *computer* do all the work
to get an answer that satisfies the environment setting of maximum allowed
relative error. The last thing we need is a set of "numerical recipes" to
choose from.
Post by Steven G. Johnson
People have devised methods for evaluation of polynomials with interval
arithmetic, too (google it). Not sure how his method compares. It is well
known that you can often work around the dependency problem for very
specific expressions.
However, is not practical to tell people that they need to solve a new
numerical-analysis research problem every time they have a new program in
which a variable is used more than once (used more than once => dependency
problem).
And if you don't solve the dependency problem, your error bounds are
useless for general-purpose tasks. And without accurate error bounds,
adaptive precision is a non-starter.
John Gustafson
2015-07-31 21:23:00 UTC
Permalink
I know it looks scary, but these days, supercomputers can do tens of
petaflops of calculation and have hundreds of millions of processors. And
other than LINPACK and some trivial stuff (like collecting Monte Carlo
data), very few applications have been scaled to run on hundreds of
millions of processors. The ubox approach allows a very straightforward
tradeoff between speed and accuracy. If you have less processing power, you
use lower-resolution uboxes but still achieve a bound.

Or, if you decide to guess, you pick the center of a ubox collection,
replace it with a float (an exact unum), and continue. That's still
superior to using floats, since floats guess every single time and you have
no idea whether their guess is even inside the set of uboxes that are
guaranteed to contain the answer. In fact, this may turn out to be the best
way to use unums; start with floats, and gradually improve calculations
with unums and uboxes where you are free to revert to floats any time a
bound starts to become too many uboxes to handle.
Post by John Gustafson
The quick explanation for why unums/ubounds don't diverge like intervals
Post by John Gustafson
do is that when the result gets wider, it divides like an amoeba into a
collection of unums that alternate between exact and inexact values that
tile the interval
It seems like this will incur another problem: doing Cartesian-product
computations with an ever increasing number of boxes. In other words, if
at some intermediate stage, you split your unum into N uboxes, now you do
some operation with M other uboxes, you now have N*M uboxes in the output.
This will continue until your memory explodes. Is the unum solution to
try to merge boxes at every stage?
In higher dimensions it gets worse. Fundamentally, you cannot approximate
(i.e. cover) high dimensional geometric shapes efficiently with many boxes
- you need a number exponential in the dimension for most shapes.
Zenna
Post by John Gustafson
Existing methods for evaluation of polynomials do not produce tight
bounds. There is indeed a mountain of papers written about doing it, all
with the flavor of "our method sucks less" because it usually gets somewhat
tighter bound, though still not as tight as possible. I was surprised to
learn this, because I expected to just Google the evaluation of polynomials
of intervals and make a unum version of it. That's when I discovered no one
had solved the problem, and had even published proofs that it is NP-hard.
Gulp! So it took me an extra *three months* to solve that problem, and I
wondered if I should publish it as a standalone paper, but no, I needed to
get the book done.
I strongly agree that people cannot be asked to solve a new numerical
analysis problem every time they program a new function. That is
*exactly* the point I make over and over in Part 2. We need to simply
express what we want calculated, and let the *computer* do all the work
to get an answer that satisfies the environment setting of maximum allowed
relative error. The last thing we need is a set of "numerical recipes" to
choose from.
Post by Steven G. Johnson
People have devised methods for evaluation of polynomials with interval
arithmetic, too (google it). Not sure how his method compares. It is well
known that you can often work around the dependency problem for very
specific expressions.
However, is not practical to tell people that they need to solve a new
numerical-analysis research problem every time they have a new program in
which a variable is used more than once (used more than once => dependency
problem).
And if you don't solve the dependency problem, your error bounds are
useless for general-purpose tasks. And without accurate error bounds,
adaptive precision is a non-starter.
Jason Merrill
2015-07-31 16:51:57 UTC
Permalink
Post by Jason Merrill
* "Wrath of Kahan, 2"
In the unum computation, squaring operations are fused with squareu, but
float Interval calculations are not fused. I also believe the check for the
ubounds containing zero in e[z] is erroneous in a way that makes this
example very deceiving, but I don't want to go into that detail here.
Since it looks like Dr. Gustafson is reading this thread, I wanted to give
my specific objection to this example. You should be able to read the
relevant text of the book here:

https://books.google.com/books?id=fZsXBgAAQBAJ&pg=PA176&lpg=PA176&dq=Kahan+constructed+the+following+fiendishly+clever+example&source=bl&ots=MH0vfJyw2V&sig=ZEzOR7sCXGyzcRbncbqlRQJdWaA&hl=en&sa=X&ved=0CB4Q6AEwAGoVChMIr9HmxOeFxwIVRlw-Ch3wjQ2K#v=onepage&q=Kahan%20constructed%20the%20following%20fiendishly%20clever%20example&f=false

There's a function e(x) = (exp(x) - 1)/x, defined to be 1 when x is 0. In
the unum definition of this function, the function checks whether x
*contains* zero when x is a ubound, and in this case, returns 1 exactly.
This incorrectly collapses bounds with a finite width down to an exact
answer.

If you look at the output of q(x) for the example points suggested in the
text, it is a bound of finite width, but the containment check in e(x)
collapses e(q(x)^2) down to an exact value, making unums look better than
they are.

To be clear, I interpret this as an honest mistake, but this is also one of
the high excitement points of the book (at least it was for me), so it's
important to be very careful about what's really going on here.
Jason Merrill
2015-07-31 17:21:25 UTC
Permalink
Post by Jason Merrill
Post by Jason Merrill
* "Wrath of Kahan, 2"
In the unum computation, squaring operations are fused with squareu, but
float Interval calculations are not fused. I also believe the check for the
ubounds containing zero in e[z] is erroneous in a way that makes this
example very deceiving, but I don't want to go into that detail here.
Since it looks like Dr. Gustafson is reading this thread, I wanted to give
my specific objection to this example. You should be able to read the
https://books.google.com/books?id=fZsXBgAAQBAJ&pg=PA176&lpg=PA176&dq=Kahan+constructed+the+following+fiendishly+clever+example&source=bl&ots=MH0vfJyw2V&sig=ZEzOR7sCXGyzcRbncbqlRQJdWaA&hl=en&sa=X&ved=0CB4Q6AEwAGoVChMIr9HmxOeFxwIVRlw-Ch3wjQ2K#v=onepage&q=Kahan%20constructed%20the%20following%20fiendishly%20clever%20example&f=false
There's a function e(x) = (exp(x) - 1)/x, defined to be 1 when x is 0. In
the unum definition of this function, the function checks whether x
*contains* zero when x is a ubound, and in this case, returns 1 exactly.
This incorrectly collapses bounds with a finite width down to an exact
answer.
If you look at the output of q(x) for the example points suggested in the
text, it is a bound of finite width, but the containment check in e(x)
collapses e(q(x)^2) down to an exact value, making unums look better than
they are.
To be clear, I interpret this as an honest mistake, but this is also one
of the high excitement points of the book (at least it was for me), so it's
important to be very careful about what's really going on here.
One other related point: if you use Julia's built in fused expm1, Julia
passes this test using regular old doubles

julia> e(x) = x == 0 ? one(x) : expm1(x)/x
e (generic function with 1 method)

julia> q(x) = abs(x-sqrt(x^2+1))-1/(x+sqrt(x^2+1))
q (generic function with 1 method)

julia> h(x) = e(q(x)^2)
h (generic function with 1 method)

julia> map(h, [15.0, 16.0, 17.0, 9999.0])
4-element Array{Float64,1}:
1.0
1.0
1.0
1.0
John Gustafson
2015-07-31 18:02:26 UTC
Permalink
Thanks for the detailed reading, Jason. If the input is a unum, then the
only way for it to contain zero is to be exactly zero. And that was the way
the example was used. If the input to the function is a ubound, then you
are correct that the test would need to be rewritten.
Post by Jason Merrill
Post by Jason Merrill
* "Wrath of Kahan, 2"
In the unum computation, squaring operations are fused with squareu, but
float Interval calculations are not fused. I also believe the check for the
ubounds containing zero in e[z] is erroneous in a way that makes this
example very deceiving, but I don't want to go into that detail here.
Since it looks like Dr. Gustafson is reading this thread, I wanted to give
my specific objection to this example. You should be able to read the
https://books.google.com/books?id=fZsXBgAAQBAJ&pg=PA176&lpg=PA176&dq=Kahan+constructed+the+following+fiendishly+clever+example&source=bl&ots=MH0vfJyw2V&sig=ZEzOR7sCXGyzcRbncbqlRQJdWaA&hl=en&sa=X&ved=0CB4Q6AEwAGoVChMIr9HmxOeFxwIVRlw-Ch3wjQ2K#v=onepage&q=Kahan%20constructed%20the%20following%20fiendishly%20clever%20example&f=false
There's a function e(x) = (exp(x) - 1)/x, defined to be 1 when x is 0. In
the unum definition of this function, the function checks whether x
*contains* zero when x is a ubound, and in this case, returns 1 exactly.
This incorrectly collapses bounds with a finite width down to an exact
answer.
If you look at the output of q(x) for the example points suggested in the
text, it is a bound of finite width, but the containment check in e(x)
collapses e(q(x)^2) down to an exact value, making unums look better than
they are.
To be clear, I interpret this as an honest mistake, but this is also one
of the high excitement points of the book (at least it was for me), so it's
important to be very careful about what's really going on here.
Jason Merrill
2015-07-31 18:42:18 UTC
Permalink
In the "Wrath of Kahan, 2" example, the input to e[z] might be intended to
be a unum, but in the actual examples used in the book, q[x] returns a
ubound, not a unum, so I stand by my analysis that the presentation is
incorrect in an important way.

As a plug for Julia, it should be a lot easier to track types more
explicitly in Julia than it is in Mathematica.

See the following calculation, using the published Mathematica prototype:

Loading Image...

<http://i.imgur.com/h4d5dlJ.png>
Post by John Gustafson
Thanks for the detailed reading, Jason. If the input is a unum, then the
only way for it to contain zero is to be exactly zero. And that was the way
the example was used. If the input to the function is a ubound, then you
are correct that the test would need to be rewritten.
Post by Jason Merrill
Post by Jason Merrill
* "Wrath of Kahan, 2"
In the unum computation, squaring operations are fused with squareu, but
float Interval calculations are not fused. I also believe the check for the
ubounds containing zero in e[z] is erroneous in a way that makes this
example very deceiving, but I don't want to go into that detail here.
Since it looks like Dr. Gustafson is reading this thread, I wanted to
give my specific objection to this example. You should be able to read the
https://books.google.com/books?id=fZsXBgAAQBAJ&pg=PA176&lpg=PA176&dq=Kahan+constructed+the+following+fiendishly+clever+example&source=bl&ots=MH0vfJyw2V&sig=ZEzOR7sCXGyzcRbncbqlRQJdWaA&hl=en&sa=X&ved=0CB4Q6AEwAGoVChMIr9HmxOeFxwIVRlw-Ch3wjQ2K#v=onepage&q=Kahan%20constructed%20the%20following%20fiendishly%20clever%20example&f=false
There's a function e(x) = (exp(x) - 1)/x, defined to be 1 when x is 0. In
the unum definition of this function, the function checks whether x
*contains* zero when x is a ubound, and in this case, returns 1 exactly.
This incorrectly collapses bounds with a finite width down to an exact
answer.
If you look at the output of q(x) for the example points suggested in the
text, it is a bound of finite width, but the containment check in e(x)
collapses e(q(x)^2) down to an exact value, making unums look better than
they are.
To be clear, I interpret this as an honest mistake, but this is also one
of the high excitement points of the book (at least it was for me), so it's
important to be very careful about what's really going on here.
John Gustafson
2015-07-31 19:10:39 UTC
Permalink
It is indeed possible to do a shortcut to something very similar to a unum
representation, and Ulrich Kulisch has suggested this: Every number is a
pair of 32-bit floats where the last bit of the fraction is the ubit. The
two floats represent the endpoints of an interval. So there is no
compression, but at least it is possible to represent connected sets of
real numbers with open or closed endpoints, and everything that works for
unums should work for this fixed-size interval representation. While it is
common to use double precision endpoints in interval arithmetic to try to
keep the bounds from blowing up, I think the seven-decimal accuracy of
32-bit should be adequate for a wide range of problems if combined with the
ubox method. I hope to start work on this within a month, in collaboration
with Ulrich.
Post by Jason Merrill
Post by Job van der Zwan
Post by Steven G. Johnson
The problem is that if you interpret an exact unum as the open interval
between two adjacent exact values, what you have is essentially the same as
interval arithmetic. The result of each operation will produce intervals
that are broader and broader (necessitating lower and lower precision
unums), with the well known problem that the interval quickly becomes
absurdly pessimistic in real problems (i.e. you quickly and prematurely
discard all of your precision in a variable-precision format like unums).
The real problem with interval arithmetic is not open vs. closed
intervals, it is this growth of the error bounds in realistic computations
(due to the dependency problem and similar). (The focus on infinite and
semi-infinite open intervals is a sideshow. If you want useful error
bounds, the important things are the *small* intervals.)
If you discard the interval interpretation with its rapid loss of
precision, what you are left with is an inexact flag per value, but with no
useful error bounds. And I don't believe that this is much more useful than
a single inexact flag for a set of computations as in IEEE.
The thing is, these are *exactly *the criticisms Gustafson has of
traditional interval arithmetic. In fact, he's even more critical of
interval arithmetic than he is of floats, as far as I can see. However, he
claims that ubounds don't share the "absurd pessimism" problem. Supposedly,
traditional interval arithmetic by necessity needs to be more pessimistic
about its boundaries due to rounding, and only using closed endpoint
instead of allowing for open intervals. Unums instead are (supposedly) more
precise about the information loss they have, and thus (supposedly) don't
blow up as badly. Again, his claims, not mine. I'm not saying you're wrong,
or even sure if you disagree as much as you might think you are (although
I'm pretty sure you wouldn't like the tone he uses when describing
traditional methods though).
I agree with the others about the grain of salt (unums/ubounds/uboxes *always
*come out on top in his examples, which does make you wonder), but on
the other hand: given that the mathematica implementation of his methods
are open source, his claims *should* be verifiable (they can be found here
under Downloads/Updates
<https://www.google.com/url?q=https%3A%2F%2Fwww.crcpress.com%2FThe-End-of-Error-Unum-Computing%2FGustafson%2F9781482239867&sa=D&sntz=1&usg=AFQjCNG9ezAr5A_BTmpUT6WdVBIYDvaIhA>,
Simon Byrne linked it earlier. I also found a Python port
<https://github.com/jrmuizel/pyunum>).
If you inspect the specific examples of challenge problems that Gustafson
gives in Chapter 14 of his book, the open vs. closed interval distinction
doesn't actually make an important appearance. The main ways that ubounds
do better than Mathematica's Intervals are
1. Fused operations allow getting around specific cases of the dependency
problem. E.g. using squareu[x] instead of x*x allows putting 0 as a lower
bound of the result, and fdotu allows avoiding cancelation in dot products
(and as a special case, sums and differences).
2. Sometimes the unums are allowed to have more bits in their mantissa
than the bounds of the float Intervals.
3. The ubounds often use fewer bits in their representation (averaged over
a whole calculation) than Interval alternatives.
Only the first two are relevant to correctness/precision. Number 3 is a
performance issue that I don't want to discuss.
Looking at the specific examples,
* "Wrath of Kahan, 1"
Intervals eventually blow up to [-Inf, Inf]. Ubounds also diverge (from
the text, "If you keep going, the left endpoint falls below 6, and then
diverges towards -Inf, but remember that a unum environment can
automatically detect when relative width gets to high..."). They diverge
slightly more slowly in this case because he has allowed 2^6=64 bits in the
mantissa of the ubounds endpoints, whereas the double Interval bounds have
only 52 bits in their mantissa.
* "Wrath of Kahan, 2"
In the unum computation, squaring operations are fused with squareu, but
float Interval calculations are not fused. I also believe the check for the
ubounds containing zero in e[z] is erroneous in a way that makes this
example very deceiving, but I don't want to go into that detail here.
* "Rump's royal pain"
Uses fused powu and squareu operations, and allows up to 2^7=128 bits in
the mantissa for ubounds, whereas double intervals are computed without
fused operations and only allow 52 bits in their mantissa. The fused
operations are critical here.
* "Quadratic formula"
Main advantage comes from using fused squareu operations, and allowing
more bits in the mantissa of the unums than in the mantissa of the single
precision floats. No comparison to float Intervals here.
* "Bailey's numerical nightmare"
Unum Computation is first scaled, and then done almost entirely using
fused dot products, which makes this into an integer computation until the
final division in the case of unums. The float Interval computation wasn't
ever scaled, and the float computation was scaled, but used no fused
operations.
* "Fast Fourier Transforms"
I haven't read this example very closely so no comment.
My conclusion is that in all of these specific test cases, Intervals with
float endpoints could get answers that are just as precise/accurate, if
they used the same fused operations, and if their mantissa size was as
large as the maximum mantissa size allowed for the unums. Even so, this is
a useful observation. Environments that provide Intervals should provide a
useful set of fused operations over them to reduce the dependency problem
in a usefully large set of cases. If open vs. closed endpoints are
important, those could easily be added to any type of Interval
representation at the cost of 2 extra bits per interval.
The performance claims might eventually be legitimate (with new hardware),
but I can't personally evaluate them.
John Gustafson
2015-07-31 18:19:56 UTC
Permalink
Be careful. I, too, hoped that it would be sufficient to change the last
fraction bit to a ubit. But the relative error changes with every
calculation, so you *have* to let the fraction length float and be another
annotation field. And for more subtle reasons, you need to be able to vary
the exponent size, also. So it is the three added fields in combination
that make unum math work. Remove any one of them, and you'll be where I've
been for the last 30 years: exasperated with alternatives to floats that
still don't work mathematically.
Post by Job van der Zwan
Post by Steven G. Johnson
Job, I'm basing my judgement on the presentation.
Ah ok, I was wondering I feel like those presentations give a general
impression, but don't really explain the details enough. And like I said,
your critique overlaps with Gustafson's own critique of traditional
interval arithmetic, so I wasn't sure if you meant that you don't buy his
suggested alternative ubox method after reading the book, or indicated
scepticism based on earlier experience, but without full knowledge of what
his suggested alternative is.
To be clear, it wasn't a "you should read the book" putdown - I hate
comments like that, they destroy every meaningful discussion.
The more I think about it, the more I think the ubit is actually the big
breakthrough. As a thought experiment, let's ignore the whole
flexible-bitsize bit and just take an existing float, but replace the last
bit of the fraction with a ubit. What happens?
Well.. we give up one bit of *precision* in the fraction, but *our set of
representations is still the same size*. We still have the same number of
floats as before! It's just that half of them is now exact (with one bit
less precision), and the other half represents open intervals between these
exact numbers. Which lets you represent the entire real number line
accurately (but with limited precision, unless they happen to be equal to
an exact float).
Compare that to traditional floating point numbers, which are all exact,
but unless your calculation is exactly that floating point representation
(which is very rare) guaranteed to be off.
Think about it this way: regular floats represent a finite subset of
rational numbers. More bits increase that finite subset. But add a ubit,
and you got the entire real number line. With limited precision, and using
the same finite number of representations as a float that has the same
number of bits, but still.
I'd like to hear some feedback on the example I used earlier from people
ubound arithmetic tells you that 1 / (0, 1] = [1, inf), and that [1, inf)
Post by Steven G. Johnson
/ inf = 0
Thanks to the ubit, the arithmetic is as simple as "divide by both
endpoints to get the new interval endpoints". It's so simple that I have a
hard time believing this was not possible with interval arithmetic before,
and again I don't know that much about the topic.
So is it really true, like Gustafson claims, that interval arithmetic so
far always used *closed* intervals that accepted *rounded* answers?
Because if that is true, and even is that is the only thing unums solve...
well then I'm sold :P
John Gustafson
2015-07-31 18:13:38 UTC
Permalink
Many people are judging the merits of unum arithmetic based on an hour-long
PowerPoint presentation. I really wish they wouldn't do that. There's no
way that can get all the key concepts across in anything less than a
400-page book that anticipates the questions and criticisms and answers
them. I was hoping the e-book would be priced at around $5, but apparently
technical ebooks are almost as expensive as paper ones. So I will do the
next best thing and try to answer questions and objections in this forum.
Post by Steven G. Johnson
Job, I'm basing my judgement on the presentation.
John Gustafson
2015-07-31 17:49:19 UTC
Permalink
Here is how you can represent the square root of 2 with a finite number of
symbols: "1.414
"

The "
" means "There are more decimals after the last one shown, not all
zeros and not all nines." If the trailing digits were all zeros, we would
instead write "1.414" and it would be exact. If the trailing digits were
all nines, we would write "1.415" and again it would be exact. "1.414
" is
shorthand for the open interval (1.414, 1.415), which is not something you
can express with traditional interval arithmetic since all the intervals
are closed.

This is how the ubit part of a unum works. It is appended to the fraction
bit string, and if it is 1, then there is a "
" to show it is between two
floats. If it is 0, then the fraction is exact. This allows you to "tile"
the real number line with no redundancy; every real number is represented
by exactly one unum, and there is no rounding. There is simply admission of
inexactness, which becomes part of the number's self-description.

Most of the woes of numerical analysis come from the belief that you have
to replace every result with an exact number, even if it is incorrect. We
call it "rounding," but it might better be termed "guessing." It is a form
of error. The unum representation makes computing with real values as
mathematically correct as computing with integers. Even if you dial the
accuracy way, way down, to like a single-bit exponent and a single-bit
fraction (this is possible!) the unums will not lie to you about a real
value. They are simply less accurate, which is far preferable to being very
precise but
 wrong.
Post by Tom Breloff
Correct me if I'm wrong, but (fixed-size) decimal floating-point has most
of the same issues as floating point in terms of accumulation of errors,
right?
What "issues" are you referring to? There are a lot of crazy myths out
there about floating-point arithmetic.
For any operation that you could perform exactly in fixed-point arithmetic
with a given number of bits, the same operation will also be performed
exactly in decimal floating-point with the same number of bits for the
signficand. However, for the same total width (e.g. 64 bits), decimal
floating point sacrifices a few bits of precision in exchange for dynamical
scaling (i.e. the exponent), which gives exact representations for a vastly
expanded dynamic range.
Furthermore, for operations that *do* involve roundoff error in either
fixed- or decimal floating-point arithmetic with a fixed number of bits,
the error accumulation is usually vastly better in floating point than
fixed-point. (e.g. there is no equivalent of pairwise summation, with
logarithmic error growth, in fixed-point arithmetic.)
If you want no roundoff errors, ever, then you have no choice but to use
some kind of (slow) arbitrary-precision type, and even then there are
plenty of operations you can't allow (e.g. division, unless you are willing
to use arbitrary-precision rationals with exponential complexity) or square
roots.
Tom Breloff
2015-07-31 18:06:10 UTC
Permalink
The wiki should be active now.

John: welcome to the thread! I hope you'll find the time to review the
implementation I'm designing as well as contribute to the wiki.
Post by John Gustafson
Here is how you can represent the square root of 2 with a finite number of
symbols: "1.414
"
The "
" means "There are more decimals after the last one shown, not all
zeros and not all nines." If the trailing digits were all zeros, we would
instead write "1.414" and it would be exact. If the trailing digits were
all nines, we would write "1.415" and again it would be exact. "1.414
" is
shorthand for the open interval (1.414, 1.415), which is not something you
can express with traditional interval arithmetic since all the intervals
are closed.
This is how the ubit part of a unum works. It is appended to the fraction
bit string, and if it is 1, then there is a "
" to show it is between two
floats. If it is 0, then the fraction is exact. This allows you to "tile"
the real number line with no redundancy; every real number is represented
by exactly one unum, and there is no rounding. There is simply admission of
inexactness, which becomes part of the number's self-description.
Most of the woes of numerical analysis come from the belief that you have
to replace every result with an exact number, even if it is incorrect. We
call it "rounding," but it might better be termed "guessing." It is a form
of error. The unum representation makes computing with real values as
mathematically correct as computing with integers. Even if you dial the
accuracy way, way down, to like a single-bit exponent and a single-bit
fraction (this is possible!) the unums will not lie to you about a real
value. They are simply less accurate, which is far preferable to being very
precise but
 wrong.
Post by Tom Breloff
Correct me if I'm wrong, but (fixed-size) decimal floating-point has
most of the same issues as floating point in terms of accumulation of
errors, right?
What "issues" are you referring to? There are a lot of crazy myths out
there about floating-point arithmetic.
For any operation that you could perform exactly in fixed-point
arithmetic with a given number of bits, the same operation will also be
performed exactly in decimal floating-point with the same number of bits
for the signficand. However, for the same total width (e.g. 64 bits),
decimal floating point sacrifices a few bits of precision in exchange for
dynamical scaling (i.e. the exponent), which gives exact representations
for a vastly expanded dynamic range.
Furthermore, for operations that *do* involve roundoff error in either
fixed- or decimal floating-point arithmetic with a fixed number of bits,
the error accumulation is usually vastly better in floating point than
fixed-point. (e.g. there is no equivalent of pairwise summation, with
logarithmic error growth, in fixed-point arithmetic.)
If you want no roundoff errors, ever, then you have no choice but to use
some kind of (slow) arbitrary-precision type, and even then there are
plenty of operations you can't allow (e.g. division, unless you are willing
to use arbitrary-precision rationals with exponential complexity) or square
roots.
John Gustafson
2015-07-31 19:52:45 UTC
Permalink
Tom, I very much hope to soon be spending full time on unums. I have been
offered an appointment at A*STAR to come to Singapore for a year and
develop unum arithmetic. So absolutely I hope to help with the Julia
implementation once I've made that move! It was supposed to start next
month; just waiting for approval from their Ministry of Manpower.
Post by Tom Breloff
The wiki should be active now.
John: welcome to the thread! I hope you'll find the time to review the
implementation I'm designing as well as contribute to the wiki.
Post by John Gustafson
Here is how you can represent the square root of 2 with a finite number
of symbols: "1.414
"
The "
" means "There are more decimals after the last one shown, not all
zeros and not all nines." If the trailing digits were all zeros, we would
instead write "1.414" and it would be exact. If the trailing digits were
all nines, we would write "1.415" and again it would be exact. "1.414
" is
shorthand for the open interval (1.414, 1.415), which is not something you
can express with traditional interval arithmetic since all the intervals
are closed.
This is how the ubit part of a unum works. It is appended to the fraction
bit string, and if it is 1, then there is a "
" to show it is between two
floats. If it is 0, then the fraction is exact. This allows you to "tile"
the real number line with no redundancy; every real number is represented
by exactly one unum, and there is no rounding. There is simply admission of
inexactness, which becomes part of the number's self-description.
Most of the woes of numerical analysis come from the belief that you have
to replace every result with an exact number, even if it is incorrect. We
call it "rounding," but it might better be termed "guessing." It is a form
of error. The unum representation makes computing with real values as
mathematically correct as computing with integers. Even if you dial the
accuracy way, way down, to like a single-bit exponent and a single-bit
fraction (this is possible!) the unums will not lie to you about a real
value. They are simply less accurate, which is far preferable to being very
precise but
 wrong.
Post by Tom Breloff
Correct me if I'm wrong, but (fixed-size) decimal floating-point has
most of the same issues as floating point in terms of accumulation of
errors, right?
What "issues" are you referring to? There are a lot of crazy myths out
there about floating-point arithmetic.
For any operation that you could perform exactly in fixed-point
arithmetic with a given number of bits, the same operation will also be
performed exactly in decimal floating-point with the same number of bits
for the signficand. However, for the same total width (e.g. 64 bits),
decimal floating point sacrifices a few bits of precision in exchange for
dynamical scaling (i.e. the exponent), which gives exact representations
for a vastly expanded dynamic range.
Furthermore, for operations that *do* involve roundoff error in either
fixed- or decimal floating-point arithmetic with a fixed number of bits,
the error accumulation is usually vastly better in floating point than
fixed-point. (e.g. there is no equivalent of pairwise summation, with
logarithmic error growth, in fixed-point arithmetic.)
If you want no roundoff errors, ever, then you have no choice but to use
some kind of (slow) arbitrary-precision type, and even then there are
plenty of operations you can't allow (e.g. division, unless you are willing
to use arbitrary-precision rationals with exponential complexity) or square
roots.
John Gustafson
2015-07-31 16:25:44 UTC
Permalink
There is no question that getting rigorous, tight bounds is going to cost
something compared to the guesswork of conventional floating point.
Interval arithmetic has failed for the last fifty years because it requires
a LOT of work and expertise to keep the bounds from exploding; the ubox
method requires no expertise but puts the burden on the computer. And it's
a massively parallel burden, providing something to do with all those cores
we never seem to be able to fully utilize. And if you don't like the ubox
approach, unums can perfectly emulate existing floating point, so every
algorithm that works for floats also works for unums.

I made considerable effort not to "cherry pick" examples because I've seen
far too much of that in papers about computation. So I used problems from
others, not of my own invention, and the classic problems of numerical
methods texts: polynomial evaluation, systems of linear equations, ordinary
and partial differential equations, Fast Fourier Transforms, etc.
Post by Job van der Zwan
Post by Steven G. Johnson
Regarding, unums, without hardware support, at first glance they don't
sound practical compared to the present alternatives (hardware or software
fixed-precision float types, or arbitrary precision if you need it). And
the "ubox" method for error analysis, even if it overcomes the problems of
interval arithmetic as claimed, sounds too expensive to use on anything
except for the smallest-scale problems because of the large number of boxes
that you seem to need for each value whose error is being tracked.
Well, I don't know enough about traditional methods to say if they're
really as limited as Gustafson claims in his book, or if he's just
cherry-picking. Same about the cost of using uboxe
However, ubound arithmetic tells you that 1 / (0, 1] = [1, inf), and that
[1, inf) / inf = 0. The ubounds describing those interval results are
effectively just a pair of floating point numbers, plus a ubit to signal
whether an endpoint is open or not. That's a very simple thing to
implement. Not sure if there's any arbitrary precision method that deal
with this so elegantly - you probably know better than I do.
Scott Jones
2015-07-29 14:26:18 UTC
Permalink
I still having figured out how this would tie in with decimal floating
point, but I really do like a few key things:

1. single type for all sizes of integers and floating point values
(which I already have, except with decimal values)
2. being able to represent both - and + underflow, unlike the IEEE
standard
3. being able to distinguish between +/- overflow, and real +/- Infinite
values (and knowing what overflowed #s are bounded by a particular X and
infinity)
4. being able to distinguish between exact numbers and inexact numbers
5. variable sized scale (in my own format, I have 0, 1, or 2 bytes, but
this is maybe more flexible)
6. compactness of representation (I already have that also, in my own
packing format)

So, while I already have 1,5,6, this adds 2,3,4 for me.
Post by Steven G. Johnson
For example, I have a specialized solution to represent financial prices
which have a fixed accuracy, but I want to be able to do floating point
arithmetic on them.
Why not use decimal floating-point for that?
Regarding, unums, without hardware support, at first glance they don't
sound practical compared to the present alternatives (hardware or software
fixed-precision float types, or arbitrary precision if you need it). And
the "ubox" method for error analysis, even if it overcomes the problems of
interval arithmetic as claimed, sounds too expensive to use on anything
except for the smallest-scale problems because of the large number of boxes
that you seem to need for each value whose error is being tracked.
John Gustafson
2015-07-31 16:16:07 UTC
Permalink
What IEEE 754 did with "negative zero" is a half-baked attempt to represent
inexactness. Consider, for example, that the square root of negative zero
is defined to be negative zero. Unums have the same representation of zero
as floats in that the sign bit can be 0 or 1, but the sign bit is ignored
for *exact* zero. If zero is inexact, which is explicitly indicated using
the inexact bit (one of the three added bit fields in a unum), then the
sign bit indicates which of (–ULP, 0) or (0, ULP) is represented, and the
size of the ULP is determined by the fraction and exponent sizes.

Unums can be made fixed size to allow easy array indexing. These are
classic data management problems and not hard to deal with, much like
having to manage records in mass storage. There is a whole chapter of the
book dedicated to this topic. I understand how people are spooked by
variable-size representation, but there was a time that it was unthinkable
to have variable-width characters in computer-displayed text. We'll get
over it.
This seems interesting, I'd like to know what David Sanders (
https://github.com/dpsanders) thinks of the math (I missed his talk at
JuliaCon, I'm waiting for the video, but the description made it sound
relevant).
There also doesn't seem to be any representation of -0.0, which from what
I've read, is important to represent negative underflows.
(however, I really don't understand why there isn't a corresponding value
for positive underflows in the IEEE formats, in addition to an exact 0)
Why it is displayed as -0.0, instead of something like -Und, 0, and Und,
similarly to -Inf and Inf, I just don't get.
(If any mathematicians would please explain that to me, I'd appreciate it!)
I also wonder how well this would work for all the array based math used
in Julia, where you'd really like all the values to have a fixed size
for fast indexing.
I can think of some ways, using an extra bit to say that the real value is
not in place, but rather in an overflow vector, and then have those
allocated with a big enough size to handle larger precision, I'm not sure
how that would perform though, it would depend a lot on how many values had
to be promoted to a larger size.
Finally, I'd wonder, in the absence of hardware that could directly handle
UNUMs, if this would really be any better than the packing I've been doing
for decades (to save space in a database and in in-memory structures, where
things are read much more than written or modified).
(in my old format, I used length/type bytes (which could be 1 or 2 bytes
normally, or more, to handle up to 8-byte lengths), followed by packed
data, for example, non-negative integers were represented by 0-n bytes
after the type/length info), negative integers represented by 0-n without
any trailing 0xFF bytes, scaled decimals had a 1 or 2 byte signed scale,
followed by 0-n bytes (same separation of negative/non-negative for ease of
packing/unpacking). The format also handles Null, packed strings (binary,
8-bit text, and Unicode), and binary floating point values
(also packed, first using float format instead of double, if (float)x ==
x, and then eliminating LSBs of 0, which makes a 0 not take any extra
bytes, and many small values just take 1 or 2 extra bytes).
-Scott
Post by Job van der Zwan
Post by Simon Byrne
https://news.ycombinator.com/item?id=9943589
Oh, hadn't seen that. The linked presentation is also more recent! I
found the "slidecast" version of it, where he presents the slides in
podcast form. http://youtu.be/jN9L7TpMxeA He's
evangelizing a bit, but, well... I guess that makes sense given the topic.
I'd be keen to know more but he hasn't really published any details other
Post by Simon Byrne
than his book
<http://www.amazon.com/The-End-Error-Computing-Computational/dp/1482239868>. Based
on the free preview, it looks like a bit of a diatribe rather than a
detailed technical proposal, but you can look at his mathematica code here
<https://www.google.com/url?q=https%3A%2F%2Fwww.crcpress.com%2FThe-End-of-Error-Unum-Computing%2FGustafson%2F9781482239867&sa=D&sntz=1&usg=AFQjCNG9ezAr5A_BTmpUT6WdVBIYDvaIhA>
.
Well, if you decide to go against something as well-established as the
way we've been doing integer and floating point arithmetic, you're probably
going to need a lot of explanation in a very accessible style - because you
definitely won't have the experts on your side.
Zenna Tavares
2015-07-29 20:59:02 UTC
Permalink
I read the book (well, somewhere between a skim and a proper read). It's
not formal but it is clear and the ideas are concise.
I actually think it's a pretty good example of how to explain an idea
without unnecessary jargon.

As for unums themselves, I am mostly convinced of his arguments on unums.
I am less convinced on ubounds.

My main takeaways are that a unum may represent a set of values, and it's
most salient properties are:

- Explicit (via ubit) handling of exact and inexact (i.e. set of) real
number
- Correct handling of open/closed bounds for sets of reals
- Variable size with size of number stored in number
- With hardware they could be as or more efficient in energy and speed as
floating arithmetic but hardware would be more complex

As a result of these properties, unums can be closed under arithmetic
operations and won't hide your errors due to approximation.

I don't buy the advantages he suggests over interval arithmetic; unums
don't solve the dependency problem.

I have been meaning to start a Unum.jl package myself.

Zenna
Post by Job van der Zwan
So I came across the concept of UNUMs on the Pony language mailing list
<http://lists.ponylang.org/pipermail/ponydev/2015-July/000071.html> this
morning. I hadn't heard of them before, and a quick search doesn't show up
anything on this mailing list, so I guess most people here haven't either.
They're a proposed alternate encoding for numbers by John L. Gustafson.
http://sites.ieee.org/scv-cs/files/2013/03/Right-SizingPrecision1.pdf
“Unums”(universal numbers) are to floating point what floating point is to
fixed point.
Floating-point values self-describe their scale factor, but fix the
exponent and fraction size. Unums self-describe the exponent size, fraction
size, and inexact state, and include fixed point and IEEE floats as special
cases.
http://sites.ieee.org/scv-cs/archives/right-sizing-precision-to-save-energy-power-and-storage
Now, I don't know enough about this topic to say if they're a good or bad
idea, but I figured the idea is interesting/relevant enough to share with
the Julia crowd.
I'm also wondering if they could be implemented (relatively) easily within
Julia, given its flexible type system. If so, they might provide an
interesting advanced example, no?
Steven G. Johnson
2015-07-29 21:07:45 UTC
Permalink
Post by Zenna Tavares
I read the book (well, somewhere between a skim and a proper read). It's
not formal but it is clear and the ideas are concise.
I actually think it's a pretty good example of how to explain an idea
without unnecessary jargon.
As for unums themselves, I am mostly convinced of his arguments on unums.
I am less convinced on ubounds.
My main takeaways are that a unum may represent a set of values, and it's
- Explicit (via ubit) handling of exact and inexact (i.e. set of) real
number
- Correct handling of open/closed bounds for sets of reals
- Variable size with size of number stored in number
- With hardware they could be as or more efficient in energy and speed as
floating arithmetic but hardware would be more complex
As a result of these properties, unums can be closed under arithmetic
operations and won't hide your errors due to approximation.
I don't buy the advantages he suggests over interval arithmetic; unums
don't solve the dependency problem.
Without hardware, the advantages of variable size (< Float64) are
overwhelmed by the software overhead. Without solving the dependency
problem, representing a set of reals (as opposed to an individual real as
in standard FP) is useless for error estimation. And I don't see a clear
practical use-case for an inexact bit per value, as opposed to a single
inexact flag for a whole set of computations (as in IEEE).
Simon Byrne
2015-07-30 13:18:28 UTC
Permalink
And I don't see a clear practical use-case for an inexact bit per value,
as opposed to a single inexact flag for a whole set of computations (as in
IEEE).
Probably not quite what others had in mind, but an instruction-specific
inexact flag (and rounding mode) would make it possible to implement
round-to-odd fairly neatly (e.g., see here
<http://www.exploringbinary.com/gcc-avoids-double-rounding-errors-with-round-to-odd/>),
which would in turn allow implementing all the "formatOf" operations in the
IEE754-2008 standard.
Tom Breloff
2015-07-30 13:47:15 UTC
Permalink
Simon: if I understand what you're suggesting, you'd like to add a
"rounding direction" flag whenever the ubit is set that would indicate
which direction you *would* round if you wanted to? I like this idea, as
it allows you to throw away the implicit open interval in favor of a
rounded exact value (if that's what you want). You potentially get the
best of both worlds, but with the speed/memory penalty of setting that
extra bit? I can't really comment yet on how much processing this would
add...
Post by Simon Byrne
And I don't see a clear practical use-case for an inexact bit per value,
as opposed to a single inexact flag for a whole set of computations (as in
IEEE).
Probably not quite what others had in mind, but an instruction-specific
inexact flag (and rounding mode) would make it possible to implement
round-to-odd fairly neatly (e.g., see here
<http://www.exploringbinary.com/gcc-avoids-double-rounding-errors-with-round-to-odd/>),
which would in turn allow implementing all the "formatOf" operations in the
IEE754-2008 standard.
Simon Byrne
2015-07-30 13:57:42 UTC
Permalink
My comment was only relating to ordinary floating point, I still don't
really understand unums.
Post by Tom Breloff
Simon: if I understand what you're suggesting, you'd like to add a
"rounding direction" flag whenever the ubit is set that would indicate
which direction you *would* round if you wanted to? I like this idea, as
it allows you to throw away the implicit open interval in favor of a
rounded exact value (if that's what you want). You potentially get the
best of both worlds, but with the speed/memory penalty of setting that
extra bit? I can't really comment yet on how much processing this would
add...
Post by Simon Byrne
And I don't see a clear practical use-case for an inexact bit per value,
as opposed to a single inexact flag for a whole set of computations (as in
IEEE).
Probably not quite what others had in mind, but an instruction-specific
inexact flag (and rounding mode) would make it possible to implement
round-to-odd fairly neatly (e.g., see here
<http://www.exploringbinary.com/gcc-avoids-double-rounding-errors-with-round-to-odd/>),
which would in turn allow implementing all the "formatOf" operations in the
IEE754-2008 standard.
John Gustafson
2015-07-31 18:37:04 UTC
Permalink
The chapter "Permission to Guess" explains how to "round" unums. The
"guess" function replaces an inexact unum with an exact one, either the one
closest to the midpoint if there is at least one more bit of fraction
precision available, or one of the endpoints if the ULP size is already as
small as it can be in a given environment. The latter case is rounding, and
can be round-toward-zero, round-toward-toward-infinity,
round-toward-negative-infinity, round-to-nearest-even,
round-to-nearest-odd, or whatever policy you want to establish. That policy
can be set with an environment flag, and it probably should default to
round-to-nearest-even to best imitate typical use of IEEE 754 floats.
Post by Tom Breloff
Simon: if I understand what you're suggesting, you'd like to add a
"rounding direction" flag whenever the ubit is set that would indicate
which direction you *would* round if you wanted to? I like this idea, as
it allows you to throw away the implicit open interval in favor of a
rounded exact value (if that's what you want). You potentially get the
best of both worlds, but with the speed/memory penalty of setting that
extra bit? I can't really comment yet on how much processing this would
add...
Post by Simon Byrne
And I don't see a clear practical use-case for an inexact bit per value,
as opposed to a single inexact flag for a whole set of computations (as in
IEEE).
Probably not quite what others had in mind, but an instruction-specific
inexact flag (and rounding mode) would make it possible to implement
round-to-odd fairly neatly (e.g., see here
<http://www.exploringbinary.com/gcc-avoids-double-rounding-errors-with-round-to-odd/>),
which would in turn allow implementing all the "formatOf" operations in the
IEE754-2008 standard.
Stefan Karpinski
2015-07-29 21:30:28 UTC
Permalink
Post by Zenna Tavares
As a result of these properties, unums can be closed under arithmetic
operations and won't hide your errors due to approximation.
I'm glad to hear this because this was that part that made me question the
whole thing. I guess the fact that you can represent some numbers exactly
helps a bit, but not very much.

The most compelling part of the proposal to me was the claim of
associativity, which I suppose comes along with the variable precision
since you can actually drop trailing bits that you can't get right.
Jason Merrill
2015-07-30 17:07:01 UTC
Permalink
Post by Stefan Karpinski
The most compelling part of the proposal to me was the claim of
associativity, which I suppose comes along with the variable precision
since you can actually drop trailing bits that you can't get right.
I bought a copy of the book, because I'm a sucker for this kind of thing.
There's a lot of fascinating material in the book, and I would generally
recommend it, with the caveat that it seems like some of it needs to be
taken with a grain of salt. Remember that it's a manuscript that hasn't
gone through the kind of peer review that journal articles do.

Associativity sounded pretty exciting to me, too, but you have to do
special work to get it. If a, b, and c are unums or ubounds, it is *not*
the case that you will always have (a+b)+c=a+(b+c), if you write the
calculation that way. Like other kinds of interval arithmetic, ubounds obey
sub-associativity, which says that the two sides of that equation are "not
nowhere equal", and that their intersection contains the exact answer.

The way you get associativity is by using a fused sum operation that
internally accumulates sums with enough precision to restore associativity
of the rounded end results. Here's a page from the book:

https://books.google.com/books?id=fZsXBgAAQBAJ&pg=PA164&lpg=PA164&dq=subassociative+interval+arithmetic&source=bl&ots=MH0veKCw9Y&sig=sq9atiYn46w2rvuT26E3fLbUnOg&hl=en&sa=X&ved=0CDYQ6AEwA2oVChMIi7Dyt6eDxwIVA24-Ch3gjg-7#v=onepage&q=subassociative%20interval%20arithmetic&f=false

Gustafson's whole proposal involves standardizing several layers of
computation, including what happens in a higher precision scratchpad that
is imagined to be in hardware and fenced off from the user. IEEE floating
point arithmetic also works with a higher precision scratchpad, but exactly
what happens there is a little bit under constrained, and has varied
between different processors. Standardizing the scratchpad, and which fused
operations will keep their operands there, seems to be an important part of
the proposal.

I'm pretty interested in more discussion of the book, but this mailing list
probably isn't the right place for a wide ranging discussion to happen.
Does anyone have any advice about other appropriate forums?
John Gustafson
2015-07-31 18:53:13 UTC
Permalink
Actually, Jason, the book went through intense peer review repeatedly for
over a year before it hit the shelves. Horst Simon, the series editor,
vetted the manuscript and made sure William Kahan saw it as well. Kahan,
the guy behind the IEEE 754 Standard for floats and a Turing Award
recipient, was surprisingly unable to punch holes in it the way he has
always torn down proposed alternatives to existing floats. David Bailey and
John Runnels were two of the formal referees, and another referee preferred
to remain anonymous. If you look at the Acknowledgments section in the
prefatory material, you can see a list of all the people who pored over the
material and made sure it was sound. No one has found any *conceptual* errors
yet, though there are some minor Errata and they are posted on the CRC
Press site for the book. There was also one minor typo in a subscript in
the Mathematica notebook, now corrected, but other than that no one has
found any bugs in it. Jack Dongarra, Gordon Bell, and Ulrich Kulisch
(interval arithmetic expert and inventor of the exact dot product
accumulator) also gave it a thumbs-up.

I knew I was going out on a limb with this idea, so I sought out the
harshest critics I could find and made sure it could pass their tests
before going to press.

That said, I agree with the "grain of salt" comment, because the
Mathematica notebook is too slow to try unum math out on *really* large
problems. It may turn out that the ubox method becomes intractable even
though the number of uboxes expands linearly instead of exponentially, and
that will mean using unums as float-imitators to get things to run. What we
need now is a much faster implementation. Which is exactly why putting
unums in Julia is such a great idea!
Post by Jason Merrill
Post by Stefan Karpinski
The most compelling part of the proposal to me was the claim of
associativity, which I suppose comes along with the variable precision
since you can actually drop trailing bits that you can't get right.
I bought a copy of the book, because I'm a sucker for this kind of thing.
There's a lot of fascinating material in the book, and I would generally
recommend it, with the caveat that it seems like some of it needs to be
taken with a grain of salt. Remember that it's a manuscript that hasn't
gone through the kind of peer review that journal articles do.
Associativity sounded pretty exciting to me, too, but you have to do
special work to get it. If a, b, and c are unums or ubounds, it is *not*
the case that you will always have (a+b)+c=a+(b+c), if you write the
calculation that way. Like other kinds of interval arithmetic, ubounds obey
sub-associativity, which says that the two sides of that equation are "not
nowhere equal", and that their intersection contains the exact answer.
The way you get associativity is by using a fused sum operation that
internally accumulates sums with enough precision to restore associativity
https://books.google.com/books?id=fZsXBgAAQBAJ&pg=PA164&lpg=PA164&dq=subassociative+interval+arithmetic&source=bl&ots=MH0veKCw9Y&sig=sq9atiYn46w2rvuT26E3fLbUnOg&hl=en&sa=X&ved=0CDYQ6AEwA2oVChMIi7Dyt6eDxwIVA24-Ch3gjg-7#v=onepage&q=subassociative%20interval%20arithmetic&f=false
Gustafson's whole proposal involves standardizing several layers of
computation, including what happens in a higher precision scratchpad that
is imagined to be in hardware and fenced off from the user. IEEE floating
point arithmetic also works with a higher precision scratchpad, but exactly
what happens there is a little bit under constrained, and has varied
between different processors. Standardizing the scratchpad, and which fused
operations will keep their operands there, seems to be an important part of
the proposal.
I'm pretty interested in more discussion of the book, but this mailing
list probably isn't the right place for a wide ranging discussion to
happen. Does anyone have any advice about other appropriate forums?
Job van der Zwan
2015-07-31 23:27:47 UTC
Permalink
Speaking of going out on a limb: are you aware of Mark Kikgard's work on GPU accelerated path rendering?

http://www.slideshare.net/mobile/Mark_Kilgard/gtc-2014-nvidia-path-rendering

There is obvious *thematic* overlap, with the promise of faster, more accurate 2D graphics using LESS power. Rendering without artefacts at optimal speed for a given resolution also sounds an awful lot like "efficiently find the most accurate solution for a given precision"

The going out on a limb part is the thought that just maybe the "stencil, then cover" approach has some complementary technical overlap with the ubox approach as well? Might be worth checking out. A technical paper on the subject can be found here:

https://developer.nvidia.com/gpu-accelerated-path-rendering

(Frustratingly the work involves a lot of software patents http://patents.justia.com/inventor/mark-j-kilgard )
John Gustafson
2015-07-31 18:09:50 UTC
Permalink
Zenna,

If unums are used without the ubox method and some of the other techniques
described in the book (like tightest-possible evaluation in the *g*-layer
for a well-defined set of functions), they will indeed fall prey to two of
the main problems of interval arithmetic: the dependency problem and the
wrapping problem. That is why it is essential to use the ubox method, and
not blindly replace all the floats in a calculation with unums and expect
magical things to happen. Unlike interval arithmetic, though, the ubox
method requires no expertise. It's a brainless, brute force approach.
Post by Zenna Tavares
I read the book (well, somewhere between a skim and a proper read). It's
not formal but it is clear and the ideas are concise.
I actually think it's a pretty good example of how to explain an idea
without unnecessary jargon.
As for unums themselves, I am mostly convinced of his arguments on unums.
I am less convinced on ubounds.
My main takeaways are that a unum may represent a set of values, and it's
- Explicit (via ubit) handling of exact and inexact (i.e. set of) real
number
- Correct handling of open/closed bounds for sets of reals
- Variable size with size of number stored in number
- With hardware they could be as or more efficient in energy and speed as
floating arithmetic but hardware would be more complex
As a result of these properties, unums can be closed under arithmetic
operations and won't hide your errors due to approximation.
I don't buy the advantages he suggests over interval arithmetic; unums
don't solve the dependency problem.
I have been meaning to start a Unum.jl package myself.
Zenna
Post by Job van der Zwan
So I came across the concept of UNUMs on the Pony language mailing list
<http://lists.ponylang.org/pipermail/ponydev/2015-July/000071.html> this
morning. I hadn't heard of them before, and a quick search doesn't show up
anything on this mailing list, so I guess most people here haven't either.
They're a proposed alternate encoding for numbers by John L. Gustafson.
http://sites.ieee.org/scv-cs/files/2013/03/Right-SizingPrecision1.pdf
“Unums”(universal numbers) are to floating point what floating point is
to fixed point.
Floating-point values self-describe their scale factor, but fix the
exponent and fraction size. Unums self-describe the exponent size, fraction
size, and inexact state, and include fixed point and IEEE floats as special
cases.
http://sites.ieee.org/scv-cs/archives/right-sizing-precision-to-save-energy-power-and-storage
Now, I don't know enough about this topic to say if they're a good or bad
idea, but I figured the idea is interesting/relevant enough to share with
the Julia crowd.
I'm also wondering if they could be implemented (relatively) easily
within Julia, given its flexible type system. If so, they might provide an
interesting advanced example, no?
Jeffrey Sarnoff
2015-07-30 17:09:42 UTC
Permalink
+1 for "grain of salt"
Post by Job van der Zwan
So I came across the concept of UNUMs on the Pony language mailing list
<http://lists.ponylang.org/pipermail/ponydev/2015-July/000071.html> this
morning. I hadn't heard of them before, and a quick search doesn't show up
anything on this mailing list, so I guess most people here haven't either.
They're a proposed alternate encoding for numbers by John L. Gustafson.
http://sites.ieee.org/scv-cs/files/2013/03/Right-SizingPrecision1.pdf
“Unums”(universal numbers) are to floating point what floating point is to
fixed point.
Floating-point values self-describe their scale factor, but fix the
exponent and fraction size. Unums self-describe the exponent size, fraction
size, and inexact state, and include fixed point and IEEE floats as special
cases.
http://sites.ieee.org/scv-cs/archives/right-sizing-precision-to-save-energy-power-and-storage
Now, I don't know enough about this topic to say if they're a good or bad
idea, but I figured the idea is interesting/relevant enough to share with
the Julia crowd.
I'm also wondering if they could be implemented (relatively) easily within
Julia, given its flexible type system. If so, they might provide an
interesting advanced example, no?
Tom Breloff
2015-07-30 17:12:57 UTC
Permalink
How about moving the discussion here:
https://github.com/tbreloff/Unums.jl/issues/2
Post by Jeffrey Sarnoff
+1 for "grain of salt"
Post by Job van der Zwan
So I came across the concept of UNUMs on the Pony language mailing list
<http://lists.ponylang.org/pipermail/ponydev/2015-July/000071.html> this
morning. I hadn't heard of them before, and a quick search doesn't show up
anything on this mailing list, so I guess most people here haven't either.
They're a proposed alternate encoding for numbers by John L. Gustafson.
http://sites.ieee.org/scv-cs/files/2013/03/Right-SizingPrecision1.pdf
“Unums”(universal numbers) are to floating point what floating point is
to fixed point.
Floating-point values self-describe their scale factor, but fix the
exponent and fraction size. Unums self-describe the exponent size, fraction
size, and inexact state, and include fixed point and IEEE floats as special
cases.
http://sites.ieee.org/scv-cs/archives/right-sizing-precision-to-save-energy-power-and-storage
Now, I don't know enough about this topic to say if they're a good or bad
idea, but I figured the idea is interesting/relevant enough to share with
the Julia crowd.
I'm also wondering if they could be implemented (relatively) easily
within Julia, given its flexible type system. If so, they might provide an
interesting advanced example, no?
John Gustafson
2015-07-31 16:04:31 UTC
Permalink
I just now learned about this discussion and I see quite a few messages I
need to reply to.

I am very excited about a Julia version of unum arithmetic, and it does
seem like the ideal language for it. Alan Edelman, Deepak Vinchhi, and
Viral Shah proposed to create it with funding from A*STAR in Singapore, and
the last I heard, they were very likely to get funded.
(***@juliacomputing.com, ***@juliacomputing.com, and
***@juliacomputing.com, if you want to contact them.) I also
received an email expressing interest in a Julia port of unums from David
P. Sanders (***@ciencias.unam.mx), who certainly would be interested
in this thread.

It is difficult to get across all the ramifications of unum arithmetic with
a PowerPoint presentation. I may be able to clear up some of the questions
I see here by posting replies. One thing that helps is Amazon's "Look
inside the book" option, which lets you read enough of the beginning to get
the definition of unum arithmetic and some other details, for free.
Post by Job van der Zwan
So I came across the concept of UNUMs on the Pony language mailing list
<http://lists.ponylang.org/pipermail/ponydev/2015-July/000071.html> this
morning. I hadn't heard of them before, and a quick search doesn't show up
anything on this mailing list, so I guess most people here haven't either.
They're a proposed alternate encoding for numbers by John L. Gustafson.
http://sites.ieee.org/scv-cs/files/2013/03/Right-SizingPrecision1.pdf
“Unums”(universal numbers) are to floating point what floating point is to
fixed point.
Floating-point values self-describe their scale factor, but fix the
exponent and fraction size. Unums self-describe the exponent size, fraction
size, and inexact state, and include fixed point and IEEE floats as special
cases.
http://sites.ieee.org/scv-cs/archives/right-sizing-precision-to-save-energy-power-and-storage
Now, I don't know enough about this topic to say if they're a good or bad
idea, but I figured the idea is interesting/relevant enough to share with
the Julia crowd.
I'm also wondering if they could be implemented (relatively) easily within
Julia, given its flexible type system. If so, they might provide an
interesting advanced example, no?
Tom Breloff
2015-07-31 18:22:40 UTC
Permalink
To me, there are 3 main criteria that I'm comparing floats vs unums:
1) Speed
2) Elegance
3) Correctness

Right now Floats win #1 and Unums win #2 and #3 (IMO). If unums are
optimized in hardware someday, I believe they will also win #1, especially
with the addition of some "summary bits" that can greatly reduce the
complexity of the logic in many cases.
I apologize for this automatic reply to your email.
To control spam, I now allow incoming messages only from senders I have
approved beforehand.
If you would like to be added to my list of approved senders, please fill
out the short request form (see link below). Once I approve you, I will
receive your original message in my inbox. You do not need to resend your
message. I apologize for this one-time inconvenience.
Loading...