Problem with counting huge numbers

madmax2012

New Member
Licensed User
Longtime User
Hi there !

I have a problem with counting huge numbers:

here is part of the app code:

.....
Sub Globals
Dim Number1 As Long :Number1= -50000000
Dim Number2 As Long :Number2= 21000000
Dim Label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("sejw")
Label1.Text = Number1 + Number2
End Sub
.....

and the result in Label1 is : -2.9E7

How to get "normal" number ?

Please help :)
 

jls890

Member
Licensed User
Longtime User
round2

Hi!
I am having a problem with round2 function and big numbers, in scientific notation.

I use this
RESULT1.Text=Round2(RESULT1.Text,Abs(14-Logarithm(Abs(RESULT1.Text),10)))

the decimal logarithm is to know how many digits the number has on the left of the decimal point. So the number is rounded to 14 - this number.
But if the number is in scientific notation and is bigger than, for example, 10^20, I got wrong results.
Now I am using Ifs to avoid such numbers, but is there a better way to do this?
Thank you very much!


P.S. This NumberFormat(, 1, 0) you are talking about seems to convert a number from Scientific notation to standart notation. This could be the solution for my problem.:) But how do I convert back? I have read the manual and it talked about MinimumIntegers, MaximumFractions, no example in SN, I did not understand...
 
Last edited:

klaus

Expert
Licensed User
Longtime User
I am having a problem with round2 function and big numbers, in scientific notation.
What kind of numbers are you using and where do they come from ?

When you are using numbers you should use number variables and these don't have any notation.
Then when you want to display them you could do whatever you want or need.
In your case the content of RESULT1.Text is a String not a number.
The display in RESULT1.Text is already converted internally by the system from a number to a string with a certain algorithm and big numbers are displayed in scientific notation.
Could you give concrete examples with what numbers you want to display how.

Best regards.
 
Top