Re: [Dev-C++] numerical error in a simple program
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <ten...@ne...> - 2003-09-03 16:11:28
|
The binary representation for floating point numbers cannot be perfectly accurate, so that imprecissions. With double variables you get better precission that simple float. But if you want more precission, then, as said by w.y., there shall be special libraries. w.y. wrote: >"Luís Brás" wrote: > > >> a = 0.333300000000000 >> a = 3.333000000000000 >> a = 33.329999999999998 >> a = 333.299999999999950 >> a = 3332.999999999999500 >> >> > > > >>How to avoid this error? >> >> > >You have to design your own floating point format type, or find a >library that does it... >If you need _exact_ FP calculations, the built in types can't do it. > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > |