Drawing a logarithmic histogram

Discussion in 'C Programming' started by Andre, Jul 16, 2003.

  1. Andre

    Andre Guest

    Hi,

    I'm trying to plot a histogram on some data that I receive at runtime.
    I'm trying to measure distances between two points, and these distances
    can be from the range 1 to 5000000. I want to use a logarithmic scale
    with a range -2^29 to +2^29. How can I determine at any point in time
    which strata (i.e which cohort or portion of scale) the value belongs to
    (without using the square or square-root functions)?

    I could have mask-bits of all possible scales, such as 2^2, 2^3, 2^4
    upto 2^29 and AND each of these with the value to figure this out but is
    there a cleaner way of doing this?

    Thanks a lot.

    --Andre
     
    Andre, Jul 16, 2003
    #1
    1. Advertising

  2. "Andre" <> wrote in message
    news:...

    > I'm trying to plot a histogram on some data that I receive at runtime.
    > I'm trying to measure distances between two points, and these distances
    > can be from the range 1 to 5000000. I want to use a logarithmic scale
    > with a range -2^29 to +2^29. How can I determine at any point in time
    > which strata (i.e which cohort or portion of scale) the value belongs to
    > (without using the square or square-root functions)?


    Log graphs will not have negative numbers in the range ( or is it domain?).

    Maybe you meant 2**(-29). (Note that the ^ operator has a different meaning
    in C.)

    I would think that log() would be useful. If more than one dimension, you
    would also want sqrt().

    -- glen
     
    Glen Herrmannsfeldt, Jul 17, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Derek Basch

    Matplotlib logarithmic scatter plot

    Derek Basch, Feb 27, 2006, in forum: Python
    Replies:
    9
    Views:
    4,945
    evander21
    Nov 3, 2010
  2. Derek Basch
    Replies:
    8
    Views:
    423
    Fredrik Lundh
    Feb 28, 2006
  3. different

    logarithmic interpolation

    different, Jan 18, 2007, in forum: C Programming
    Replies:
    6
    Views:
    952
    Zbigniew Karno
    Jan 19, 2007
  4. different

    logarithmic interpolation

    different, Jan 18, 2007, in forum: C++
    Replies:
    5
    Views:
    3,845
    Zbigniew Karno
    Jan 19, 2007
  5. Sunny

    Logarithmic scale

    Sunny, Sep 25, 2008, in forum: Javascript
    Replies:
    8
    Views:
    154
    Bart Van der Donck
    Sep 28, 2008
Loading...

Share This Page