Fixes #633

@lamblin . Unit tests to be added.
Can you also test the case where the values for x and y are equal?