From bug-request at octave dot org Mon Feb 7 10:26:12 2005 Subject: Re: Inconsistency in complex division by zero From: David Bateman To: "John W. Eaton" CC: bug at octave dot org Date: Mon, 07 Feb 2005 17:28:08 +0100 John W. Eaton wrote: >On 7-Feb-2005, David Bateman wrote: > >| As the /0 case only occurs in "div" function in op-{cs,cm}-s.cc and in >| the "ldiv" function in op-s-{cs,cm}.cc perhaps just a special case there >| is sufficient. > >But then the fix only shows up for interpreted code and we would see >different results for the same operation when performed in Octave, >C/C++, or Fortran (used in a .oct file, for example). But maybe this >is no different than some other operations which could be implemented >slightly differently in different libraries? In any case, it is not a >very satisfying solution. > >jwe > > > Is it possible to overload the "/" and "*" operators #ifdef BROKEN_COMPLEX_MATH Complex operator * (const Complex &a, const double &b) { return a * Complex (b); } Complex operator * (const double &a, const Complex &b) { return Complex(a) * b; } Complex operator / (const Complex &a, const double &b) { return a / Complex (b); } #endif Regards David -- David Bateman David dot Bateman at motorola dot com Motorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------