unums in Swift?


(Matthew Johnson) #1

Unums sound very interesting (http://ubiquity.acm.org/article.cfm?id=2913029). I'm wondering if anyone working on numerics in Swift has considered an implementation in the standard library.

Matthew

···

Sent from my iPad


(Stephen Canon) #2

What do you find interesting about them?

I haven’t spent more than a few hours reading about them (and the definition of “unum” seems to be a moving target, so I’m not sure that it would have been useful to study them further), but my rough thoughts are:

- SORN are a cute alternative to intervals, but only feasible with *extremely* low precision formats.

- For very low precision needs, fixed point or indexed numbers or lossy compression seem like better options for most cases.

- For “typical” precision and dynamic range needs, hardware floating-point (possibly with a compressed storage format) is just as useful and orders of magnitude faster.

- For limited dynamic range applications, fixed-point formats seem like a much better option (there’s a good opportunity here for library work to make using fixed-point arithmetic less error prone).

- For very high dynamic range applications, fixed-point logarithms or level-index numbers seem like a better option.

Unums are a cute way to mostly unify these ideas into a single type, but that doesn’t actually seem like a good idea to me. This is very much going to be a jack-of-all-trades, master-of-none situation.

That said, they are an *interesting* idea, so I wouldn’t discourage anyone from investigating them.

– Steve

···

On May 7, 2016, at 3:08 PM, Matthew Johnson via swift-evolution <swift-evolution@swift.org> wrote:

Unums sound very interesting (http://ubiquity.acm.org/article.cfm?id=2913029). I'm wondering if anyone working on numerics in Swift has considered an implementation in the standard library.

Matthew

Sent from my iPad
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Matthew Johnson) #3

What do you find interesting about them?

As an app developer I'm not even remotely a numerics expert so my understanding is probably superficial. The link I posted gave me the impression that they would avoid the errors that accumulate in floating point arithmetic.

I haven’t spent more than a few hours reading about them (and the definition of “unum” seems to be a moving target, so I’m not sure that it would have been useful to study them further), but my rough thoughts are:

- SORN are a cute alternative to intervals, but only feasible with *extremely* low precision formats.

- For very low precision needs, fixed point or indexed numbers or lossy compression seem like better options for most cases.

- For “typical” precision and dynamic range needs, hardware floating-point (possibly with a compressed storage format) is just as useful and orders of magnitude faster.

- For limited dynamic range applications, fixed-point formats seem like a much better option (there’s a good opportunity here for library work to make using fixed-point arithmetic less error prone).

- For very high dynamic range applications, fixed-point logarithms or level-index numbers seem like a better option.

Unums are a cute way to mostly unify these ideas into a single type, but that doesn’t actually seem like a good idea to me. This is very much going to be a jack-of-all-trades, master-of-none situation.

Makes sense. Thanks for sharing your thoughts!

···

Sent from my iPad

On May 9, 2016, at 10:44 AM, Stephen Canon <scanon@apple.com> wrote:

That said, they are an *interesting* idea, so I wouldn’t discourage anyone from investigating them.

– Steve

On May 7, 2016, at 3:08 PM, Matthew Johnson via swift-evolution <swift-evolution@swift.org> wrote:

Unums sound very interesting (http://ubiquity.acm.org/article.cfm?id=2913029). I'm wondering if anyone working on numerics in Swift has considered an implementation in the standard library.

Matthew

Sent from my iPad
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution