I am not using this in lisp but I figured this would be the place to ask. Is there a math equation that will return an integer from an unknown real? -- Ken Alexander Acad2004 Windows XP "We can't solve problems by using the same kind of thinking we used when we created them." --Albert Einstein
Hi Ken, Do you mean: If UnknownObject is a real then return 1, if not return 0 ? or can you strip the decimal portion of the number leaving the digit part only ? or can you round the number to the nearest whole number ? The answer to all three is yes, but to allow readers to tell you how you need to clarify the question. Laurie Comerford CADApps www.cadapps.com.au
You have N=a.b (275.6833) and you want a or b (275 or 6833)? All programming languages (including vlisp) have at least one such function. What you want, I think, is an algebraic method. No can do, sorry. If you get into infinite series you can write a function that will limit to a or b. Alternatively, you can state "N mod a = b" and quiet any party. rs
Hi Laurie, Yes, I need to strip the decimal portion leaving an integer. This needs to be done with a math equation not a programming function. Thanks, -- Ken Alexander Acad2004 Windows XP "We can't solve problems by using the same kind of thinking we used when we created them." --Albert Einstein
(Hey,Ken! Long time since we passed notes!) Look for the Greatest Possible Integer... by definition, drops anything beyond the decimal. Since this is a real simple operation, someone must have done it in LISP by now. (I'd try Jurg's code... he has helped me a bit in the past... and that's not to say other contributions here don't work... just I haven't time to test and render opinion) regards!
Bob, "Mod" was the ticket, Thanks a bunch. -- Ken Alexander Acad2004 Windows XP "We can't solve problems by using the same kind of thinking we used when we created them." --Albert Einstein
You are satisfied -- which is the bottom line. But, a little demurrer, "mod" is not an algebraic process, so the question "Is there a math equation that will return an integer from an unknown real?" is not really satisfied. In other words, x=3 mod 2 cannot be solved by algebraic means. rs
It looks as though I have not have worded my needs correctly. I've never heard of mod before today. So happens it fulfilled my needs for today. I'm sure there will be more later. Thanks for taking the time to respond to all. -- Ken Alexander Acad2004 Windows XP "We can't solve problems by using the same kind of thinking we used when we created them." --Albert Einstein