<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Use of real types can result in precision problems HELP? in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294318#M5779</link>
    <description>&lt;BLOCKQUOTE&gt;JGoode wrote:&lt;BR /&gt;Care to expand on what :&lt;PRE&gt;A = max(left_rail, right_rail) + 0.2&lt;/PRE&gt; will do? I haven't seen anything similar to this thus far.&lt;/BLOCKQUOTE&gt;
&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;max&lt;E&gt;&lt;/E&gt; is a GDL instruction – short for &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;maximum&lt;E&gt;&lt;/E&gt;. If you give it a list of numbers, it returns the highest value from that list. You appear to want A to be offset by 200mm from the the higher of &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;left_rail&lt;E&gt;&lt;/E&gt; and &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;right_rail&lt;E&gt;&lt;/E&gt;, which is just the sort of thing &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;max&lt;E&gt;&lt;/E&gt; is designed for. I recommend looking up these functions in the GDL manual just so you know what programming tools are available.</description>
    <pubDate>Fri, 30 Jun 2017 11:47:23 GMT</pubDate>
    <dc:creator>Ralph Wessel</dc:creator>
    <dc:date>2017-06-30T11:47:23Z</dc:date>
    <item>
      <title>Use of real types can result in precision problems HELP?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294312#M5773</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;T&gt;I want to get rid of an error for this bit of code;&lt;BR /&gt;
&lt;BR /&gt;
if (right_rail = left_rail) then&lt;BR /&gt;
	A = right_rail+0.2&lt;BR /&gt;
endif&lt;BR /&gt;
&lt;BR /&gt;
Is there any way I can make the error go away? &lt;BR /&gt;
&lt;BR /&gt;
Thanks!&lt;BR /&gt;
&lt;BR /&gt;
(edit): If it can't be made to go away, will my script still be fine?&lt;/T&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 30 Jun 2017 09:28:32 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294312#M5773</guid>
      <dc:creator>JGoode</dc:creator>
      <dc:date>2017-06-30T09:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Use of real types can result in precision problems HELP?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294313#M5774</link>
      <description>Script is fine.&lt;BR /&gt;
&lt;BR /&gt;
it is information for You that in some cases when comparing real values, you can get problems like calculation takes longer time or something bigger.&lt;BR /&gt;
&lt;BR /&gt;
If You wish to get rid of this error avoid something like this:&lt;BR /&gt;
&lt;BR /&gt;
"if real_value1=real_value2 then...."&lt;BR /&gt;
&lt;BR /&gt;
Declare a precision range parameter:&lt;BR /&gt;
&lt;BR /&gt;
EPS=.0001 &lt;BR /&gt;
&lt;BR /&gt;
than instead of comparing values put something like that:&lt;BR /&gt;
&lt;BR /&gt;
if abs(real_value1-real_value2)&amp;lt;=EPS then....&lt;BR /&gt;
&lt;BR /&gt;
Best Regards,&lt;BR /&gt;
Piotr</description>
      <pubDate>Fri, 30 Jun 2017 09:47:11 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294313#M5774</guid>
      <dc:creator>Piotr Dobrowolski</dc:creator>
      <dc:date>2017-06-30T09:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Use of real types can result in precision problems HELP?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294314#M5775</link>
      <description>&lt;BLOCKQUOTE&gt;JGoode wrote:&lt;BR /&gt;I want to get rid of an error for this bit of code;&lt;BR /&gt;
if (right_rail = left_rail) then&lt;BR /&gt;
	A = right_rail+0.2&lt;BR /&gt;
