Ada-Style Modulo Integer Types

Ivan Kazmenko via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 22 16:45:33 PDT 2016


On Friday, 22 April 2016 at 17:37:44 UTC, Nordlöw wrote:
> Have anybody implement Ada-style modulo types
>
> https://en.wikibooks.org/wiki/Ada_Programming/Types/mod

I've implemented a proof-of-concept for algorithmic programming 
competitions [1]. In these competitions, quite a few problems ask 
to calculate the result modulo some large prime number.  The 
usual idea is that, this way, you still have to solve the 
underlying algorithmic problem, but the magnitude of calculated 
values does not affect your algorithmic complexity.  Disclaimer: 
it is incomplete and tuned for the competitions, and thus not 
ready for general use.

For the record, there is also an implementation of modulo integer 
for the same problem in C++ by Vladislav Isenbaev.  Note that the 
solutions themselves are not the same, so the timing can't be 
compared directly.

Ivan Kazmenko.

[1] http://codeforces.com/contest/628/submission/16212299
[2] http://codeforces.com/contest/628/submission/16610362



More information about the Digitalmars-d-learn mailing list