[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #32885] norm(NaN,Inf) produce 0
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #32885] norm(NaN,Inf) produce 0 |
Date: |
Wed, 17 Feb 2016 00:04:00 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 |
Update of bug #32885 (project octave):
Status: Ready For Test => Fixed
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #22:
I used a slightly different fix which avoids calling a constructor.
- max = std::max (max, std::abs (val));
+ if (xisnan (val))
+ max = octave_NaN;
+ else
+ max = std::max (max, std::abs (val));
Benchmarking on a vector (1, 1e6) with a single NaN value.
Old method: 0.0014278
Rik patch: 0.003131
Lachlan patch: 0.012914
My solution is about 2X slower, but does produce the correct output.
I applied it here (http://hg.savannah.gnu.org/hgweb/octave/rev/85d8280c64f4).
Closing report.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?32885>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/