bugGNU Octave - Bugs: bug #51143, mixed precision operations should...

 
 

bug #51143: mixed precision operations should be performed as double

Submitter:  Marco Caliari <caliari>
Submitted:  Tue 30 May 2017 12:54:15 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 30 May 2017 05:52:37 PM UTC, comment #2: 

MATLAB

>> exp (100) * single (1e-20)

ans =

  2.6881e+23

>> whos
  Name      Size            Bytes  Class     Attributes

  ans       1x1                 4  single

>> exp (100:110) * single (1e-20)

ans =

   1.0e+27 *

    0.0003    0.0007    0.0020    0.0054    0.0147    0.0399    0.1084    0.2948    0.8013    2.1782    5.9210

>> whos
  Name      Size            Bytes  Class     Attributes

  ans       1x11               44  single


Ceral Paquet <octavebugs>
Tue 30 May 2017 03:08:34 PM UTC, comment #1: 

Yes, for mixed single/double operations is both operands are converted to single.  I thought that was compatible behavior.  If instead the computation is performed in double and then the result is converted to single, then we should probably define mixed-type operators and eliminate the "demotion" functions that are currently  defined.  It should not be too hard with templates, but some care will be needed to ensure that all cases are covered consistently.

John W. Eaton <jwe>
Group administrator
Tue 30 May 2017 12:54:15 PM UTC, original submission:  

The following


exp (100) * single (1e-20)


gives Inf, even if the final result is smaller then realmax ('single'). It seems that exp (100) is converted to single before the multiplication with 1e-20.

Marco Caliari <caliari>
Group Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-30 mtmiller CategoryNone Interpreter
        Item GroupIncorrect Result Matlab Compatibility
        StatusNone Confirmed
        SummaryOverflow result with mixed precision types mixed precision operations should be performed as double

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code