Results 1 to 13 of 13

Thread: [RESOLVED] Evaluation problem

Threaded View

  1. #8
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Evaluation problem

    Your main problem is that "^" is not the Exponentiation Operator in javascript (it's a bitwise XOR operation so the results you're seeing are, in fact, quite correct) . I don't believe there is a native exponentiation operator in javascript and you'd normally use the Math.pwr function. (which wont work with the MSScript control's Eval Method) Any particular reason you're using javascript as opposed to vbscript ?

    Code:
    Temp = ScriptControl.Eval("2 * 3")
    works fine

    EDIT: as does
    Code:
    MSScriptControl.Language = "vbscript"
    Dim Temp As Double
    Temp = MSScriptControl.Eval("2^5")
    Debug.Print Temp
    @JM: The Eval Method of MSScript expects a valid expression in a string as the argument.
    Last edited by Doogle; Aug 3rd, 2012 at 02:04 AM. Reason: Modified first statement

Posting Permissions

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



Click Here to Expand Forum to Full Width