Modulo function

New Here ,
Mar 08, 2021 Mar 08, 2021

Copy link to clipboard

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

translate

Translate

Translate

Report

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

Copy link to clipboard

Copied

It does. It's the % operator.

Run this code:

16 % 5

And it will return 1.

Likes

translate

Translate

Translate

Report

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

Copy link to clipboard

Copied

See this example, maybe you find something useful.

https://drive.google.com/uc?export=download&id=19NWjx84M0jnkPufMLdlobVMRM7yn2ksa 

Likes

translate

Translate

Translate

Report

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