Jump to content

Very easy Java math question


Recommended Posts

Integer rounding is a pain.

 

 

I wonder how modular arithmetic works on computers....

 

I would think it would simply be:

 

b*(a/b) + a%17

 

Would turn into:

 

b*ceil(a/b) + b(a/b - ceil(a/b))

 

 

 

But I have no idea since if done separately as integers in Java, 17(32654/17) is, like DW said, 32640, and oddly enough, 32654%17 is 5.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.