Cubic root

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Philip KOCH

    Cubic root

    I'm trying to calculate the cubic root of a fonction, what syntax should I
    use?

    Thanx
    PHIL


  • Lasse Reichstein Nielsen

    #2
    Re: Cubic root

    "Philip KOCH" <philonline78@h otmail.com> writes:
    [color=blue]
    > I'm trying to calculate the cubic root of a fonction, what syntax should I
    > use?[/color]

    A cubic root would be the same as raising to the 1/3rd power. You can make
    your own cubicRoot function:

    function cubicRoot(n) {
    return Math.pow(n,1/3);
    }

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Dr John Stockton

      #3
      Re: Cubic root

      JRS: In article <3fb033f6$0$428 8$ba620e4c@read er3.news.skynet .be>, seen
      in news:comp.lang. javascript, Philip KOCH <philonline78@h otmail.com>
      posted at Tue, 11 Nov 2003 01:57:24 :-
      [color=blue]
      >I'm trying to calculate the cubic root of a fonction, what syntax should I
      >use?[/color]

      One that allows the argument to be negative.

      function cubeRoot(X) {
      return (X<0 ? -1 : +1) * Math.pow(Math.a bs(X), 1/3) }

      --
      © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
      <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
      <URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
      <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.

      Comment

      Working...