octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #32885] norm(NaN,Inf) produce 0


From: Jordi Gutiérrez Hermoso
Subject: [Octave-bug-tracker] [bug #32885] norm(NaN,Inf) produce 0
Date: Wed, 23 Mar 2011 05:43:33 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20110109 Suniguana/3.6.13 (like Firefox/3.6.13)

Update of bug #32885 (project octave):

                  Status:                    None => Patch Submitted        

    _______________________________________________________

Follow-up Comment #1:

I've isolated the problem to the following code snippet in gcc 4.4.5:


#include <iostream>

int main()
{
  using namespace std;
  cout << max(0.0, 0.0/0.0) << " "
       << max(0.0/0.0, 0.0) << endl;
}


On my system, that outputs "0 -nan", i.e. the order in which NaN is passed to
max matters. I attach a patch that works around this for gcc 4.4.5, but I am
not sure this is the right fix in general; I can imagine how it depends on the
implementation of std::max.

I'll let someone else push this patch if they deem it worthy.

(file #22992)
    _______________________________________________________

Additional Item Attachment:

File name: NaN.patch                      Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?32885>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]