real variables not equal????

Discussion in 'AutoCAD' started by Ricky M. Medley, Nov 2, 2004.

  1. see below....I am dumbfounded.

    _$ (= 0.075 0.075)
    T
    _$ (setq currentval (vla-get-height att))
    0.075
    _$ (type currentval)
    REAL
    _$ (setq holdval 0.075)
    0.075
    _$ (type holdval)
    REAL
    _$(= currentval holdval)
    nill

    How in the world are they not equal....??

    Ricky M. Medley
    Houston
     
    Ricky M. Medley, Nov 2, 2004
    #1
  2. Ricky M. Medley

    LUCAS Guest

    _$ (= 0.075 0.075)

    T

    _$ (equal 0.0751 0.075)

    nil

    _$ (equal 0.0751 0.075 0.001)

    T
     
    LUCAS, Nov 2, 2004
    #2
  3. Ricky M. Medley

    BillZ Guest

    Try using rtos to check the entire value of the variable.

    Usually you will see something like this:

    Command: (rtos currentval 2 22)
    0.7500000000000000231

    As already stated, equal with a fuzz factor works the best.

    (equal currentval holdval 1e-9)

    Bill
     
    BillZ, Nov 2, 2004
    #3
  4. Excellent guys....
    It's always something small but sensible & logical. I was dealing with a
    scaled attribute, and number probably extends past what I could see.
    Thanks again.

    Ricky M. Medley
    Houston
     
    Ricky M. Medley, Nov 2, 2004
    #4
  5. Ricky M. Medley

    BillZ Guest

    You're welcome.

    Glad to help.


    Bill
     
    BillZ, Nov 2, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.