Re: [amibroker] Floating Point Arithmetic

 

Hi Tomasz, it turns out I was wrong about the floating point precision. I've printed out the variables to eight decimal places and the AFL and C++ functions agree. For example, at the last step of the calculation both versions of the function produce these coordinates:

0.57139438
4.70725203
4.70725203
0.24768575

These are passed into another function which is pure AFL running in AmiBroker, but the output from this AFL function when the inputs come from AmiBroker is -1.77987289 and the output when the input comes from C++ is -1.96784937.

The kind of behavior above occurs along the whole vector: exact same inputs, different outputs.

The companion issue is that in the C++ case, even though the inputs coming from the C++ function are always the same, the outputs from AFL on those inputs may be different in different runs.

So, oddly, my DLL isn't unstable but is causing some instability in AmiBroker somehow. Can I be compiling in a configuration which is incompatible with AmiBroker? I am using Visual Studio Community 2015 on Windows 10, with AmiBroker 6.10 64-bit, in Debug mode with optimizations turned off, x64 mode (which uses SSE) and floating point rounding set to the default value of fast. I've tried the rounding value of precise but get the same behavior.

The only other thing I can think of now is some new kind of shared pointer issue. However, I've gotten rid of all pointers except the ones I can't avoid because they are float * returned by gSite.CallFunction(). These are handled by a class and very strictly segregated so only two operations are permitted on them: 1) The pointer value can be reassigned to an AmiVar and repassed to gSite.CallFunction(); or 2) The contents of the pointer can be copied to a compiled, local array (no heap activity or pointer transfer). Otherwise, AB pointers are never touched. Could the pointer move in action (1) create instability in AB?


__._,_.___

Posted by: rosenberggregg@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? The Yahoo Mail app is fast, beautiful and intuitive. Try it today!

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/


.

__,_._,___


EmoticonEmoticon