Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Float Point Values Computation
import UIKit
let a = 1e+30
let b = -1e+30
let c = 1.0
let sum1 = (a + b) + c
let sum2 = a + (b + c)
//Representation of floating point value according to IEEE 754
let lbits = Double(-0.06)
lbits.sign //sign
lbits.exponent //exponent
lbits.significand //mantissa

This comment has been minimized.

Copy link
Owner Author

@svetlanama svetlanama commented Dec 3, 2016

We all know the Math rule by permutation sum is not changed so
(a + b) + c = a + (b + c), and it seems to be that it is not TRUE in programming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.