B4i Library [class] DecimalNumber (similar to B4A BigNumber)

Discussion in 'iOS Libraries' started by Erel, May 9, 2017.

Similar threads

B4A Library [B4X] [class] MJPEG decoder
B4i Library [class] CustomListView
B4A Class [class][B4X] Google OAuth2
B4i Library [class] Table
B4i Library [class] SearchView
  1. Erel

    Erel Administrator Staff Member Licensed User

    This class uses NativeObject to access NSDecimalNumber type. Unlike BigNumber library, the objects are immutable. This means that the value of a DecimalNumber instance cannot change. A new value can be assigned.

    Usage example:
    Code:
    Dim dm1 As DecimalNumber = CreateDecimal("123.11111111111111111111")
    Log(dm1.Add(CreateDecimal("0.22222222222222222222")).ToString)
    Log(CreateDecimal(2).Multiply(CreateDecimal(10)).ToString)
    Log(CreateDecimal(100).Divide(CreateDecimal(10)).Subtract(CreateDecimal(5)).ToString)

    Sub CreateDecimal(Value As StringAs DecimalNumber
       
    Dim dm As DecimalNumber
       dm.Initialize(Value)
       
    Return dm
    End Sub
     

    Attached Files:

    Johan Hormaza and Emme Developer like this.
  2. Emme Developer

    Emme Developer Well-Known Member Licensed User

    Thanks Erel, that's great as Always!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice