STR$ (x#) where x# = float |
Purpose | When the operand x# is a floating-point data, STR$(x#) will return the string representing the data as either regular floating format such as xxx.yyyyy or in scientific notation such as + x.xxxxxxxE+nn, depending on the range of values x# falls into. The following criteria can be used to predict the format of the string that STR$(x#) will return:
Notice that in all formats, number of decimal digit+number of fractional digit = 8. In particular, the scientific notation format only uses the following format: + x.xxxxxxxE+nn i.e. the returned string will always start with a sign, then a single decimal digit followed by 7 fractional digits, an E and then the sign of the exponent, followed by the two digit exponents. The length of the returned string is always14 characters when it returns in scientific notation. Eg. +1.2345000E+10, -9.8763475E-05 This function will return variable significant digit based on the value it evaluated.
For fixed number of significant digit, please refer to the next command STR$(x#, w) |
||||||||||||
Example | A$ = STR$(0.000012345) => A$ = +1.2344999E-05 | ||||||||||||
Comments | A$ did not get the string +1.2345000E-05 as expected because this number cannot be precisely represented by the IEEE single precision format and therefore it is approximated by its closest number +1.2344999E-05. |