Re: Weirdness: (-0.666667 + 0.333333)
From: Gert Van den Eynde (gvdeynde_at_hotmail.com)
Date: 05/06/04
- Next message: Corne' Cornelius: "Re: Weirdness: (-0.666667 + 0.333333)"
- Previous message: Corne' Cornelius: "Re: Weirdness: (-0.666667 + 0.333333)"
- In reply to: Corne' Cornelius: "Re: Weirdness: (-0.666667 + 0.333333)"
- Next in thread: Corne' Cornelius: "Re: Weirdness: (-0.666667 + 0.333333)"
- Reply: Corne' Cornelius: "Re: Weirdness: (-0.666667 + 0.333333)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 06 May 2004 09:24:33 +0200
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
- Next message: Corne' Cornelius: "Re: Weirdness: (-0.666667 + 0.333333)"
- Previous message: Corne' Cornelius: "Re: Weirdness: (-0.666667 + 0.333333)"
- In reply to: Corne' Cornelius: "Re: Weirdness: (-0.666667 + 0.333333)"
- Next in thread: Corne' Cornelius: "Re: Weirdness: (-0.666667 + 0.333333)"
- Reply: Corne' Cornelius: "Re: Weirdness: (-0.666667 + 0.333333)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|