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

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Reliability of "Use of Real Types" error checking

Anonymous
Not applicable
Hello,
I have a library part that has a statement in the 3D script that reads
If rad=0 then (do something).
Rad is a length type parameter set in the parameter list.
Shouldn't this type of statement trigger the
"Use of Real Types may result in precision problems" error message ?
It has in many other scripts where I have used "Check Script" in AC 9.

What am I missing here ?
If I haven't missed something in the logic then
has anyone else noticed that sometimes the error checker misses
some errors of this type that it should pick up ?

Thank you,
Peter Devlin
6 REPLIES 6
Frank Beister
Moderator
Try in front of the statement
rad=rad+0.0002/2-0.0001
It could happen, that ArchiCAD ignores the setting in the parameter script as there is no clear declaration procedure of vartypes in GDL. As normal variables are integer if you use them first or assign integer values this could be for parameters too. They change to real just if you do floating point calculations/operations with them. An integer parameter defined in the list has a floating point part too as you can see in debugger mode.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
Hello Frank,
Thanks for posting back.
You say
"An integer parameter defined in the list has a floating point part too as you can see in debugger mode."

You pointed this out to me once before and it was a big surprise to me.
I thought that GS had changed this in AC 9 and this was the purpose
of the "inner type" that they mentioned at one point.

You seem to be saying that any parameter initially set to a whole number
is treated as an integer unless it is made to participate in some
calculation that involves floating point numbers. Very stange.

I was wondering about this last night and did a search on the web
with the key words "integer 0".
I did not find much but what I was wondering was, is zero considered
an integer or a floating point number in computer mathematics
when you are using a language that does not require explicit typing.

I am begging to suspect that all of my assumptions about
data types in AC are illusions or perhaps delusions.

Peter Devlin
Anonymous
Not applicable
Hello Frank,
Well guess what.
I did a dumb experiment and managed to trigger the
"use of real types" error.

The parameter "rad" is set to 0" in the parameter list
and the IF statement reads IF rad=0 then....
If I change this to read IF rad=0'-0" then.....
I get the error message.

I tried changing the working units to decimal feet
and left the IF statement reading IF rad=0 then....
and got no error until I change the IF statement
to IF rad=0.0' then....

I don't know what to make of this.
Peter Devlin
Frank Beister
Moderator
I wouldn't ascribe this too much meaning.

The GDL develop environment - the edit window - tries to precompile as much code as possible if you check the script or save the object. It tries to "understand" what you want to do. The compiler runs the script once (?) to see, if it is OK. Doing this it sets some warnings, if there might be problems. As doing no closing of CUT-commands with CUTEND. And if you use assumed floating point type in a comparation you get the precision warning. This does not mean there is a real (nice double meaning) problem.

You understood the new internal integer functionality right. But this does not mean GDL does store the value in a "n" bit wide byte without floating part. The compiler remarks just that this variable can not have a floating part as long as you do no floating point result generating operations. As you mention with your 0'-0'': It does not need to generate a real type, just the operation _might_ can generate. Obvisiously is a length unit parameter from type integer too. But I haven't checked this yet.

BTW: Is it a problem, that you do not have to click away the anoying warning? 😉
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
Hello Frank,
You have given me some things to think about.
I ran the debugger in AC 9 and all numeric variables
are still shown as floating-point. I guess the debugger
hasn't heard of the new "inner type".

I still have only the demo version of AC 9 but I was using it
to check my scripts so that I could update them to be correct
in AC 10. I did not want to have any "precision problems"
because our office uses my library parts almost exclusively
and the man I work for would freak if he got an error message
while trying to place one of my objects.
Come to think of it, I am wondering if you get "use of real types"
error messages if you place an object containing these types of errors
or does it only give such a report when you "check script".
I will have to test this in AC 9.

Thanks for the information Frank,
Peter Devlin
Frank Beister
Moderator
As the warning for not enough CUTENDS the precision warning is just a warning by checking the script. But as the inner sense of warnings: They can give a hint of upcoming errors. Most no error messages, but misbehaviour. In the case you think you compare 1=1 and GDL might compare 0.9999=1.0001. So you should avoid it.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm