"Rounding" complex numbers



So far as I know, Iverson's _APL_ programming language (on IBM mainframes)
was the first language that attempted to standardize the complex round
function.  Back in the early 1970's & 1980's, there was a huge amount of
discussion among APL nerds about the best definition.

Basically, round(z)=round(x+iy) wants to return "the" integral grid point
which is closest to z.  So long as z is not equidistant from 2 or more
closest grid points, everyone seems to agree that round(z)=round(x)+i*round(y).

However, you have _branch points_ (actually branch lines) in the complex
plane along (m+1/2)+i*(n+1/2) for m,n integers.

I was never swayed one way or another by many of the APL arguments, so
IMHO it comes down to what is _simple_ to explain and _cheap_ to implement,
which is obviously round(z)=round(x)+i*round(y).

For applications of round(z), see:

http://home.pipeline.com/~hbaker1/Gaussian.html

At 12:58 AM 11/16/2013, Rupert Swarbrick wrote:
>Does Maxima have a built in function for rounding things to the nearest
>(Gaussian) integer at the moment? I've got something trivial hacked
>together that I've been using at work, which is basically
>round(realpart(x))+round(imagpart(x)), but with some infrastructure for
>distributing over bags.
>
>Assuming I've not missed an existing function to do this, would it be a
>useful utility to add? And should it have a different name, or should it
>just be added to the round() function? (At the moment, round(1+%i) gives
>a noun form).
>
>Rupert