Fixed128
Data Type
Holds signed 128-bit (16-byte) fixed-point values with a default maximum of 29 digits to the left of the decimal point and 10 to the right. That is a range of −17,014,118,346,046,923,173,168,730,371.5884105728 – +17,014,118,346,046,923,173,168,730,371.5884105727.
Instructions
- Default value
- When you declare a variable of type
Fixed128
and do not initialize it, its default value is zero (¤0.0). - Automatic conversions
Fixed128
widens toReal32
,Real64
, orReal128
without risk of overflow.- Type characters
- You can put the suffix
d128
(orD128
) on the end of a number literal. But there are no type characters for names.
Fixed128 literal
prefix integer_part [ . fractional_part ]
or
integer_part [ . fractional_part ] suffix
Parts
prefix
- One of these symbols: at-symbol (
@
) or currency symbol (¤
). You can optionally follow the at-symbol with the currency symbol of a given culture. Examples include$
,€
,£
, and¥
. - these symbols are ignored by the compiler. If you use a symbol, use the same one in all of your code.
integer_part
- One to 38 decimal digits.
For the default number of decimal digits, the maximum is 29 digits.
You can use an underscore (
_
) to divide it into groups of digits. fractional_part
- One to 39 decimal digits. For the default number of decimal digits, the maximum is 10 digits. All digits after that are ignored.
suffix
- One of these: the at-symbol (
@
) or the type suffixd128
. You can also write the type suffix asD128
.
Constructors
Fixed128(Optional digits As Int32 = 10)
digits
specifies the number of digits to the right of the decimal point. It must be between 1 and 39. The default is 10.
Shared methods and properties
Fixed128.Default As Fixed128
- Returns the default value,
¤0.0
. Fixed128.Epsilon(Optional x As Fixed128) As Fixed128
- Returns the smallest value more than ¤0.0.
If
x
is not given, it returns ¤0.0000000001. Fixed128.Max(Optional x As Fixed128) As Fixed128
- Returns the largest positive value for
x
. Ifx
is not given, it returns¤17_014_118_346_046_923_173_168_730_371.5884105727
. Fixed128.Min(Optional x As Fixed128) As Fixed128
- Returns the smallest negative value for
x
. Ifx
is not given, it returns-¤17_014_118_346_046_923_173_168_730_371.5884105728
. Fixed128.Parse(str As String, Optional #format As Format) As Fixed128
- Tries to parse a string that shows as a number.
- If
#format
is not given or is#Null
, it uses the format of the local culture. Or you can make it clear withFormat.UserLocale
. Fixed128.Size As Int32
- Returns the number of available bytes. This is always 16.
Examples
Dim price As Fixed128 = @$1_199.99