Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Modulo function

New Here ,
Mar 08, 2021 Mar 08, 2021

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
519
Translate
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
Community Expert ,
Mar 08, 2021 Mar 08, 2021

It does. It's the % operator.

Run this code:

16 % 5

And it will return 1.

Translate
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
Community Expert ,
Mar 08, 2021 Mar 08, 2021
LATEST

See this example, maybe you find something useful.

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

Translate
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