Boost logo

Geometry :

Subject: Re: [geometry] Negative distance?
From: Barend Gehrels (barend_at_[hidden])
Date: 2012-03-19 17:12:03

Hi Volker,

On 19-3-2012 11:44, Volker Schöch wrote:
> Hi Barend,
>> Thanks for your report. However, I cannot reproduce it.
>> [...] Attached my program to verify this.
> I tried your reproduction. It's alright except that your points are based on double. Change that template paramter T of template<typename T> void test_distance() to int and you'll see what I see. It is actually worse (well, different at least) than I thought: The result is not negative, it is "not a number". NaN lets my check for negative results fail, so I prematurely assumed the result was a negative distance. I apologize.

Ah. Indeed I get -nan for int, using 1.48. Sorry for not-testing int, at
that moment did not think that you're using int's.

Actually I cannot explain why this specificly fails with int and
succeeds with double. I'm a bit surprised by it but have currently no
time to research it further, and besides that it is fixed in the Trunk

So yes, it is fixed in Trunk but alas not yet for 1.49 (the current
release). If that is the case I probably know what is the case (but
still don't know why it is only on int) and I can tell how to patch it.
If it is possible for you to patch 1.48 or 1.49 I'll tell you. Otherwise
you have to wait for 1.50. Sorry for the error.

Regards, Barend

Geometry list run by mateusz at