Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6926771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:57:43+00:00 2026-05-27T10:57:43+00:00

This problem is being asked with a node.js server in mind, but I stated

  • 0

This problem is being asked with a node.js server in mind, but I stated the question as “javascript” because I will likely use this same logic for a client-side script, as well.

Here’s the problem: given a set of x values, y needs to scale in a logarithmic way. The Math object performs a natural log [ln(x)], but does not provide an interface for specifying the base of the logarithm.

For a specific example, I need to find the following:

log[512](2)

Which should return .1111~

However, I do not see an interface that allows me to accomplish this, nor can I seem to find a library that exposes an option for the log’s base. Surely this is a common problem and has a solution, but my searching has only found solutions for different/unrelated problems. Ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:57:43+00:00Added an answer on May 27, 2026 at 10:57 am

    You can use the logarithm base change formula:

    log[a](n) = log[b](n) / log[b](a)
    

    So in order to get log(2) base 512, use:

    function log(b, n) {
        return Math.log(n) / Math.log(b);
    }
    
    alert(log(2, 512));
    

    Note that Math.log above uses the natural log base; i.e., it would be written as ln mathematically.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that this question is being asked before but I did not get
ive being trying to cope with this problem but still. I need your help.
This is a problem I've had on my mind for a long time. Being
This problem is similar to my previously asked question. When I query data using
I know this is an oft-asked question/problem. I've looked through a bunch of Q&A
This user asked a similar question but had no viable solution in the answers,
I know this question has been asked several times on SO, but none of
This question was asked in another post at Facebook iframe app being redirected out
Yes this question as already been asked here at SO. The problem is that
I hope that this question has not been asked elsewhere, but I'm having difficulty

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.