Code Red > AutoLISP (Vanilla / Visual)
TEXT to REAL..
Andrea:
Sorry, I know I have posted something similar few days ago..
but I can find a way to have the precision of 8 digit after the point.
I have this...
(setq a "2.06112265" )
I need to transform to REAL...
(read a) = 2.06112
(atof a) = 2.06112
How can I get the precision...in REAL... :oops:
note: my LUPREC variable is set to 8
Keith™:
The value is only displayed truncated ... the value is correct in the variable .. to test it, try this:
--- Code: ---(setq a "2.06112265")
!a
"2.06112265"
(setq b (distof a))
2.06112
!b
2.06112
(rtos b 2 8)
"2.06112265"
--- End code ---
Andrea:
--- Quote from: Keith on November 11, 2005, 12:09:04 PM ---The value is only displayed truncated ... the value is correct in the variable .. to test it, try this:
--- Code: ---(setq a "2.06112265")
!a
"2.06112265"
(setq b (distof a))
2.06112
!b
2.06112
(rtos b 2 8)
"2.06112265"
--- End code ---
--- End quote ---
thanks Keith..
but ho can I divide 1 by b ??
Keith™:
--- Code: ---(setq c (/ 1.0 (distof b)))
--- End code ---
Andrea:
--- Quote from: Keith on November 11, 2005, 01:41:15 PM ---
--- Code: ---(setq c (/ 1.0 (distof b)))
--- End code ---
--- End quote ---
Keith...
b is alraydy in REAL...I think you want write this..
--- Code: ---(setq c (/ 1.0 b))
--- End code ---
but the result is..
0.485172
and must be 0.485172486
also, if i write
--- Code: ---(rtos c 2 8)
--- End code ---
I obtain this result..."0.48517249"
not better..
I need to do this..
(/ 1 "2.06112265")
to have the exact result....
"0.485172486"
Navigation
[0] Message Index
[#] Next page
Go to full version