Hi eskimo,
Yes, 2.0 is the expected result.
Here is my detailed configuration:
• MacBook Pro 2020, Intel processor
• MacOS 11.4 (but reproduced yesterday with 11.3.x)
• Xcode 12.5
• Simulators: iPhone 8 (14.5), iPhone 8 (12.4), iPhone 8 Plus (14.5), iPhone 12 Pro Max
I always get the following result:
(lldb) po (398.0 / 165.0).rounded()e-321
You don't even have to set a breakpoint to get an unexpected result (though different) as the instruction
print("Rounded result: \((398.0 / 165.0).rounded())")
logs
Rounded result: 2.412121212121212
FYI I've filled in a bug report (FB9118612).
Topic:
Programming Languages
SubTopic:
Swift
Tags: