Sobes.tech
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.

  • Float is a 32-bit floating-point number suitable for storing numbers with less precision.
  • Double is 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
What data type is used to store floating-point… - sobes.tech