Message 1 of 6
Can someone quickly explain why "rtos" rounds and minuses potential string characters?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Working on a simple calculation lisp here and I ran into an issue I don't understand. I was always under the impression that "rtos" took a real number exactly for what it was and made it into a string, apparently it does not. How come if I take the following code:
(defun c:test\ ( / upstr dwnstr dist calc )
(setq upstr 390.17)
(setq dwnstr 380.17)
(setq dist 112.73)
(setq calc (/ (- upstr dwnstr) dist))
(princ calc)
(princ)
)I get 0.0887075 but if I add the following rtos function:
(defun c:test\ ( / upstr dwnstr dist calc )
(setq upstr 390.17)
(setq dwnstr 380.17)
(setq dist 112.73)
(setq calc (rtos (/ (- upstr dwnstr) dist)))
(princ calc)
(princ)
)my new result is .0887
how come rtos gets rid of my initial "0" and whatever is after the 4th character? where is the "075" at the end? why isn't it a literal translation? what if I need to work with the entire real number result as a string how would I truly get it?
Any insight is appreciated.