Android Question How do i write this formula in b4a?

Discussion in 'Android Questions' started by Sub7, Jul 22, 2015.

  1. Sub7

    Sub7 Active Member Licensed User

    result = 100 / 150(m2)


    Divide the first numer for the square of the second number expressed in meters, sorry for the dumb question.


    100 / 150(150^2) give me an error, ofc


    Thanks
     
  2. Roycefer

    Roycefer Well-Known Member Licensed User

    Exponentiation is performed as such:
    Code:
    result = 100/Power(150,2)
    Java calculations (and by extension, B4A calculations) aren't unit-aware (at least by default). You're going to have to keep track of units and conversions manually or use a unit-aware library.
     
    lemonisdead, DonManfred and mangojack like this.
  3. Sub7

    Sub7 Active Member Licensed User

    Thank you.
     
Loading...