Re: subtract two double precision numbers



On 2006-02-14, Irrational Number <nospam@xxxxxxxxxx> wrote:
I'm running on Linux Red Hat 7 and
SGI IRIX 6.5. I have two double
precision values, which, to the
human eye, look identical. When I
subtract them, I get two different
values and that is the start of the
two runs being very different.

For example,

a = 4.123456789
b = 4.123456789

y = a - b

On IRIX: y = 3.xxxxxxe-15
On Linux: y = 4.xxxxxxe-14

Or something like that. What are
some things I can do to make them
come out to zero?

don't "for example" - please paste your
actual code.
.



Relevant Pages

  • Re: subtract two double precision numbers
    ... SGI IRIX 6.5. ... precision values, which, to the ... human eye, look identical. ... subtract them, I get two different ...
    (comp.unix.questions)
  • Re: subtract two double precision numbers
    ... SGI IRIX 6.5. ... human eye, look identical. ... subtract them, I get two different ... IMPORTANT NOTICE TO PURCHASERS: The entire physical universe, ...
    (comp.unix.questions)
  • subtract two double precision numbers
    ... I'm running on Linux Red Hat 7 and ... SGI IRIX 6.5. ... human eye, look identical. ... subtract them, I get two different ...
    (comp.unix.questions)
  • Re: subtract two double precision numbers
    ... SGI IRIX 6.5. ... I assume that in your real case 'a' and 'b' come from two separate sources/computations since the constants you are using above are identical and so should have a difference of exactly zero. ... You need to determine what precision is necessary in your application and round the final result to that precision. ... Apparently full double precision floating point, in whatever language you are using, is more precise than you need. ...
    (comp.unix.questions)