Real Data Type

Holds signed floating-point values that must be a minimum of 64 bits (8 bytes) and gives good performance. On Intel platforms this could be an 80-bit (10-byte) value in the range −1.18973149535723176502E+4932 to −3.64519953188247460253E−4951 for negative values and 3.64519953188247460253E−4951 to 1.18973149535723176502E+4932 for positive values.


Floating-point data types cannot store all values accurately. Operations, such as when values are compared, can cause results that you think are incorrect. See Data Type Troubleshooting for more information.
ViviFire makes sure that when you calculate with Real, they are the fastest for a type at minimum as large as Real64. Platforms for which the fastest floating-point type is smaller than Real64 must use Real64 to be compatible.
Default value
When you declare a variable of type Real and do not initialize it, its default value is zero (0.0).
Type changes
The Real data type widens to Real128 without risk of overflow.
Zeros at the end
The floating-point data types usually cannot show 0 characters at the end, after the decimal point. Thus numbers such as 1.4200 and 1.42 are the same value. If you must show zeros at the end, then you must use a formatter procedure.
Type characters
If you add an exclamation point (!) to the end of a variable name, then it has the type Real.

Real literal

[ integer_part ] . fractional_part [ E [ + | - ] exponent_part ] [ ! ]
integer_part E [ + | - ] exponent_part [ ! ]
integer_part !


One or more decimal digits. You can use an underscore character (_) to divide it into groups of digits.
One or more decimal digits.
One or more decimal digits. Typically the maximum number of digits is three or four.

Shared methods and properties

Real.Default As Real
Returns the default value, 0.0.
Real.Epsilon As Real
Returns the smallest difference between two values.
Real.IsInf(num As Real) As Boolean
Returns true if num is infinity (positive or negative). Mathematical overflow is one cause of this result.
Real.IsNaN(num As Real) As Boolean
Returns true if num is not a number (Nan). “Zero divided by zero” and “square root of a negative” are two causes of this result.
Real.IsNegInf(num As Real) As Boolean
Returns true if num is negative infinity.
Real.IsPosInf(num As Real) As Boolean
Returns true if num is positive infinity.
Real.Max As Real
Returns the maximum positive value.
Real.Min As Real
Returns the minimum negative value.
Real.Parse(str As String, Optional #fmt As Format) As Real
Tries to parse a string that shows as a floating-point number.
If #fmt is not given or is #Null, then it uses the format of the local culture. Or you can be explicit with Format.UserLocale.
If #fmt is Format.RealLiteral, then it uses the format of a literal of type Real.
Real.Size As Int
Returns the number of available bytes. Typical values are 8 or 10.


Dim foo As Real
Dim bar!

See also