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

Replace ip_round extension on Double for BinaryFloatingPoint #161

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MaxHasADHD
Copy link

ip_round now works for Float

Copy link
Contributor

@bobgilmore bobgilmore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add to the test, so that we see it explicitly exercised on both Floats and Doubles

@@ -938,21 +936,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
77882022D65A5916A7FFD999 /* [CP] Copy Pods Resources */ = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this change? Did you re-run pod install If so, you could probably check in the Podfile.lock

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did run pod install to generate the workspace

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, since that made THIS change, didn't it also update Podfile.lock? You should rerun it and check in the lock file if it changed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the lock file did not change.

import Foundation

extension BinaryFloatingPoint {
/// https://codereview.stackexchange.com/questions/142748/swift-floatingpoint-rounded-to-places
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to give this link the - SeeAlso: tag in the documentation along with adding a basic summary of the function.

//

import Foundation

extension Double {
@available(*, unavailable, renamed: "ip_rounded(toDecimalPlaces:)")
public func ip_round(toDecimalPlaces decimalPlaces: Int) -> Double {
let decimalShiftBase10 = pow(10.0, Double(decimalPlaces))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this code now cannot be called, it should be removed. But since the method return a value, it needs to call fatalError or something similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants