We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

GDL
About building parametric objects with GDL.
SOLVED!

When I use the check script, I get this error.

LeeJaeYoung
Virtuoso

LeeJaeYoung_0-1665337746789.png

IF WALL_SKINS_PARAMS[i][6] = 3 THEN

 

• [6] core status
core status: 0 - not part, 1 - part, 3 - last core skin.

 

AC27 on window 11
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
DGSketcher
Legend

This is generated when using = to compare REAL values. It works with INTEGERS but GDL is prone to false results for Real values due to precision.

 

The usual workaround in your coding is:

 

EPS = 0.0001 !or some other small value to suit your object

IF ABS (WALL_SKINS_PARAMS[i][6] - 3.00) < eps THEN...

 

this way if the divergence between values is less the EPS then the result will be TRUE, and any value greater than 3.00 will be FALSE

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)

View solution in original post

6 REPLIES 6
Solution
DGSketcher
Legend

This is generated when using = to compare REAL values. It works with INTEGERS but GDL is prone to false results for Real values due to precision.

 

The usual workaround in your coding is:

 

EPS = 0.0001 !or some other small value to suit your object

IF ABS (WALL_SKINS_PARAMS[i][6] - 3.00) < eps THEN...

 

this way if the divergence between values is less the EPS then the result will be TRUE, and any value greater than 3.00 will be FALSE

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)

So is this real value?
I understand it as an integer....

 

Is INT(WALL_SKINS_PARAMS[i][6]) = 3 ok?

AC27 on window 11

You would expect the core to be an integer (0, 1 or 3), but because WALL_SKINS_PARAMS can also tell you the skin thickness, the entire parameter is probably treated as a real number (just my guess).

So the core value (although it may be exactly '3') is also treated as a real number, which means it could have a decimal precision.

 

You are then trying to compare something that may have a decimal precision with something that does not - hence the message to say "Use of real types can result in precision problems".

 

In this case it is just a warning and can probably be ignored - you will only see it when checking the script.

 

Or it is a case of scripting as DGSketcher suggested to allow for a small decimal range (error).

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

thank you so much

AC27 on window 11

In this case, when the stored value is surely an integer, round_int might be easier to read.

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

@Peter Baksa Thank you for your guidance. I had forgotten that option. Might need to review some of my coding... 👍

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)