# Real Data Type

Holds signed floating-point values that must be at least 64 bits (8 bytes) and provides the best 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.

## Instructions

- Precision
- Know that floating-point data types cannot represent many values accurately. Operations such as comparisons can cause results that you think are incorrect. See Troubleshooting Data Types for more information.
- Performance
- ViviFire makes sure that calculations with
`Real`

are the fastest for a type at least 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. - Trailing zeros
- The floating-point data types cannot internally represent trailing 0 characters after the decimal point. Thus numbers such as 1.4200 and 1.42 are the same value. If you must show trailing zeros, 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` ] [ `!` ]

or

`integer_part` `E` [ `+` | `-` ] `exponent_part` [ `!` ]

or

`integer_part` `!`

### Parts

`integer_part`

- One or more decimal digits.
You can use an underscore character (
`_`

) to divide it into groups of digits. `fractional_part`

- One or more decimal digits.
`exponent_part`

- 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.

## Examples

```
Dim foo As Real
Dim bar!
```