[swift-evolution] Add a type like Double but with much more precision?
jgroff at apple.com
Tue Dec 8 16:15:55 CST 2015
> On Dec 8, 2015, at 10:27 AM, Tuur Anton via swift-evolution <swift-evolution at swift.org> wrote:
> I need a floating-point type with more precision than Double. Would this be possible to add in Swift?
> Here is just one use case: Measuring time using seconds since the first instant of 1970. For example, the first instant of 2016 is 1451602800.0 seconds since the first instance of 1970. But with 1451602800.0, I'm already at 11 significant digits. This means I cannot add a nanosecond (1e-9) to this number within Double's precision because that would require a lot more significant digits than Double can handle.
There's support at the LLVM level for fp128 types. I'm not sure how good or portable its backend support is though. You might look at FloatingPoint.swift.gyb and see what breaks if you extend it to generate a Quad type backed by Builtin.FPIEEE128.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution