Replace ip_round extension on Double for BinaryFloatingPoint#161
Replace ip_round extension on Double for BinaryFloatingPoint#161MaxHasADHD wants to merge 2 commits intoIntrepidPursuits:masterfrom
Conversation
bobgilmore
left a comment
There was a problem hiding this comment.
Please add to the test, so that we see it explicitly exercised on both Floats and Doubles
SwiftWisdom/Core/StandardLibrary/Numbers/BinaryFloatingPoint+Extensions.swift
Outdated
Show resolved
Hide resolved
SwiftWisdom/Core/StandardLibrary/Numbers/BinaryFloatingPoint+Extensions.swift
Outdated
Show resolved
Hide resolved
| 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.
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.
I did run pod install to generate the workspace
There was a problem hiding this comment.
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.
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.
We might want to give this link the - SeeAlso: tag in the documentation along with adding a basic summary of the function.
| 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.
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_roundnow works for Float