Perifanos Posted March 8, 2013 Posted March 8, 2013 Why this simple command is not working? (setq p (* (/ 1 12.0) e)) e=16.9988 (Returns p=0.0 ) Quote
BIGAL Posted March 9, 2013 Posted March 9, 2013 simple / 1.0 12.0 lisp takes literally integer and real if not careful Quote
Bill Tillman Posted March 9, 2013 Posted March 9, 2013 Can you clue us in on how you're setting the value for 'e'? The only way this would evaluate is if 'e' is = 0. Perhaps it's value is left over from another run? Quote
Perifanos Posted March 9, 2013 Author Posted March 9, 2013 it ok, 1.0 made the trick. It is funny how lisp handles some things...I will get used to it. Another one: (defun roundnum (a n /) (/ (float (fix (* a (expt 10 n)))) (expt 10 n)) ) ... (setq p (* (/ 1.0 12.0) e)) (princ (strcat "\mpla mpla mpla " (rtos (roundnum (p 2))) " m[2]")) Throws "error: bad function:" Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.