|
Subject: Re: [dssslist] Arithmetic error From: <listen@xxxxxxxxxxxx> Date: Thu, 7 Apr 2005 17:42:02 +0200 |
> Do you know something about this? Could it be because of my version of Jade?
This is a standard problem with IEEE 754 (aka floating point numbers).
IEEE is binary and hence cannot store values like 0.1 in exect form.
Same happens in almost every other language:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main( int args, char* argv[] ) {
double a1 = atof(argv[1]);
double a2 = atof(argv[2]);
double a3 = atof(argv[3]);
printf( "%lf - %lf - %lf = %lf < 0 ? %s\n",
a1, a2, a3,
a1-a2-a3,
a1-a2-a3 <=0 ? "yes" : "no" );
return 0;
}
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [dssslist] Arithmetic error, Paul Tyson | Thread | [dssslist] re: Arithmetic error, Javier Farreres de l |
| Re: [dssslist] Arithmetic error, Paul Tyson | Date | [dssslist] re: Arithmetic error, Javier Farreres de l |
| Month |