Current learning Swift, there are ways to find max and min value for different kind of Integer like Int.max
and Int.min
.
Is there a way to find max value for Double and Float? Moreover, which document should I refer for this kind of question? I am currently reading Apple's The Swift Programming Language.
The value of this constant is positive 1.7976931348623157E+308.
Double represents a 64-bit floating-point number. Double has a precision of at least 15 decimal digits, whereas the precision of Float can be as little as 6 decimal digits. Swift always chooses Double (rather than Float) when inferring the type of floating-point numbers.
As of Swift 3+, you should use:
CGFloat.greatestFiniteMagnitude Double.greatestFiniteMagnitude Float.greatestFiniteMagnitude
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With