[swift-evolution] Pre-proposal: Safer Decimal Calculations

Rainer Brockerhoff rainer at brockerhoff.net
Sun Mar 20 12:54:05 CDT 2016


On 3/20/16 14:43, Andrey Tarantsov via swift-evolution wrote:
> I have no stake in this proposal, except for:
> 
>> I suggest, therefore, that this acceptance be indicated by an
>> annotation to the literal; a form such as ~0.1 might be easiest to 
>> read and implement, as the prefix ~ operator currently has no
>> meaning for a floating-point value.
> 
> Whatever you do, don't touch the literals! I specify NSTimeIntervals
> of 0.1, 0.2, 0.25 etc all over the place, and I couldn't care less if
> my animations are one femtosecond off.
> 
> Don't pollute everyone's apps with tildes just because there's a
> niche that needs to care about precision loss.

Yes, I'm now agreeing that the ideal solution is to leave the whole
binary floating-point mess alone and write a reasonable `Decimal` type.
I'll update my text accordingly when I find time.


-- 
Rainer Brockerhoff  <rainer at brockerhoff.net>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
In their own business even sages err."
http://brockerhoff.net/blog/



More information about the swift-evolution mailing list