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


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

Submitted by:  Dildar Sk <hodor123456>
Submitted on:  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

Add a New Comment (Rich Markup)

You are not logged in

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


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>
Project 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 =



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

ans =



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


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

ans =




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:

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

    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 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.7