Hello everyone.
Format in the AHNumeric object, receives a value of type Double (~ 15 digits)
When the formatted number is greater than 15 digits, it is rounded (modified)
Is there a way to use this function with numbers of 18 or more digits?
Thanks in advance...
Format in the AHNumeric object, receives a value of type Double (~ 15 digits)
Code:
...
Dim data As String
data = "9999999999999.99"
Log(nf.Format(data)) 'RESULT: 9.999.999.999.999,99 OK
data = "99999999999999.99"
Log(nf.Format(data)) 'RESULT: 99.999.999.999.999,98 formatted and modified
data = "999999999999999.99"
Log(nf.Format(data)) 'RESULT: 1.000.000.000.000.000 formatted and rounded
data = "899999999999999999.99"
Log(nf.Format(data)) 'RESULT: 900.000.000.000.000.000 formatted and rounded
...
Sub SetFormatChars(Grouping As Char, DecimalSeparator As Char) As AHNumeric
Dim loc As AHLocale
loc.InitializeUS
Dim jloc As JavaObject = loc
jloc = jloc.GetField("myLocale")
Dim nfs As AHNumeric
nfs.InitializeNumber2(loc)
Dim r As Reflector
r.Target = nfs
Dim dfs As JavaObject
dfs.InitializeNewInstance("java.text.DecimalFormatSymbols", Array(jloc))
dfs.RunMethod("setGroupingSeparator", Array(Grouping))
dfs.RunMethod("setDecimalSeparator", Array(DecimalSeparator))
Dim jo As JavaObject = r.GetField("mNumberFormat")
jo.RunMethod("setDecimalFormatSymbols", Array(dfs))
Return nfs
End Sub
When the formatted number is greater than 15 digits, it is rounded (modified)
Is there a way to use this function with numbers of 18 or more digits?
Thanks in advance...