Each languages return the identical quantity however they’re formatted in another way. I assume that you simply perceive the scientific notation 5.36e-06 is identical as 0.00000536.
The format specifiers of NSLog
observe the IEEE printf specification. When describing the specifier f
, it says:
If the precision is lacking, it shall be taken as 6;
So it is rounded to six digits after the level, with out utilizing scientific notation (like e-06). It implies that all besides a single digits are eliminated.
Swift’s print
perform does not use format specifiers. As an alternative, the documentation state:
The textual illustration for every merchandise is identical as that obtained by calling
String(merchandise)
.
It clearly choses to print it with scientific notation and the utmost variety of related digits.