Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-11766] Measurement conversion to UnitVolume.cubicCentimeters and .cubicMillimeters is wrong #3280

Closed
ole opened this issue Nov 12, 2019 · 1 comment
Assignees

Comments

@ole
Copy link
Contributor

ole commented Nov 12, 2019

Previous ID SR-11766
Radar None
Original Reporter @ole
Type Bug
Status Resolved
Resolution Done
Environment

Swift 5.1.1 on Linux (Ubuntu 18.04).

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee @ole
Priority Medium

md5: bd443b98981f7c49705b83ba9d300fa0

Issue Description:

On Darwin (Swift 5.1.2, Xcode 11.2):

import Foundation
let oneLiter = Measurement(value: 1, unit: UnitVolume.liters)
oneLiter.converted(to: .cubicCentimeters).value // 1000
oneLiter.converted(to: .cubicMillimeters).value // 1_000_000

These conversions are correct.

The same code on Linux (Swift 5.1.1) produces wrong results by a factor of 10 and 1000, respectively:

import Foundation
let oneLiter = Measurement(value: 1, unit: UnitVolume.liters)
oneLiter.converted(to: .cubicCentimeters).value // 100
oneLiter.converted(to: .cubicMillimeters).value // 1000

This is because the coefficients in the code for these two units are incorrect.

@ole
Copy link
Contributor Author

ole commented Nov 12, 2019

PR: #2561

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant