'Use of real types can result in precision problems'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-16 08:35 PM
The line where the warning points to have IF statements like these:
IF B=0 THEN ....
IF anyparameter<>0 THEN...
Despite the warnings, the object seems to work perfectly.
What 'real types' is AC talking about??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-19 08:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-19 01:14 PM
I have often used conditional tests of angle values for a variety of purposes (for example, to get symbol texts to appear correctly - not upside down, etc.). I find that I can easily exclude conditions that extremely close to 0, 45, 90, etc. (within 1/100th of a degree) since this is never an intentional setting.
I started doing this in version 6 (or 6.5?) when I found that mirroring elements would result in symbol angles of 359.9994 (or there about).
It is often possible to exclude certain angle values as meaningless. For example, I have moulding and trim objects with adjustable hotspots for the miter angles. Since no trim will ever be mitered to an angle over 175° (90° being a square cut), I set it up so that the part automatically snaps to a self return as soon as this angle is exceeded.
Whether you need to be concerned about accuracy to 0.0001° depends, I suppose, on the circumstances, but I can't imagine any such condition myself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-19 01:25 PM
HANIEL wrote:I believe you mean INT(value). MOD uses the form x MOD y and returns the remaining (fractional, decimal) value after dividing x by y.
Would using MOD(parameter)=90 work?
The INT function will not work if the actual value is 89.99°, and a whole degree (from 90.0000 to 90.9999) is a pretty large range.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-19 01:53 PM
if MyApprox(Angle, 90, AcceptableError)=TRUE then ...
Define Function "MyApprox" (variable, value, limit)
if ABS(value-variable) <= limit then TRUE
else FALSE
Balazs - where are you?

- Stuart

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-26 09:42 PM
The warning is haunting me in A LOT of IFs that used to work perfectly in AC7.
I did some simple tests. It seems that any condition wich has an "=" or a "<>" sign in an IF-THEN statement makes the warning to come up.
Is it possible that we can not use such a basic code as "IF something = anything" without the annoying message anymore??
Please tell me I'm wrong...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-27 12:37 AM
Durval wrote:It should only happen if either of "something" and "anything" is a real (floating point) number. In fact, the warning should also occur for the <= and >= operators .... anything that includes an exact equality (or the exact inequality <>).
The "real types" are worse than I thought.
The warning is haunting me in A LOT of IFs that used to work perfectly in AC7.
I did some simple tests. It seems that any condition wich has an "=" or a "<>" sign in an IF-THEN statement makes the warning to come up.
Is it possible that we can not use such a basic code as "IF something = anything" without the annoying message anymore??
Please tell me I'm wrong...
As we discussed earlier, this should be a warning that can be turned off: why don't you make it an official wish over at:
http://archicad-talk.graphisoft.com/viewforum.php?f=31
so we can all vote.

Karl

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-28 04:19 PM
But before this, let's clarify the wish a bit.
Where is, in ArchiCAD 9, the equivalent to 'Options>Preferences>Imaging & Calculation>Interrupt with error messages' that was present in AC 7 and older?
I understand what we want is not exactly this. We don't want the option to turn off the actual error messages; just the warning messages, i.e., the messages pointing to issues that don't necessarily prevent the scripts from working correctly.
So, there's another wish embeded in this one: the error/warning messages should be divided in two groups:
Is that correct?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-30 08:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-30 09:59 PM
Durval wrote:This warning is really very helpful, but the way AC communicates it is not. 'Real' types means floating point numbers, i.e. numbers with a fraction part like 3.14159...
The line where the warning points to have IF statements like these:
IF B=0 THEN ....
IF anyparameter<>0 THEN...
Despite the warnings, the object seems to work perfectly.
What 'real types' is AC talking about??
If you type something like, "IF (x = 0) ..." where x is a real number, it will definitely do something undesirable in the future. Say you have a real parameter called 'x', and its value is displayed as '0'; yet it is quite possible for the expression (x = 0) to return FALSE. Why? Because 'x' is really 0.0001, but ArchiCAD will not display that level of precision. It knows the value is not zero, but displays 0 to the user. Worse still, trying to type '0' into the value still doesn't make it 0 - ArchiCAD doesn't realise that anything has changed and leaves it as 0.0001. This can be very frustrating for users who don't understand these issues.
I never type expressions like "IF (x = 0) ....". I use the technique Karl described - define a level of precision at the beginning of your script and use that throughout, e.g.
eps = 1e-5 IF (ABS(x) < eps) ...I think a better wish would be for errors/warnings to be displayed in something like the report window rather than displaying them one by one in a modal dialog box. Ideally you would be able to double click on any warning/error in the list and it would take you to the offending line. That way you can disregard warnings if you want to, but the reminder is always there... you never know when it might spare you a lot of grief.

Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-30 10:01 PM
StuartJames wrote:Stuart, i agree with you.
Won't it be great when macro's (as functions) work 'properly' and we can use;
if MyApprox(Angle, 90, AcceptableError)=TRUE then ...
Define Function "MyApprox" (variable, value, limit)
if ABS(value-variable) <= limit then TRUE
else FALSE
Balazs - where are you?
- Stuart
Let's take this example about text position (old GV's names to make short).
IF (W~ > 90 AND W~ <= 270) THEN ROT2 180 ELSE ROT2 0
Currently, this script works, with some weaks for limt values, and i understand now, why.
Thanks to all the programmers for their explanations.
According to the new rules, i should write, if i understand correctly
eps=0.0001
IF (ABS(W~ -90) > eps AND ABS(W~ -270) <= eps) THEN ROT2 180 ELSE ROT2 0
it does'nt work.
If i write
IF ((W~ -90) > eps AND (W~ -270) <= eps) THEN ROT2 180 ELSE ROT2 0
this statement works perfectly.
DEFINE STYLE "5" Arial, htex, 5, 0
STYLE "5"
TEXT2 0, 0, mytext
May be i need some explanations to understand better, but i have to say that this is not intuitive for non programmers.
I prefer a more understandable solution, as Stuart proposed.