bugGNU Octave - Bugs: bug #34502, bitXXX functions do not accept...

 
 

bug #34502: bitXXX functions do not accept arguments of class 'single'

Submitted by:  Rik <rik5>
Submitted on:  Fri 07 Oct 2011 04:48:34 PM UTC  
 
Category: LibrariesSeverity: 2 - Minor
Priority: 5 - NormalItem Group: Feature Request
Status: FixedAssigned to: Mike Miller <mtmiller>
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Sun 08 Sep 2013 10:14:40 PM UTC, comment #6:

Ok, I've worked out the remaining issues that I ran into while adding support for this. I replaced the hardcoded floating point bit widths with calls to numeric_limits, reimplemented flintmax to be Matlab-compatible, and tested everything for consistency and it all seems to work as far as I can tell. Pushed these changes:

http://hg.savannah.gnu.org/hgweb/octave/rev/dbdff94bf977
http://hg.savannah.gnu.org/hgweb/octave/rev/4bcd301754ce
http://hg.savannah.gnu.org/hgweb/octave/rev/7d8d194f3f63
http://hg.savannah.gnu.org/hgweb/octave/rev/e09cd91168d1

I couldn't really come up with a good way to describe how flintmax differs from bitmax, feel free to rewrite either or both of their docstrings to make it clearer.

Mike Miller <mtmiller>
Project MemberIn charge of this item.
Fri 06 Sep 2013 04:36:00 PM UTC, comment #5:

Your patch seems OK, but I didn't test it.

Do we need to be careful about hard-wiring things like 32 bits in a single and 24 bits in the mantissa? I guess it is OK, we are pretty deep in with the assumption of IEEE floating point math these days, so maybe we will never have to worry about that changing.

John W. Eaton <jwe>
Project Administrator
Fri 06 Sep 2013 04:17:00 PM UTC, comment #4:

Yeah I saw the flintmax alias but unfortunately the MATLAB docs say that the return value is different from the now-deprecated bitmax. I'll take care of all of these issues if neither of you beat me to it.

Back to this bug, any comments on my patch?

Mike Miller <mtmiller>
Project MemberIn charge of this item.
Fri 06 Sep 2013 02:57:39 PM UTC, comment #3:

I had noticed the flintmax replacement by Matlab and added a DEFALIAS so Octave will accept either flintmax or bitmax. I kind of liked the name bitmax so I left it in.

Rik <rik5>
Project Administrator
Fri 06 Sep 2013 02:18:00 PM UTC, comment #2:

I'd say yes, bitmax ("single") should return a single value.

According to the Matlab docs, bitmap does not appear to accept an argument for single. Also, it seems that bitmax is being replaced by flintmax which does accept an argument, either "single" or "double" (the default).

John W. Eaton <jwe>
Project Administrator
Fri 06 Sep 2013 05:10:56 AM UTC, comment #1:

This seems useful to me so I went ahead and got all the bit functions working. I think I got all of the type promotion working correctly, please take a look at the attached changeset and let me know if I missed anything or if there is a simpler way to structure it.

Related to this, should bitmax ("single") return a variable of type single? It currently returns double, so for now there is a typecast in one of the new unit tests to get around that.

(file #29022)

Mike Miller <mtmiller>
Project MemberIn charge of this item.
Fri 07 Oct 2011 04:48:34 PM UTC, original submission:

Sample code

Updating the bitXXX.m scripts in the general directory looks pretty straightforward. However, there does need to be some support in src/bitfcns.cc for single arguments as well (bitshift, maybe others).

Rik <rik5>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #29022:  single-bitops.patch added by mtmiller (7kB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 08 Sep 2013 10:14:40 PM UTCmtmillerStatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Fri 06 Sep 2013 05:17:19 AM UTCmtmillerStatusConfirmed=>Patch Submitted
      Assigned toNone=>mtmiller
    Fri 06 Sep 2013 05:10:56 AM UTCmtmillerAttached File-=>Added single-bitops.patch, #29022
    Mon 27 Feb 2012 05:20:09 PM UTCrik5StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup