log10 function


Results 1 to 8 of 8

Thread: log10 function

Threaded View

  1. #5
    anj's Avatar
    anj Guest


    Did you find this post helpful? Yes | No

    Default

    Gday Dampf

    For logarithms
    log(1/n) = - log(n)
    log(x/y) = log(x)-log(y)
    therefore ( assuming x and y stay integers ) you can rewrite
    result = log10(1/x) - log10(1/y) to use integers only

    using above relationships you get the following
    result = log10(y/x)
    and hence
    result = log10(y) - log10(x) <-use this instead as easier to calc

    I found a nice way to calc logs in base2 which you then convert to baseE / base10 etc as you choose by using a std conversion factor. If you read the "logarithm by calculation" section from
    http://www.emesys.com/BS2math3.htm it explains it very well and gives a BS2 code example that you can modify to suit PBP fairly easily.
    It has a small footprint and appears to work quite well.
    May help you out
    Andrew
    Last edited by anj; - 13th October 2004 at 22:20.

Similar Threads

  1. Single button function
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 40
    Last Post: - 4th April 2020, 18:33
  2. Hash function
    By Ioannis in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 7th September 2007, 10:09
  3. Making a function to set the DS1337 Alarm in C
    By trw01 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 12th February 2006, 17:45
  4. ATAN2(,) function
    By vk2tds in forum PBP Wish List
    Replies: 0
    Last Post: - 25th November 2005, 02:52
  5. Random function - How to limit it ??
    By martarse in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 30th November 2004, 14:05

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts