Author Topic: truncated sum  (Read 1283 times)

0 Members and 1 Guest are viewing this topic.

danadrian.baluta@yahoo.co

  • Guest
truncated sum
« on: July 06, 2018, 05:09:59 AM »
Hello,

I don't remember seeing this before.
If i try
Code - Auto/Visual Lisp: [Select]
  1. (+ 500000.0 123.234)
i get
500123.0

If I do the same thing with the CAL command in AutoCAD, i get 500123.234.

How can I get Autolisp to not truncate the sum?

Thank you,
Adrian

kpblc

  • Bull Frog
  • Posts: 396
Re: truncated sum
« Reply #1 on: July 06, 2018, 05:17:06 AM »
Change LUPREC system variable to 4. Or use smth like this:
Code - Auto/Visual Lisp: [Select]
  1. (rtos (+ 5e5 123.234) 2 14)
Sorry for my English.

danadrian.baluta@yahoo.co

  • Guest
Re: truncated sum
« Reply #2 on: July 06, 2018, 05:47:56 AM »
Thank you for the answer.

LUPREC doesn't seem to influence this. It was set to 8.
I tried your trick and it works. But it needed the real number, not the text.
So i decided to give it a go with the truncated numbers. I needed to draw a polyline with these numbers.
To my surprise, the coordinates were correct, with all the decimal places. So it's just a matter of displaying them truncated, not actually truncating them.
Weird.

Thanks,
Adrian

kpblc

  • Bull Frog
  • Posts: 396
Re: truncated sum
« Reply #3 on: July 06, 2018, 05:52:48 AM »
The real value is 500123.234 - you can check it:
Code - Auto/Visual Lisp: [Select]
  1. (* (+ 5e5 123.234) 1e3)
Sorry for my English.