Bug? Power function errors.

Discussion in 'B4R Bugs & Wishlist' started by tigrot, Jan 30, 2018.

  1. tigrot

    tigrot Well-Known Member Licensed User

    Hi everybody,
    Seems power function's error strikes again. Many years ago I wrote an epilator firmware on a mega32 Atmel in assembly. I found some issue in power function. The results were non ok. Now I find that power(10,2) gives 99 as result. Maybe library is the same?
    Advice: avoid power functions!. You can live without...
  2. klaus

    klaus Expert Licensed User

    How did you test it?
    In B4A the result is 100!
  3. Erel

    Erel Administrator Staff Member Licensed User

    Tested on Arduino Mega:
    Sub Process_Globals
    Public Serial1 As Serial
    End Sub

    Private Sub AppStart
    End Sub
    The result is 100.
    tigrot likes this.
  4. tigrot

    tigrot Well-Known Member Licensed User

    I was not able to reproduce the error. The power was inserted in a larger function. I used to convert a string to an integer value, but in case of number larger than 99 the result was always 1 less the expected result.
    I have already solved using an incremental multiply, but it was a surprize when I saw the log with value 99!
  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