Author Topic: Two equal Real Variables are showing as not equal  (Read 1611 times)

0 Members and 1 Guest are viewing this topic.

mbrandt5

  • Newt
  • Posts: 44
Two equal Real Variables are showing as not equal
« on: March 12, 2020, 06:20:35 PM »
Hey all,

I am getting a pretty weird glitch on an autolisp command I am working on here. 
I have two variables that are both listed as reals, and the watch is clearly showing that they are both equal.
Though with I compare them it is showing them as not equal. 
I have attached an image depicting the watch list error, and listed below what the watch list is showing.
Any idea how or why this could occur?

Watch list:
(CADR BPT21) = 261.994
(CADR VBOP1A) = 261.994
(= (CADR VBOP1A) (CADR BPT21)) = NIL



Rod

  • Newt
  • Posts: 185
Re: Two equal Real Variables are showing as not equal
« Reply #1 on: March 12, 2020, 07:01:50 PM »
The watch window truncates the decmial places
Try "equal" instead of "=" with a fuzz
The fuzz is a real number defining the maximum amount by which expr1 and expr2 can differ and still be considered equal.

(equal (CADR VBOP1A) (CADR BPT21) 0.001)

Cheers, Rod.
"All models are wrong, some models are useful" - George Box

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Two equal Real Variables are showing as not equal
« Reply #2 on: March 12, 2020, 07:52:23 PM »
You may wish to refer to this related thread.