Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Integer division and reminder of division for fields formulas.

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
615 Views, 2 Replies

Integer division and reminder of division for fields formulas.

Hello.

As you may know it is possible to use some calculation results in the text fields.

timchishinevgeniy_0-1604259183203.png

For example here I divide 5 by 2 and get 2.5. 

Do somebody know if it is possible to get integer division result and also the reminder of the division?

Fox example:

Integer division: 5 // 2 = 2

Reminder of division: 5 % 2 = 1

Are there some operators or functions for that?

2 REPLIES 2
Message 2 of 3
cadffm
in reply to: Anonymous

If REM isn't a valid function, you can use TRUNC

 

2.5 - trunc 2.5 = 0.5

 

EDIT:

In your sample case

5-trunc(5/2)*2 = 1

 

or

17-trunc(17/2)*2 = 1
11-trunc(11/3)*3 = 2

 

Or?

 

Sebastian

EESignature

Message 3 of 3
Anonymous
in reply to: cadffm

"trunc" is perfect, thanks!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta