wongzigii
(Zigii Wong)
1
let decimal = Decimal(string: "0.000499")
decimal.nextUp // 0.000500
decimal.nextUp // 0.000600
The least representable value that compares greater than this value.
Why decimal's nextUp is ignoring the precision?
Expect:
let decimal = Decimal(string: "0.000499")
decimal.nextUp // 0.000500
decimal.nextUp // 0.000501
What extra work I need to do at this case?
Martin
(Martin R)
2
Possible bugs of Decimal.ulp and Decimal.nextUp were mentioned here:
xwu
(Xiaodi Wu)
3
I fixed this for the open-source version (swift-corelibs-foundation) but Apple hasn’t picked up the changes for the proprietary version shipped on their platforms 
8 Likes
Maybe compatibility tests with Darwin, that should fail, could draw attention this issue.
wongzigii
(Zigii Wong)
5
Is there any workaround for now ?
xwu
(Xiaodi Wu)
6
I suppose you could copy and paste the corrected code into your own project.