Yep `44099 * (1/1) == 44100` is false on my machine as well. In any case, as John mentioned, to be careful about `==` comparisons with floating point.
On Wed, Nov 19, 2014 at 6:04 PM, John Myles White <[email protected]> wrote: > This does not happen on my machine. Can you give more details about your > setup? > > To be clear, 1/1 is a floating point number, which means that the whole > idea of doing == is dangerous. A safer comparison is the distance between > the values. I get the following: > > julia> abs(44100.0 - 44099.0 * (1/1)) > 1.0 > > -- John > > On Nov 19, 2014, at 7:47 PM, Intrinsic Audio <[email protected]> > wrote: > > > I've found an interesting issue in Julia that, though it seems trivial > in the application I've given, is really messing up my code and my ability > to guarantee its performance. > > > > Apparently, 44099 * (1/1) == 44100, which in my book is a very massive > error. > > > > I wrote a resample() function for the project I'm working on, and I > found that rounding errors in Julia have made the language unacceptable to > my superiors. Is this a fundamental issue with Julia, or is there > something I can do to fix this? > > > > Here is a screenshot of a simple script that demonstrates this: > > > > http://i.imgur.com/mA9hpqw.png > > > > Why does this happen? > >
