Re: Weirdness: (-0.666667 + 0.333333)

From: Corne' Cornelius (cornec_at_nospam-for-noreason.uy)
Date: 05/06/04


Date: Thu, 06 May 2004 09:39:54 +0200

heh, i also thaught of not worrying about it being 1e-16, but then
there's a pixel missing where x is 0.

Looks like i will have to make 2 loops and 1 statement.

for when:
x - epsilon() < 0
x = 0
x + epsilon() > 0

Gert Van den Eynde wrote:
> Corne' Cornelius wrote:
>
>
>>i should've made it more clear what i actually want to do.
>>
>>I'm not really trying to compare 2 double which could be in accurate
>>becuase of rounding errors.
>>
>>I'm writing a program that draws graphs on a cartesian plane, so in
>>order to go on the x-axis from say -2, to +2, in 20 intervals, i need
>>one of these point to be zero or very close to it.
>>
>>how could i make sure i don't get rounding problems ?
>>
>
> You can't. The only thing you can do is to compare your value of x to zero
> (using fcmp) and if it's close enough force it to be zero. Btw, Is the
> difference between 1e-16 and 0.0 so significant that it will show up on a
> graph in the range [-1,1] ?
>
> bye,
> gert



Relevant Pages

  • Re: Weirdness: (-0.666667 + 0.333333)
    ... > becuase of rounding errors. ... > I'm writing a program that draws graphs on a cartesian plane, ... The only thing you can do is to compare your value of x to zero ...
    (comp.lang.cpp)
  • Re: if statement
    ... The zero argument tells Matchto return the first *exact* match. ... > There can be 6 different numbers in the target evaluation cell and I want ... > compare it 6 different ways and if it matches the correct value compared ... > can't get it to string together more than the one comparison. ...
    (microsoft.public.excel.misc)
  • Re: markov chain decomposition (nearly completely decomposable system)
    ... the chain has k-1 communicating ... approximately true for small epsilon. ... converges to zero. ... > with a probability transition matrix P having the following structure: ...
    (sci.math)
  • Re: writing a two hour movie script
    ... You're an idiot, appropriately named "Zero". ... includes TV movies and small companies. ... but to top it all off, you don't compare the number of aspiring ... agent in Florida on the Net who sold the book for him. ...
    (misc.writing)
  • Re: how to prove that f^2+f ^2 <=1 if ...
    ... So let x now be a regular point of f: ... that epsilon has been taken to be smaller than F = f'^2. ... That is one half of the desired inequality. ... But since x- is a point, where f' takes a value very near to zero, ...
    (sci.math)