*compressreal()

Changes how real numbers are written to the output deck.

Syntax

*compressreal (flag)

Type

HyperMesh Template Command

Description

This command changes how real numbers are written to the output deck. The default value is 1. If used along with *realprecision, trailing zeros will be converted to blanks after the digits specified by *realprecision. For example, *realprecision(4) forces four digits to be written, even if they are zeros.

Inputs

flag
Trailing zeros are written as blanks.
Zero is not written to the left of the decimal.
In addition to performing compression, this command will add extra significant digits where applicable, while also rounding off precisely at the last digit. The compression is performed in accordance with the following rules and conditions:
This flag is applicable only for output of real numbers using any of the *field commands that have "real" as their first argument, and also have a non-zero width argument. Thus, the command will have no effect on the output produced using *field(exponential,value,8), or *field(real,value,0), for instance.
For values that are either too large or too small such that use of the ‘E’ is necessary to represent the number within the given width, the following conditions are applied:
By default, ‘E’ is omitted, and an extra significant digit is added, if applicable. However, ‘E’ can be output, by passing a custom export string to the command *feouputwithdata. Please refer to the documentation of that command for more details.
Any leading zeros on the exponential part are always omitted. Instead, additional significant digit(s) are output, where applicable.
For values that do not require the use of ‘E’, the following conditions apply:
For a number whose absolute value is less than 1.0, the zero to the left of the decimal point is omitted if doing so results in adding an extra significant digit.
For a whole number whose absolute value is greater than or equal to 1.0, the zero to the right of the decimal point is omitted if doing so results in a more accurate representation of the number within the given width.
Trailing zeros that do not contribute to the accuracy of a number are always replaced with blanks, leaving only one zero, at the most.
This flag also provides a means of rounding off real numbers whose absolute value is within a specified tolerance, to zero. This option is off by default, but can be turned on by passing a custom export string to the command *feoutputwithdata. Please refer to the documentation of that command for more details.

Example

Using *compressreal(1) causes HyperMesh to write numbers such as 0.0000 as 0.0.

Using *compressreal(2) causes HyperMesh to write numbers such as 0.123456 as .123456.

The table below has examples of output obtained using *compressreal(3). The examples assume default options, that is, without the use of the custom strings mentioned above in *feoutputwithdata.

Actual value Output in field of width 8 Output in field of width 16
0.125 0.125 0.125
0.1254768 .1254768 0.1254768
0.12547687 .1254769 0.12547687
0.125476842 .1254768 0.125476842
1.02356E+015 1.024+15 1.02356+15
-1.02356E+015 -1.02+15 -1.02356+15