Android Question Using BigNumbers

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi All,

I am trying to implement a NOT function on a string number, but it returns errors for anything > 7FFFFFFF using Bit.Not as Bit.Not operates Integer values [Signed 4 bite]

I have added BigNumbers to the libraries and have tried the following code.

B4X:
Dim Disp As String
Dim NOT As BigInteger

Sub NOTFunction
'Stuff ,,,
    'Disp = Bit.Not(Disp)
    Disp = Not(Disp)

' More stuff ..
End Sub

When I attempt to compile I get the following Error Message.

Parsing code. Error
Error parsing program.
Error description: Unknown type: not
Are you missing a library reference?
Occurred on line: 32
Dim Not As BigInteger

I have obviously missed something.

Thanks in advance

Regards Roger
 

stevel05

Expert
Licensed User
Longtime User
NOT is a keyword, you can't use it as a variable name.
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Steve105,

Makes sense. I thought it looked wrong. I still have a problem as to the correct syntax. Changed code to the following:

B4X:
Dim Disp As String
Dim BIGBit As BigInteger

Sub NOTFunction
'Stuff ,,,
    'Disp = Bit.Not(Disp)
    Disp = BIGBit.Not(Disp)

' More stuff ..
End Sub

I get the following:
Parsing code. 0.17
Compiling code. Error
Error compiling program.
Error description: Array expected.
Occurred on line: 3312
Disp = BIGBit.Not(Disp)
Word: (

The BigNumbers Manual gives this info:

15.png
Not As BigInteger

Sets this BigInteger to a value that is NOT(this). The result of this operation is -this-1.
Returns itself.

I am still missing something. Can anyone give me a clue to the correct syntax when replacing Bit.Not() with the BigNumbers equivelent.

Regards Roger
 
Upvote 0
Top