www.webdeveloper.com
Results 1 to 3 of 3

Thread: How to raise a number to a fractional power

  1. #1
    Join Date
    May 2008
    Posts
    16

    How to raise a number to a fractional power

    Hi,
    Is there a function or a relatively simple way of raising a number to a power with a fractional exponent by using javascript?
    I am trying to make a simple online calculator which among other things has to raise to power 3/7 a number entered by a user.
    Thanks,
    Lzr

  2. #2
    Join Date
    Dec 2010
    Posts
    207
    Quote Originally Posted by lzr View Post
    Hi,
    Is there a function or a relatively simple way of raising a number to a power with a fractional exponent by using javascript?
    I am trying to make a simple online calculator which among other things has to raise to power 3/7 a number entered by a user.
    Thanks,
    Lzr
    Code:
    alert( Math.pow( 2, 3 / 7 ) )

  3. #3
    Join Date
    May 2008
    Posts
    16
    clueful,
    Thanks. I did not realize Math.pow can use a fractional exponent. Somehow in all examples I saw it was integer.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles