Strand7 Snippets
Snippet #11: Displaying Real Numbers |
|
Introduction | ||
Real numbers in Strand7 are displayed according to the settings on the Numbers Formatting dialog shown in the following image. The easiest way to open this dialog is to click the relevant icon ![]() |
||
![]() |
||
Four styles are offered, as shown on the dialog. These are all variations on decimal (Fixed) and scientific formatting options. Engineering is basically the same as Scientific except that the exponent is always given as a multiple of 3.
|
||
Typical Real Numbers | ||
In finite element models that represent real structures we typically have numbers that are better displayed in decimal format and numbers that are better displayed in scientific format; neither option is ideal in all cases.
A number like 0.31 is clearer in decimal format (0.31) than in scientific format (3.10E-01). On the other hand, a number like the Young's modulus of steel in SI units is clearer in scientific format than in decimal format (2.10E11 is easier to read and check than 210000000000.00). The following image shows two tabs of the beam property dialog for a standard steel beam cross section using the Fixed style with Decimals=2 in a model with units of m, MPa and kg. The material values are represented reasonably well in this format, except for the thermal expansion coefficient, which appears as zero. All of the cross section properties also appear as zeros, therefore this format is clearly not suitable for the section properties in this case. |
||
![]() |
||
We could switch the style to Scientific and all of the above zeros would appear as non-zeros. But this would impact on other numerical values in the model that are better displayed in decimal format.
|
||
The Auto Style | ||
A good alternative to the Fixed and Scientific styles is the Auto style with (say) Digits=6 (this is the Factory Defaults setting). The Auto style will display numbers in either decimal format or scientific format depending on the magnitude of the number relative to the value of the Digits parameter. Numbers that can be represented reasonably well in decimal format using the specified digits will appear in decimal format with trailing zeros (after the decimal point) removed. Concurrently, numbers that cannot be represented in decimal format using the specified digits will appear in scientific format.
We can see in the image below that with the default Auto option all numbers are well represented and easy to read, no matter their magnitude (some use decimal format, others use scientific). Additionally, a number that is shown as 0.0 is now guaranteed to be “zero”. We write zero in inverted commas because the parameter Display as zero on the Numbers Formatting dialog determines what will be shown as 0.0. So to be precise, when we now see 0.0, we can guarantee that the number in question has a magnitude smaller than 1.0E-12 (as per the Display as zero value). This option is very useful, particularly in post-processing, as it allows round-off zeros to be easily discarded. Note that the Display as zero value can be set to 0.0 if preferred. |
||
![]() |
||
Additional Information | ||
No matter the number formatting options used, Strand7 never truncates the actual numbers in the model database. It is only the presentation of the numbers that is affected by the options.
The Numbers Formatting dialog has two tabs: |
||
|
The Raised exponents option is used to switch between the two formatting styles as shown at right, depending on user preference.
|
![]() |
|
|