[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #50377] [octave forge] (statistics) pdist2 fun
From: |
Georg Wiora |
Subject: |
[Octave-bug-tracker] [bug #50377] [octave forge] (statistics) pdist2 function returns complex results |
Date: |
Mon, 7 Jan 2019 09:05:09 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0 |
Follow-up Comment #6, bug #50377 (project octave):
Sorry, it is so long ago I posted this sample that I forgot where I found the
problem. But the problem is a standard case in numeric. Therefore I recommend
the implementation of the suggested prevention for complex results.
An expression like _sqrt(x^2+y^2 - 2 * x * y)_ can always become complex if
the value of _x^2+y^2_ and _2 * x * y_ are equal in a range of _eps_. In this
case the argument of sqrt() may become negative and the result type changed
from double to complex.
This description may be used as a guide to constructing examples. Any numeric
pair of [x,y] is a good test case where the condition _x^2+y^2 == 2 * x * y_
analytically is true and _x~=0_ and _y~=0_ and I would suggest x~=y.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?50377>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/