Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VbScript to Javascript Math Problem

    Can anyone tell me why when I convert this vbscript code to javascript I get infinity rather than 0.876794146362291?

    VbScript:
    GetBase = (1 - (1 + 0.00583333333333333) ^ -360)
    Results to 0.876794146362291

    Javascript:
    Math.pow(1 - (1 + 0.00583333333333333), -360);
    Results to Infinity

  • #2
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lisbon, CT
    Posts
    339
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you want them to be equivalent rewrite it like this:

    1 - Math.pow(1 + 0.00583333333333333, -360);

    BaldEagle

  • #3
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Works

    Thanks


  •  

    Posting Permissions

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