locked
invalid floating point operation RRS feed

  • Question

  • Hi, I think this should be a very basic question.  Anyways, when trying to run the script:

    -------------------

    Sub Main ()
    BeginHide
     StoreDoubleParameter "a", 1.0
     StoreDoubleParameter "b", 5.0
    EndHide
    Dim c As Double
    c = Log(a+1.0)/(b/2.0)
    d = c
    MsgBox d
    End Sub

    -------------------

    I get an "invalid floating point operation" error, and the line "c = Log(a+1.0)/(b/2.0)" gets highlighted.  Then, without making any changes whatsoever, I run the script again, and it works perfectly, outputting the value 0.2773...  How can I fix this, so that it works right the first time?

    Monday, May 3, 2010 8:11 AM

Answers

  • The equivalent code in Visual Basic is

        Dim A As Double = 1.0
            
    Dim B As Double = 5.0
            
    Dim c As Double
            c = Math.Log(A + 1.0) / (B / 2.0)
            
    Dim D As Double = c
            MsgBox(D.ToString)

    That code works fine. You may wish to consider using Visual Basic for your application.

    • Proposed as answer by Cor Ligthert Monday, May 3, 2010 10:33 AM
    • Marked as answer by Liliane Teng Friday, May 7, 2010 9:26 AM
    Monday, May 3, 2010 9:10 AM