Richard,
> Hi. I am developing plugins for Caligari Truespace software. The plugins
> are DLL's and use MFC. Primitive Itch developed a Delphi wrapper, and I
> helped provide translations from the vc++ header files. The wrapper
> contains exports from the tsxapi.dll which the Truespace application uses
> for plugins. Using this wrapper, I can create DLL's for the extension of
> the Truespace application. The problem I am having is with the floating
> point values in the type float. They are making it hard to do checks. An
> example, I get a value from a dll function that supposed to return 4.47
> for a specific setting in the application. Well when I read this value, it
> reads like 4.46999999999997 and I get many similar problems like this. I
> have tried doing variable:= StrToFloat(Format('%.2f', [variable]));
> however it returns the same value. What can I do about this? I need to
> check for 4.47 yet its always returning false because of the inaccuracy.
> Thanks,
Instead of checking like this:
if Val = 4.47 then ...
do something like this:
if Abs(Val - 4.47) < 1e-4 then ...
Rory Daulton
[EMAIL PROTECTED]
-------------------------------------------------------------------------------
[This e-mail scanned for viruses and spam by Nmax - "Your MAXimum Connection!"]
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk