The remainder() method computes the floating-point remainder of numerator/denominator.
Example
remainder() Syntax
The syntax of the remainder() method is:
num.remainder(dividingBy: otherNumber)
Here, num is a numerator.
remainder() Parameters
The remainder() method takes one parameter
otherNumber- the dividing value (denominator)
remainder() Return Values
The remainder() method returns the floating-point remainder of num/otherNumber.
Example: Swift Double remainder()
Output
Remainder of 7.5/2.1 = -0.5 Remainder of -17.50/2.0 = 0.5 Remainder of 10/0 = -nan
Here, we have used the remainder() method to compute the remainder while the numerator is divided by the denominator.