[Swift] pow() : Ambiguous use of 'pow' 에러, initializer 'init(_:)' requires that 'Decimal' conform to 'BinaryInteger' 에러

Bibi·2021년 11월 11일
0

[Swift] pow() : Ambiguous use of 'pow', initializer 'init(_:)' requires that 'Decimal' conform to 'BinaryInteger' 에러

pow() 공식 문서

https://developer.apple.com/documentation/foundation/1779833-pow

pow() 관련 대부분의 에러는 pow의 두 인자를 모두 소수점형으로 바꾸면 해결되었다..

문서의 pow(_ x: Decimal, _ y: Int) -> Decimal 대신 pow(_: Float, _: Float) -> Float 생성자를 사용하는 방식이다.
(Double로 변환해도 가능)

참고..

https://stackoverflow.com/questions/67215893/ambiguous-use-of-pow

https://stackoverflow.com/questions/63864227/swift-initializer-init-requires-that-decimal-conform-to-binaryinteger

0개의 댓글