Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to do a round trip with the following string values converting them to real and then back to string. But I'm having trouble with getting 3 of them to successfully get a round trip.
Here's my code:
(setvar dimzin 0)
; set text string list:
(setq txtlst (list "1/16" "1/20" "1/32" "1/40" "1/48" "1/64"))
; perform text string to real number conversion function:
(setq numlst (mapcar '(lambda (x) (distof x 2)) txtlst))
; AutoCAD correctly returns a unique # for each:
; (0.0625 0.05 0.03125 0.025 0.0208333 0.015625)
; perform real number back to text conversion function:
(setq n2tlst (mapcar '(lambda (x) (rtos x 4 6)) numlst))
; AutoCAD returns with 3 mismatches 1/20, 1/40 & 1/48:
; ("1/16\"" "3/64\"" "1/32\"" "1/32\"" "1/64\"" "1/64\"")How can I get back "1/20" "1/40" & "1/48" ?
I've tried increasing the precision from 6 to a higher # but that made no difference:
0.05 will not convert back to "1/20"
0.025 will not convert back to "1/40"
0.0208333 will not convert back to "1/48"
Solved! Go to Solution.