real numbers are automatically rounded !!

real numbers are automatically rounded !!

Kh.mbkh
Advocate Advocate
805 Views
3 Replies
Message 1 of 4

real numbers are automatically rounded !!

Kh.mbkh
Advocate
Advocate
when the number of digits exceeds 6, the real is automatically rounded!! so the value of number is lost!
Any idea.


Capture.PNG
0 Likes
Accepted solutions (2)
806 Views
3 Replies
Replies (3)
Message 2 of 4

devitg
Advisor
Advisor

@Kh.mbkh  The value are not lost, it are not show. 

There is a variable system that control it . 

I do not know which is 

 

Message 3 of 4

CodeDing
Advisor
Advisor
Accepted solution

@Kh.mbkh ,

 

Reaffirming that your values are not lost. It is an automatic limitation imposed so that the command history does not get filled with unnecessary junk when not needed or requested.

 

Here, you can check your values by converting them to strings and showing your 4 decimal places:

Command: (setq A '(669845.1296 437575.8351))
(669845.0 437576.0)
Command: (mapcar '(lambda (x) (rtos x 2 4)) A)
("669845.1296" "437575.8351")

 

Best,

~DD

0 Likes
Message 4 of 4

ronjonp
Mentor
Mentor
Accepted solution

They are not rounded it's how they are shown in the command line .. try this:

 

(setq a '(669854.1296 437576.8351))
(defun b (n) (print (vl-string-right-trim "0" (rtos n 2 16))))
(mapcar 'b a)
;;("669854.1296000001" "437576.8351") 

*Too slow

 

0 Likes