[LC++]a bit [OT]: float-dificulty

Chris Vine chris at cvine.freeserve.co.uk
Mon Jul 24 05:39:05 UTC 2006

On Sunday 23 July 2006 21:42, Julien Claassen wrote:
> Hi Crhis!
>   Unfortunitely it's a bit more complicated than a simple loop. I use it in
> a set function, which can be triggered from in/decrement functions and by
> just entering a value. Should I
>   1. just add 0.0001 to my max value, for this is the highest precision
> allowed with the functions or
>   2. look for some kind of imprecision-function, which can truncate a value
> to a given number of digits?
>   I think 2 would be cleaner. Is there a function like that, which is
> efficient. This is all for a UI-library.
>   Kindest regards and thanks!
>           Julien

Boost has something on this, which might be of value:

But I think this is also a useful explanation and gives you some imprecision 
approachs which avoid a third party library:


More information about the tuxCPProgramming mailing list