Strange Bug: Incorrect calculation

Schlagworte:
  • 2014

Hi,

There is a strange bug on smartparts from Allplan 2014-0-2.

In test_01, the used formula is: c = REF_X - a - b - d
In test_02, the used formula is: c = REF_X - (a + b + d)

The value of C is the same, but in test_01, "C" isn't showed correctly!

Regards,
Xavier Coll

Xavier Coll • Architect, Project Manager I+D, BIM Manager, BIM Auditor
EiPM • http://www.eipm.es/en/

Anhänge (2)

Typ: application/octet-stream
1381-mal heruntergeladen
Größe: 384,22 KiB
Typ: image/jpeg
464-mal heruntergeladen
Größe: 48,25 KiB

Hello,

this is nothing strange.

Infact of rounding errors the displayed value isn't like expected.

The value of C is correct
-> in this case 0.5 (or maybe 0.49999999999999998 or 0.500000000000001) :-)

TEXT2 REF_X - ( c / 2 + d ) , 0 , STR ( "%.0cm" , c )

The usage of Format string with STR-command isn't recommended, because not all format-strings are supported!

Better use this with one fraction (number after floating point):
TEXT2 REF_X - ( c / 2 + d ) , 0 , STR ( 100*c , 8,1)

Without fractions (e.g. STR(c,8,0)) infact of rounding errors a wrong number can be shown,
because 49.99999999 is reduced to 49 (truncated decimals)

Regards.

Jörg

Hi Jörg,

Thanks for your answer! :-D

I'm totally agree with you to work with fractions, to avoid that numbers that aren't exacts like 49.999, be showed like 49.

But I revised the smartparts test01 and the test02 from the last ndw files, and they are totally exact: c is 0.5, and not any other value like 0.49999999 or 0.5000000001

I send another ndw file, with the smartparts test03 and test04 (they are exact the same smartpart), and the only change is:

in Test03 -> TEXT2 REF_X - ( c / 2 + d ) , 0 , STR ( 100*c, 8, 0 )
in Test04 -> TEXT2 REF_X - ( c / 2 + d ) , 0 , STR ( 100*c, 8, 1 )

I really think that it's very strange.

thanks a lot and Happy new year!
Xavi.

Xavier Coll • Architect, Project Manager I+D, BIM Manager, BIM Auditor
EiPM • http://www.eipm.es/en/

Anhänge (2)

Typ: application/octet-stream
1445-mal heruntergeladen
Größe: 512,20 KiB
Typ: image/png
434-mal heruntergeladen
Größe: 16,96 KiB

Hi Xavi,

..as mentioned STR(c,8,0)) truncate the decimals instead of rounding it!
Thats a bug. We will solve it in the next version.

The Workaround is: not to use STR with fractions=0 .
STR(c,8,1)) works like expected.

Regards.

Jörg

Ok, Jörg! :-D
Thanks a lot, and regards!
Xavi

Xavier Coll • Architect, Project Manager I+D, BIM Manager, BIM Auditor
EiPM • http://www.eipm.es/en/