Page 1 of 1

Is DCAL single or double precision ?

PostPosted: Sun Jun 25, 2017 4:25 pm
by dhs
Hi,
The release notes from DataCAD 11 state that 'Existing DCAL macros should be compatible with DataCAD 11. Due to DCAL’s limitations, existing macros still use single-precision math.' The implication seems to be that new macros compiled with DataCAD 11 onwards will use double precision.

Can anybody confirm what precision DCAL uses?

The reason for my question is that I am seeing differences between a DCAL macro and DataCAD itself with distance calculation etc. I am using mm scale (the differences would probably never be see using feet/inch/fraction type scales)

As an example, if I prompt the user to enter a distance (using getdis) in a macro and they enter 1000 (mm) and I use that distance to set the zbase, then DataCAD displays the zbase as 1000.00000762939 (which looks quite silly). If I set the zbase as 1000 in DataCAD itself the the zbase is displayed as 1000. The difference would seem to imply a difference in precision between the 2 ? Or perhaps there is some rounding of the display (but I cannot understand why the display would be rounded differently depending on how the value was set).
The same thing happens if I move an entity in the z direction using a macro and then identify it to find the Z-Min (and presumably if I move in other directions, but it is less obvious). If I move an entity in DataCAD itself then it seems to be precise, but if I move it using a macro then the distance is out by these insignificant amounts (or at least they would be insignificant if DataCAD didn't display them, but the number of decimal places displayed highlights the difference).

Re: Is DCAL single or double precision ?

PostPosted: Mon Jun 26, 2017 8:50 am
by David A. Giesselman
DCAL for DOS still lives in the Single Precision world.

Re: Is DCAL single or double precision ?

PostPosted: Mon Jun 26, 2017 2:01 pm
by dhs
Thanks Dave,

I pretty much assumed that, although the notes about 'existing macros' using single precision does seem to imply otherwise. But it is good to have it confirmed.

It is probably obvious why I was wanting to set z-base using DCAL for Delphi (as I assume that will be double precision).

Re: Is DCAL single or double precision ?

PostPosted: Mon Jun 26, 2017 3:09 pm
by David A. Giesselman
Your assumption is correct, DCAL for Delphi is double-precision. You could even use the Extended data type (10-byte real) in your local computations. Although, any data stored (and used) by DataCAD would revert back to a Double (8-byte real).