Design forum
cancel
Showing results for
Did you mean: Newcomer
I've been getting errors that say: "Use of real types can result in precision problems"

Is there any easy fix? I have library parts called Easy Cabintry and I don't understand how to fix the line of code.

Here is one line of code where I get the error:

if int(num)<>num and num-int(num)>.001 then oddwidth=a-(int(num)*maxwd) else oddwidth=0

I fixed the line of code in a libary part I made with help from my reseller. I added- IF ABS (x-3'-0") <.001 then blah blah blah.

I'm going to keep trying to solve it myself and I know I didn't give you guys much to go on but if there is an easy fix please let me know.

Thanks,
Michele

Is there a spot we can praise resellers because mine is great and I wish I could tell everyone so they know!!!
AC10/12 USA 11882156, OS XP 2 GB Ram
2 REPLIES 2 Moderator
Hi Michele,

This is just a warning message AFAIK. Everything is interpretted as it was in the past, but Checkscript is just trying to help.

The "if" statement that you show is fine...

And, your reseller correctly suggested using:

epsilon = 0.001
...
IF ABS(X-3') < epsilon THEN

for suitably small epsilon, instead of

IF X = 3' THEN

This will affect Imperial users the most, but Metric users are not immune. (While AC and GDL use metric internally: 1 = 1 meter, anything less than 1 meter is represented by a decimal fraction which is a potentially infinite binary number inside the computer, chopped off at the number of bits used for real numbers (representational error), and then when something like subtraction is performed, you get compounding of that error... hence the use of epsilon comparison such as above to account for such things.

Note, if X is a parameter and you want to know if the user typed exactly 3' (or a VALUE list etc resulted in that), then the epsilon comparison isn't needed, since 3' (as typed, converted and stored) = 3' (as typed, converted and stored). It is generally only an issue if some arithmetic has been performed.

Karl
One of the forum moderators   •   AC 25 USA and earlier   •   MacOS 11.6, iMac Pro Newcomer
Thanks Karl for explaining it. I think I understand it in my limited way. I have library parts from Easy cabnitry and there is (amonst others) a line of code that gets errors:

if int(num)<>num and num-int(num)>.001 then oddwidth=a-(int(num)*maxwd) else oddwidth=0

I didn't write the code and when I do write code it very simple . Would you know how to fix the above line of code?

Thanks,
Michele
AC10/12 USA 11882156, OS XP 2 GB Ram Latest solutions

Most liked posts