i got two lists which has the insertion point and the end point
ex ins_pt (-3.5432 4.5678)
end_pt (-3.5432 4.5678)
When i use (equal ins_pt end_pt) it returns nil.
Is there any other way to compare both lists and return T.
Thanks,
Jayasree
i got two lists which has the insertion point and the end point
ex ins_pt (-3.5432 4.5678)
end_pt (-3.5432 4.5678)
When i use (equal ins_pt end_pt) it returns nil.
Is there any other way to compare both lists and return T.
Thanks,
Jayasree
Hi jayasree,test it
Code:(setq ex_ins_pt '(-3.5432 4.5678)) (setq end_pt '(-3.5432 4.5678)) (if (equal ex_ins_pt end_pt 0.0001) (princ "\nThat right,it's same value") (princ "\nThat wrong,it's not same value") )Originally Posted by jayasree
If your points are calculated, you may think they're equal but they may differ in the 16th decimal point. You may want to use a fuzz factor, as in (equal PtA PtB 0.0000001)
If my memory is correct equal is used for comparing list and eq for
variables.
So using the two points above in the following will yield true:
(setq ins_pt '(-3.5432 4.5678)
end_pt '(-3.5432 4.5678))
(if (equal ins_pt end_pt)
(princ "\nThey are equal ")
(princ "\nThey are not equal")
)
(princ)
Also try with two lists that are not exactly the same with the optional
fuzz input variable of equal:
(setq ins_pt '(-3.5432 4.567)
end_pt '(-3.5432 4.566))
(if (equal ins_pt end_pt 0.005)
(princ "\nThey are equal ")
(princ "\nThey are not equal")
)
Hope this helps comparing lists