bugGNU Octave - Bugs: bug #53463, nextpow2 with Inf or NaN arguments

 
 

bug #53463: nextpow2 with Inf or NaN arguments

Submitted by:  Dildar Sk <hodor123456>
Submitted on:  Sun 25 Mar 2018 02:54:30 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Dildar Sk Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 12 Apr 2018 09:36:24 PM UTC, comment #2: 

I fixed this bug using a slightly different strategy.  When the two-input form of the log2 function fails, the exponent returned is 0.  I can use that fact to identify the input values like Inf or NaN that need special processing.

I added new BIST tests to check that this all works.  See this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/69b21b8a0e9f).

Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Sun 25 Mar 2018 02:59:47 PM UTC, comment #1: 

I added the referred two cases in that function.
Added a test also.
patch attached.

(file #43670)

Dildar Sk <hodor123456>
Sun 25 Mar 2018 02:54:30 PM UTC, original submission:  

In MATLAB,

>> nextpow2(inf)

ans =

   Inf

>> nextpow2(NaN)

ans =

   NaN

>>

In GNU Octave,

>> nextpow2(inf)
ans = 0
>> nextpow2(NaN)
ans = 0

So,here Octave neither producing valid answer nor warning.

Dildar Sk <hodor123456>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #43670:  nextpow2.patch added by hodor123456 (843B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by hodor123456 (Submitted the item)
  • -email is unavailable- added by hodor123456
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-12 rik5 StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
    2018-03-27 mtmiller Item GroupIncorrect Result => Matlab Compatibility
        StatusNone => Patch Submitted
        Summarynextpow2: Should produce correct result or error => nextpow2 with Inf or NaN arguments
    2018-03-25 hodor123456 Attached File- => Added nextpow2.patch, #43670
    2018-03-25 hodor123456 Carbon-Copy- => Added dildarsk101010@gmail.com

    Back to the top


    Powered by Savane 3.5