newer 发表于 2021-1-11 20:18:26

atof does not return the complete number of the input string


问题:
I am trying to convert a string in lisp to a real number using atof and the
number is truncated. Is there a way to get the complete number?

Command: (atof "1234.34456")
1234.34


解答:
The number is not rounded off internally. The number displayed on the command
line is however. This can be seen in the example from the AutoCAD text window
below. rtos is used to get the internal number returned from atof stored in
variable test. You can use the rtos function to get the complete number when
all the digits need to be seen by the user.

Command: (setq test (atof "0.4732223983"))
0.473222

Command: (rtos test 2 10)
"0.4732223983"

/db_自贡黄明儒_ 发表于 2021-1-11 21:20:44

我还是喜欢distof
页: [1]
查看完整版本: atof does not return the complete number of the input string