bugGNU Octave - Bugs: bug #67658, [signal] function digitrevorder...

 
 

bug #67658: [signal] function digitrevorder fails with some array lengths

Submitter:  None
Submitted:  Mon 03 Nov 2025 01:09:13 AM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Confirmed Assigned to:  None
Originator Name:  Geoff Warne Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * 10.2.0
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Tue 04 Nov 2025 10:28:15 AM UTC, comment #2: 

It is worthwhile to post the whole code for the input validation.

   tmp = log (numel (x)) / log (r);
    if (fix (tmp) != tmp)
      error ("digitrevorder: X must have length equal to an integer power of %d", r);
    endif

The validation works for pure math, but does not take into account the finite precision of numerical computations.  See Octave session below.

octave:2> format long
octave:3> log1 = log (125)
log1 = 4.828313737302302
octave:4> log2 = log (5)
log2 = 1.609437912434100
octave:5> tmp = log1 / log2
tmp = 3.000000000000000
octave:6> tmp == 3
ans = 0
octave:7> tmp - 3
ans = 4.440892098500626e-16


The variable tmp is almost the exact integer 3, but is off by 2 eps.  Either the comparison needs to be made with a tolerance, or another scheme such as the one proposed in the bug report should be used.

Changing the Catgeory to Octave Package and marking as Confirmed.

Rik <rik5>
Group administrator
Mon 03 Nov 2025 02:21:49 AM UTC, comment #1: 


if (fix (tmp) != tmp)

is the problem

or you could  replace it with

 if (mod ( numel (x) , r ) != 0)

Doug Stewart <dastew>
Mon 03 Nov 2025 01:09:13 AM UTC, original submission:  


function [y, i] = digitrevorder (x, r)

eg with array length 125 and r=5 it returns with error that length is not equal to integer power of 5.

the line

if (fix (tmp) != tmp)

is the problem
I have modified a copy with this replacement line

 if (r^round(tmp) != numel(x))

and it seems to work, however I have not tested it thoroughly.


Anonymous

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

Digest:
   bug dependencies.

 

Mail Notification Carbon-Copy List

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

    Votes

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    History

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-11-04 rik5 StatusNone Confirmed
        Operating SystemMicrosoft Windows Any
        Summary(signal) function digitrevorder fails with some array lengths [signal] function digitrevorder fails with some array lengths
    2025-11-04 mmuetzel CategoryOctave Function Octave Package
        Summaryfunction digitrevorder in signal processing package fails with some array lengths (signal) function digitrevorder fails with some array lengths
    2025-11-04 mmuetzel Dependencies- bugs #67659 is dependent

    Back to the top

    Powered by Savane 3.16.
    Corresponding source code