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-11150] NSDecimalNumber .multiplying(byPowerOf10:) works in opposite way on Linux #3991

Closed
swift-ci opened this issue Jul 17, 2019 · 2 comments

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-11150
Radar None
Original Reporter dstranz (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

swift:5.0 - linux; amd64
Swift Docker image from https://hub.docker.com/_/swift
Image ID: sha256:9dc0d914ebd9aaece2c1a626c719a7dace83fbbca0868fca59da9ae49ac02a17

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

md5: 3d6a1b043fcdcdcab5834ad68f23cbd7

Issue Description:

I have the following code in test case:

let decimalNumber = NSDecimalNumber(string: "0.022829306361065572").multiplying(byPowerOf10: 18).stringValue
XCTAssertEqual(decimalNumber, "22829306361065572")

It works fine on macOS but on Linux environment it gives me totally different results:

XCTAssertEqual failed: ("0.00000000000000000000000000000283706242508673928433299258214568592438") is not equal to ("22829306361065572") 

So it looks like on Linux Foundation it using multiplying(powerOf10: -18).

@spevans
Copy link
Collaborator

spevans commented Jul 17, 2019

#2418

@swift-ci
Copy link
Contributor Author

Comment by Dominique Stranz (JIRA)

Fixed by @spevans and merged to master. Thanks 👍

@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

2 participants