NOT EQUAL

NOT EQUAL

cadking2k5
Advocate Advocate
1,612 Views
15 Replies
Message 1 of 16

NOT EQUAL

cadking2k5
Advocate
Advocate

One time the /= works and the next time it don't angln2 is equal to 1.5708

(if

(and

(/= angln2 0)

(/= angln2 (cvunit 90 "DEGREE" "RADIAN")))

(progn

(setq an2 angln2)

(setq an2s ln2s)

(setq an2e ln2e)

)

)

this /= sims to work

(if
    (and
    (/= angln4 0.0)
    (/= angln4 (cvunit 90 "DEGREE" "RADIAN")))
    (progn
    (cond
    ((null an1)
    (setq an1 angln4)
    (setq an1s ln4s)
    (setq an1e ln4e)
    )
       ((null an2)
    (setq an2 angln4)
    (setq an2s ln4s)
    (setq an2e ln4e)
    )
    )
      )
    )

0 Likes
1,613 Views
15 Replies
Replies (15)
Message 2 of 16

john.uhden
Mentor
Mentor

Here we go again.  There has been a spate of this recently.  Real numbers can go on and on and on and on (like Billy Joel) after the decimal point, to the extent that two numbers that appear equal  are not after 6, or 7, or 12 decimal places.  That is why we must use the equal function that includes an optional fuzz value.  For instance (= pi 3.14159) will return nil, but (equal pi 3.14159 1e-5) will return T.  This leaves it up to the programmer to specify what value is "close enough."  It sort of fits with the industry standard that I don't have to set proposed dimensions or grades to 16 decimal places.

(equal 3.125 3.12 0.1) is good enough to build most anything residential or commercial.  Of course that depends on the units.  If the units were light-years, you might want to make the decimal precision a little tighter lest you be off by a few thousand miles.

 

As to angles, remember that 359°53'47" is very close to 0°10'13".

John F. Uhden

Message 3 of 16

cadking2k5
Advocate
Advocate

I can't use Equal on /= Not Equal

0 Likes
Message 4 of 16

john.uhden
Mentor
Mentor

Yes you can...

 

(not (equal this that fuzz)).

John F. Uhden

Message 5 of 16

kpennell
Collaborator
Collaborator

Interesting though that the following condition returns false/nil.

 

(and (= (getvar "USCXDir") (getvar "UCSXDir")))

 

I was troubleshooting my 'setq' of the UCSXDir variable to the current state of the UCSXDir variable, expecting it to be true.  When I used above to test it, I was like, WTF.

 

Sorry you had to explain this again. 🙂

0 Likes
Message 6 of 16

pbejse
Mentor
Mentor

for one thing

(getvar "USCXDir")

(getvar "UCSXDir"))

 

fuzz

Type: Integer or Real

A real number defining the maximum amount by which expr1 and expr2 can differ and still be considered equal.

 

Equal (Autolisp) 

 

 

0 Likes
Message 7 of 16

ВeekeeCZ
Consultant
Consultant

Guess your issue isn't the fact that you have the sysvar misspelled in one case... but you're pointing out that you cannot compare lists by simple = comparison.

 

(= '(1) '(1)) is F

(equal '(1) '(1)) is T

 

Edit: More colores added (seeing @pbejse's reply... I felt like there is something important missing... 🤓 )

 

Again, seeing @pbejse're reply, HERE  is the link to help that explains the lisp comparison thing. (as 'eq is the same function as '= ... not sure if that's noted somewhere in help though)

Message 8 of 16

kpennell
Collaborator
Collaborator

Typed this in, in a rush.  Yes my code to troubleshoot was indeed correct.

0 Likes
Message 9 of 16

pbejse
Mentor
Mentor

 

You gotta have colors @Z9E3zK5E, otherwise there's no point to keep on doing all this. 

 😁

Message 10 of 16

pbejse
Mentor
Mentor

@kpennell wrote:

Typed this in, in a rush.  Yes my code to troubleshoot was indeed correct.


Yes I know kpennel. You know that I know you know, but I want you to know that I know you know I know you know I know. It’s important for you to know that, you know?

 

 

 

 

Message 11 of 16

kpennell
Collaborator
Collaborator

'Ah yes, the mess-ers become.............. the mess-ies.'

 

That should date me.

0 Likes
Message 12 of 16

ВeekeeCZ
Consultant
Consultant

@pbejse wrote:

@kpennell wrote:

Typed this in, in a rush.  Yes my code to troubleshoot was indeed correct.


Yes I know kpennel. You know that I know you know, but I want you to know that I know you know I know you know I know. It’s important for you to know that, you know?

 


IMHO This is a reply where colores are missing for sure. Applying a wide variety of colores to clearly distinguish stress on things which are important to know and which are less and which are not important at all... That would be a legit tool to be used on... or have you run out of colores? 

0 Likes
Message 13 of 16

pbejse
Mentor
Mentor

@ВeekeeCZ wrote:

is a reply where colores are missing for sure. Applying a wide variety of colores to clearly distinguish stress on things which are important to know and which are less and which are not important at all... That would be a legit tool to be used on... or have you run out of colores? 

Doh!  You are right, I left out the colors where it matters most.

doh.jpg

 

 

 

0 Likes
Message 14 of 16

roland.r71
Collaborator
Collaborator

😀LOL.

 

Colors matter!

Well I did notice I actually can't use colors where they matter most anymore 

Be offline for a while and they change the whole thing. Grrrr.

 

I want to color my code! -or at least color someone's errors using a FAT RED, in code!

(or is it this edgy Microschoft-Edge i'm forced to  use right now 🤔)

 

 

0 Likes
Message 15 of 16

Kent1Cooper
Consultant
Consultant

@roland.r71 wrote:

....

Colors matter!

Well I did notice I actually can't use colors where they matter most anymore 

....

I want to color my code! -or at least color someone's errors using a FAT RED, in code!

....


This has been raised over in the Community Feedback Forum, more than once, for example >here<, in the fourth "bullet" point in Message 1 and various replies referring to that.

Kent Cooper, AIA
0 Likes
Message 16 of 16

john.uhden
Mentor
Mentor
You should have done a spell check. 😂

John F. Uhden

0 Likes