endif
&lt;/BLOCKQUOTE&gt;
It's warning you that this code might do puzzling and unexpected things. Precision is critical when you are dealing with real numbers. Consider what happens if your variables have the following values:&lt;BR /&gt;
right_rail = 0.03001&lt;BR /&gt;
left_rail = 0.02999&lt;BR /&gt;
&lt;BR /&gt;
If you look at those values in a field or output as text, both will display as 0.03m (or 30.0mm).  ARCHICAD will only display to the nearest 10th of a millimetre, so any digits beyond that threshold are rounded. But when a script like this runs:&lt;PRE&gt;if (right_rail = left_rail&lt;/PRE&gt;
…the result is false, because the values are different.&lt;BR /&gt;
&lt;BR /&gt;
Rather than comparing them exactly, check that the difference between them is negligable, i.e. below a level of precision that makes a difference. That's what Piotr's example shows, assuming your level of precision is 0.1mm</description>
      <pubDate>Fri, 30 Jun 2017 11:09:02 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294314#M5775</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2017-06-30T11:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Use of real types can result in precision problems HELP?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294315#M5776</link>
      <description>&lt;BLOCKQUOTE&gt;Ralph wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;JGoode wrote:&lt;BR /&gt;I want to get rid of an error for this bit of code;&lt;BR /&gt;
if (right_rail = left_rail) then&lt;BR /&gt;
	A = right_rail+0.2&lt;BR /&gt;
endif
&lt;/BLOCKQUOTE&gt;
It's warning you that this code might do puzzling and unexpected things. Precision is critical when you are dealing with real numbers. Consider what happens if your variables have the following values:&lt;BR /&gt;
right_rail = 0.03001&lt;BR /&gt;
left_rail = 0.02999&lt;BR /&gt;
&lt;BR /&gt;
If you look at those values in a field or output as text, both will display as 0.03m (or 30.0mm).  ARCHICAD will only display to the nearest 10th of a millimetre, so any digits beyond that threshold are rounded. But when a script like this runs:&lt;PRE&gt;if (right_rail = left_rail&lt;/PRE&gt;
…the result is false, because the values are different.&lt;BR /&gt;
&lt;BR /&gt;
Rather than comparing them exactly, check that the difference between them is negligable, i.e. below a level of precision that makes a difference. That's what Piotr's example shows, assuming your level of precision is 0.1mm&lt;/BLOCKQUOTE&gt;

I also have the code;&lt;BR /&gt;
&lt;BR /&gt;
if (left_rail &amp;gt; right_rail) then&lt;BR /&gt;
	A = left_rail+0.2&lt;BR /&gt;
endif&lt;BR /&gt;
	&lt;BR /&gt;
if (right_rail &amp;gt; left_rail) then&lt;BR /&gt;
	A = right_rail+0.2&lt;BR /&gt;
endif&lt;BR /&gt;
&lt;BR /&gt;
So if one is 0.03001 and the other is 0.2999 then it doesn't matter to me.</description>
      <pubDate>Fri, 30 Jun 2017 11:30:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294315#M5776</guid>
      <dc:creator>JGoode</dc:creator>
      <dc:date>2017-06-30T11:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Use of real types can result in precision problems HELP?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294316#M5777</link>
      <description>&lt;BLOCKQUOTE&gt;JGoode wrote:&lt;BR /&gt;I also have the code;&lt;BR /&gt;
if (left_rail &amp;gt; right_rail) then&lt;BR /&gt;
	A = left_rail+0.2&lt;BR /&gt;
endif&lt;BR /&gt;
	&lt;BR /&gt;
if (right_rail &amp;gt; left_rail) then&lt;BR /&gt;
	A = right_rail+0.2&lt;BR /&gt;
endif
&lt;/BLOCKQUOTE&gt;
Are you looking for something like:&lt;PRE&gt;A = max(left_rail, right_rail) + 0.2&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jun 2017 11:34:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294316#M5777</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2017-06-30T11:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Use of real types can result in precision problems HELP?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294317#M5778</link>
      <description>&lt;BLOCKQUOTE&gt;Ralph wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;JGoode wrote:&lt;BR /&gt;I also have the code;&lt;BR /&gt;
if (left_rail &amp;gt; right_rail) then&lt;BR /&gt;
	A = left_rail+0.2&lt;BR /&gt;
endif&lt;BR /&gt;
	&lt;BR /&gt;
if (right_rail &amp;gt; left_rail) then&lt;BR /&gt;
	A = right_rail+0.2&lt;BR /&gt;
endif
&lt;/BLOCKQUOTE&gt;
Are you looking for something like:&lt;PRE&gt;A = max(left_rail, right_rail) + 0.2&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;

I seem to have got it not showing the error now with the following;&lt;BR /&gt;
&lt;BR /&gt;
if (left_rail &amp;gt; right_rail) then&lt;BR /&gt;
	A = left_rail+0.2&lt;BR /&gt;
endif&lt;BR /&gt;
	&lt;BR /&gt;
if (right_rail &amp;gt; left_rail) then&lt;BR /&gt;
	A = right_rail+0.2&lt;BR /&gt;
endif&lt;BR /&gt;
&lt;BR /&gt;
if NOT(right_rail &amp;gt; left_rail) and NOT (left_rail &amp;gt; right_rail) then&lt;BR /&gt;
	A = right_rail+0.2&lt;BR /&gt;
endif&lt;BR /&gt;
&lt;BR /&gt;
It might be inefficient code but it's working correctly for me &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;  &lt;BR /&gt;
Care to expand on what :&lt;PRE&gt;A = max(left_rail, right_rail) + 0.2&lt;/PRE&gt; will do? I haven't seen anything similar to this thus far.</description>
      <pubDate>Fri, 30 Jun 2017 11:37:02 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294317#M5778</guid>
      <dc:creator>JGoode</dc:creator>
      <dc:date>2017-06-30T11:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Use of real types can result in precision problems HELP?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294318#M5779</link>
      <description>&lt;BLOCKQUOTE&gt;JGoode wrote:&lt;BR /&gt;Care to expand on what :&lt;PRE&gt;A = max(left_rail, right_rail) + 0.2&lt;/PRE&gt; will do? I haven't seen anything similar to this thus far.&lt;/BLOCKQUOTE&gt;
&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;max&lt;E&gt;&lt;/E&gt; is a GDL instruction – short for &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;maximum&lt;E&gt;&lt;/E&gt;. If you give it a list of numbers, it returns the highest value from that list. You appear to want A to be offset by 200mm from the the higher of &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;left_rail&lt;E&gt;&lt;/E&gt; and &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;right_rail&lt;E&gt;&lt;/E&gt;, which is just the sort of thing &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;max&lt;E&gt;&lt;/E&gt; is designed for. I recommend looking up these functions in the GDL manual just so you know what programming tools are available.</description>
      <pubDate>Fri, 30 Jun 2017 11:47:23 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Use-of-real-types-can-result-in-precision-problems-HELP/m-p/294318#M5779</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2017-06-30T11:47:23Z</dc:date>
    </item>
  </channel>
</rss>

