# Modulo function

New Here ,
Mar 08, 2021 Mar 08, 2021

Copied

I have been using an Acrobat form.

The sum of a group of 16 form fields is totaled and divided by 16. Ex 101 / 16 = 6 remained 5. The integer (6) is multiplied by 3 = 18. The remainder is also multiplied by 3 =15.  This (15/16) rounds up to 1 which is added to the previous value totaling 19.  This final value is use to place the result in one of several groups. A if between 0 and 10, B if between 11 and 20, etc.

Is there a way to automate this operation?  I tried to find if a Modulo function exists in Javascript without success.

101 / 16 = 6.3125.

Int 6.3125 = 6. 6 x 3 = 18

Modulo 6.3125 = .3125.  .3125 x 3 = 0.9375 rounds up to 1

18 + 1 = 19

Thanks for any help.

TOPICS
JavaScript

Views

35

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
2 Replies 2
Most Valuable Participant ,
Mar 08, 2021 Mar 08, 2021

Copied

It does. It's the % operator.

Run this code:

16 % 5

And it will return 1.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 08, 2021 Mar 08, 2021

Copied

See this example, maybe you find something useful.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Resources