Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
about division round
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: about division round (Read 895 times)
0 Members and 1 Guest are viewing this topic.
dussla
Bull Frog
Posts: 297
about division round
«
on:
May 09, 2016, 10:21:28 AM »
hello ~
i need some help ~
( / 200 1000 )
= 0.2
but result
(rtos ( / 200 1000 ) 2 2)
"0"
why "0"
i want 0.2
can you help ~
Logged
ronjonp
Needs a day job
Posts: 7529
Re: about division round
«
Reply #1 on:
May 09, 2016, 10:26:50 AM »
Hint:
Code:
[Select]
( / 200. 1000. )
Also look into the
FLOAT
function.
«
Last Edit: May 09, 2016, 10:43:28 AM by ronjonp
»
Logged
Windows 11 x64 - AutoCAD /C3D 2023
Custom Build PC
JohnK
Administrator
Seagull
Posts: 10648
Re: about division round
«
Reply #2 on:
May 09, 2016, 10:37:15 AM »
Floating point / Decimal division.
Code - Auto/Visual Lisp:
[Select]
(
foreach
mode '
(
1
2
3
4
5
)
(
write-line
(
strcat
"RTOS "
(
rtos
mode
)
": "
(
rtos
(
/
100.0
2000.0
)
mode
)
)
)
)
EDIT: See ronjonp's post above mine.
Logged
TheSwamp.org
(serving the CAD community since 2003)
Member location map - Add yourself
Donate to TheSwamp.org
dgorsman
Water Moccasin
Posts: 2437
Re: about division round
«
Reply #3 on:
May 09, 2016, 02:42:37 PM »
Slightly more detail - when you provide two integers to the LISP math functions, it returns an integer. If at least one of the arguments is a floating point, the return value is also floating point.
Logged
If you are going to fly by the seat of your pants, expect friction burns.
try {GreatPower;}
catch (notResponsible)
{NextTime(PlanAhead);}
finally
{MasterBasics;}
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
about division round