There is a strange difference in results between Matlab and Julia that
could be the reason why [0:pi/100:pi] ends up differently:
matlab> x = ones(100, 1) * (pi/100);
matlab> sum(x) - pi
ans =
-4.4409e-15
julia> x = ones(100)*(pi/100);
julia> sum(x) - pi
1.3322676295501878e-15
So it appears that summing pi/100 100-times is smaller than pi in Matlab
and larger than pi in Julia.
On Thursday, April 24, 2014 5:47:34 PM UTC+2, Stefan Karpinski wrote:
>
> On Thu, Apr 24, 2014 at 11:43 AM, andrew cooke <[email protected]<javascript:>
> > wrote:
>
>>
>> sorry, rational is a stupid suggestion for irrational numbers...
>>
>> what i am trying to say is that there is no perfect solution to this
>> problem (that i know of). if matlab works better then it is either luck or
>> because they are actually fudging things. fudging things is appealing but
>> usually bites you somewhere down the line.
>>
>
> This is exactly how I feel about it. I still think it may be possible to
> improve our FloatRange behavior even further, but I'd like to avoid
> "fudging it".
>