Incorrect conversion of feet value

Originator:Nikita.Leonov
Number:rdar://30340536 Date Originated:02-Feb-2017 04:56 PM
Status:Open Resolved:
Product:HealthKit Product Version:
Classification: Reproducible:Always
 
Area:
HealthKit

Summary:
HKQuantity(unit: HKUnit.foot(), doubleValue: 7).doubleValue(for: HKUnit.foot()) returns not 7 but 6.999999999999999

Steps to Reproduce:
Run `HKQuantity(unit: HKUnit.foot(), doubleValue: 7).doubleValue(for: HKUnit.foot())` in playgrounds. See that value is 6.999999999999999

Expected Results:
Value 7 should be returned.

Actual Results:
6.999999999999999 returned

Version:
Xcode 8.2.1

Configuration:
Playground.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!