0

why i’m getting this strange result in swift for double values

let x = 1000000000000000000000.0;
let y = 1000000000000000000001.0;

print(x-y);    //0      but should be -1
print(y-x);    //0      but should be 1
print(x==y);  //true    but should be false

i’m using swift 3

0 Answers0