Thanks for the quick reply.
On Wed, 27 May 2015, Michael Ferguson wrote
... (with rearrangement a little)
> I really want mod(x,y) for integers x,y to return a positive value
> whenever y is positive (since I frequently use mod to bucket values into
> an array). (DAMIAN's CHANGE) That gives the 'floor' behavior here.
OK, now I understand. Your requirements are different to mine. To me, that
is a different operation.
Function Chapel Fortran
mod(-9.5, -2.1) -1.1 -1.1
mod(-9.5, +2.1) +1.1 -1.1
mod(-9, -2) -1 -1
mod(-9, +2) +1 -1
Directly or indirectly, 90% of what I write in C++, and likely Chapel, has
its roots in Fortran, even if my code is (or was) Chapel (or C++). I have
an admittedly selfish need for the same behaviour, at least in something
as fundamental as a 'modulus operation'. Happy to change the name though,
especially as some historical naming conventions are woeful. I would be
curious/appreciative of some feedback from the LLNL guys here? Anybody?
> I also want mod(x,y) for reals to do the same thing when both arguments
> are integral.
We are 110% in agreement there. That just means you implement the same way
of rounding the quotient in each.
The rest later (sorry).
- Damian
Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer
------------------------------------------------------------------------------
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users