bugGNU Octave - Bugs: bug #53509, log1p: difference result in Octave...

 
 

bug #53509: log1p: difference result in Octave and MATLAB.

Submitter:  Dildar Sk <hodor123456>
Submitted:  Thu 29 Mar 2018 12:14:25 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Wont Fix Assigned to:  None
Originator Name:  Dildar Sk Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 29 Mar 2018 03:37:52 PM UTC, comment #2: 

Both Octave and Matlab are numerical computation languages, rather than pure math.  It is important to get a sense of the size of the error, and if it is on the order of a few eps then that is all that can be expected.

In Octave,


log1p(2) - log(3)
ans =   -2.2204e-16


so the calculation is as accurate as it can be expected given that


eps (2)
ans =    4.4409e-16



Rik <rik5>
Group administrator
Thu 29 Mar 2018 02:42:40 PM UTC, comment #1: 

I think this shouldn't be reported as a bug: the function log1p is used to compute in a more stable way when x is small in module. In fact in Octave log1p(x) is computed as log (1+x) when x < - 0.5 or x > 1:

>> log1p(2.1) == log(3.1)

ans = 1

>> log1p(2) == log(3)

ans = 0

Probably Matlab simply uses a different threshold to decide when use the definition log1p(x)==log(1+x) and when an alternative expansion:

>> log1p(0.3) == log(1.3)


ans =

  logical

   1

>> log1p(0.2) == log(1.2)


ans =

  logical

   0

Michele Ginesi <m_ginesi>
Thu 29 Mar 2018 12:14:25 PM UTC, original submission:  

In MATLAB,


>> log1p (2) == log (3)

ans =

  logical

   1

>>


In Octave,


>> log1p (2) == log(3)
ans = 0
>>


Dildar Sk <hodor123456>

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by m_ginesi (Posted a comment)
  • -email is unavailable- added by hodor123456 (Submitted the item)
  • -email is unavailable- added by hodor123456
  •  

    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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-29 rik5 StatusNone Wont Fix
        Open/ClosedOpen Closed
    2018-03-29 hodor123456 Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code