-
Notifications
You must be signed in to change notification settings - Fork 14
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
base: master
Are you sure you want to change the base?
Replace ip_round extension on Double for BinaryFloatingPoint #161
Conversation
There was a problem hiding this 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 Float
s and Double
s
SwiftWisdom/Core/StandardLibrary/Numbers/BinaryFloatingPoint+Extensions.swift
Outdated
Show resolved
Hide resolved
SwiftWisdom/Core/StandardLibrary/Numbers/BinaryFloatingPoint+Extensions.swift
Outdated
Show resolved
Hide resolved
@@ -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 */ = { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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.
ip_round
now works for Float