Re: Float Precesion problem?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Raed Sawalha (raed_sawalha_at_hotmail.com)
Date: 10/10/04


Date: Sun, 10 Oct 2004 15:23:00 +0200

yes thats what i meant representing it from 0.99990000000000001 to 0.9999
, thats mean this is not possible ?

"Sigurd Stenersen" <sigurds@utvikling.com> wrote in message
news:epvxsFsrEHA.3608@TK2MSFTNGP14.phx.gbl...
> Raed Sawalha wrote:
> > float fNumber = atof(csFloatValue);//which is here 0.9999
> > the fNumber contains 0.99990000000000001, how can i format it for
> > only 4 float position like we do in printing to screen
> > (printf("%.4f")........
>
> What do you mean, "format it" ? If you want it in a string, use
sprintf().
> If you want to "format" it in a float, you can't as the value 0.9999 can't
> be represented exactly in a float.
>
>
> --
>
>
> Sigurd
> http://utvikling.com
>
>



Relevant Pages

  • Germany Qualifying
    ... Hayden gets it, but you have to go 15th posistion to find the first guy 1 second slower, thats close racing!!! ... qualifying isn't representing whose going to win but rather who managed to eek out a fraction of an advantage, the race tomorrow could be a cracker, lets hope fine weather, and can Rossi win?? ...
    (rec.motorcycles.racing)
  • Re: [PHP] how to handle inserting special characters into a mysql field
    ... and I understand it uses the %s because of sprintf(), ... data is a string. ... thats not syntax I'm used to seeing. ...
    (php.general)
  • Re: Float Precesion problem?
    ... Raed Sawalha wrote: ... >> value 0.9999 can't be represented exactly in a float. ... > yes thats what i meant representing it from 0.99990000000000001 to ... there are an infinite number of floating point ...
    (microsoft.public.vc.mfc)
  • Re: help protecting form to email from spammers
    ... Thats my problem so far.. ... the confines of what I already have. ... Validate each field, look at sprintf and mysql_real_escape_string. ...
    (alt.php)