Junior — Middle
What data type is used to store floating-point numbers in Swift?
sobes.tech AI
Answer from AI
In Swift, the types Float and Double are used to store floating-point numbers.
Floatis a 32-bit floating-point number suitable for storing numbers with less precision.Doubleis a 64-bit floating-point number that provides greater precision and is more commonly used by default.
Example:
let pi: Double = 3.1415926535
let gravity: Float = 9.81