Double
class Double
Variables of type Double
hold fractional numbers and can be used for calculating fractional quantities. Any number of the form X.Y is a Double
Examples: (1, -2, 35.67, -2.0, 0.5154, …)
-
The object’s description
Declaration
var description: String { get }
-
Compares two values for equality.
The
equals
function is invoked using infix notation as in the following code snippet:lhs == rhs
.Declaration
func equals(_ lhs: Double) -> Bool
Parameters
lhsA value.
rhsAnother value.
Return Value
true
if thelhs
andrhs
are equal,false
otherwise. -
Returns the remainder of this value divided by the given
divisor
using truncating division.Declaration
func truncatingRemainder(dividingBy divisor: Double) -> Double
Parameters
divisorThe number used to divide
self
.Return Value
The remainder obtained from dividing
self
bydivisor
. -
Returns this value rounded to an integral value using “schoolbook rounding.
Declaration
func rounded() -> Double
Return Value
The nearest integral value, or, if two integral values are equally close, the integral value with greater magnitude.