Skip to content
Ben Oakes edited this page Jun 1, 2017 · 13 revisions

2017-06-01

floating point arithmetic isn’t commutative

via @wolfram74

>> (1..10000).to_a.map { |n| (1.0/n) }.reduce { |a, e| a + e }
=> 9.787606036044348
>> (1..10000).to_a.reverse.map { |n| (1.0/n) }.reduce { |a, e| a + e }
=> 9.787606036044386

Links from the meetup:

2016-03-02

Links from the meetup:

2017-02-02

Links from the meetup:

2017-01-05

Links from the meetup:

2016-11-03

Links from the meetup:

2016-10-06

Links from the meetup.

Clone this wiki locally