bugGNU Octave - Bugs: bug #51649, Octave:divide-by-zero warning not...


bug #51649: Octave:divide-by-zero warning not issued for anything but scalars

Submitted by:  Ernst Reissner <ernstreissner>
Submitted on:  Thu 03 Aug 2017 08:51:50 AM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Duplicate Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

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


( Jump to the original submission)

Sun 27 Aug 2017 04:51:27 PM UTC, comment #6:

I'm marking this as a duplicate of bug #46650 which I just dug up looking through old bugs, to disable the divide by zero warning by default.

Mike Miller <mtmiller>
Project Administrator
Mon 07 Aug 2017 09:22:09 AM UTC, comment #5:

I agree, octave's current divide by zero warning functionality
is not useful since it does not apply to vectors and matrices
which are widely used.
Even more, i think it is dangerous, if the user relies on that warning and is not aware, that it applies to scalars only.

I also agree, that for matlab compatibility, there shall be no warning.

On the other hand, i think a switch is extremely useful
for debugging since it warns for a result
which is mathematically incorrect!

Ernst Reissner <ernstreissner>
Fri 04 Aug 2017 11:11:55 PM UTC, comment #4:

The Octave:divide-by-zero feature is deprecated (although we never published anything about that, so that is our fault) and I intended to remove it about 2 years ago, but got busy. It is problematic because 1) it only applies to scalars, and 2) it is not Matlab compatible.

Since it only applies to scalars it really was never that useful because there are lots of operations that involve vectors and matrices for which no checking is done. Also, it slows computations down because instead of forwarding directly to BLAS, Octave has to check the divisor.

Rik <rik5>
Project Administrator
Fri 04 Aug 2017 08:21:22 AM UTC, comment #3:

Ok, I think, for matlab compliance one has to disable the warning by default.
Still I think, mathematically, the result in matlab is wrong
so it is an advantage to have a flag like
Octave:divide-by-zero to enable or disable such a warning.

If I stick to the manual (page 227), i read:
"If the Octave:divide-by-zero warning is enabled, a warning is issued when Octave encounters a division by zero.
By default, the Octave:divide-by-zero warning is enabled."

Ok, nothing is said that the warning does not come
in conjunction with arrays
and I think that is counter-intuitive:
If one wants a warning, then generally.

Ernst Reissner <ernstreissner>
Thu 03 Aug 2017 05:46:28 PM UTC, comment #2:

Octave only issues the divide-by-zero warning when the divisor is a scalar value of zero.

It looks like Matlab used to issue a warning by default for division by zero, but eliminated that sometime around 2009-2011. Now it seems there is no warning by default, and possibly no way to even enable the warning.

I propose that "Octave:divide-by-zero" be added to the maximum_braindamage list of warnings to disable by default. Or we could discuss disabling it by default in Octave globally.

To the original comment, this is just the definition of the warning at the moment, it is only issued when the divisor is a scalar, there is no check of each individual element in the elementwise division operation.

Mike Miller <mtmiller>
Project Administrator
Thu 03 Aug 2017 05:15:36 PM UTC, comment #1:

MATLAB 2016a does not complain about either of these constructions.

Ceral Paquet <octavebugs>
Thu 03 Aug 2017 08:51:50 AM UTC, original submission:

uint64(0)/uint64(0) yields 0 with error,

without any warning.

Ernst Reissner <ernstreissner>


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

Attach Files:

No files currently attached


   bug dependencies.

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 mtmiller (Posted a comment)
  • -email is unavailable- added by octavebugs (Posted a comment)
  • -email is unavailable- added by ernstreissner (Submitted the item)
  • -email is unavailable- added by ernstreissner

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

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-27 mtmiller StatusConfirmed => Duplicate
        Open/ClosedOpen => Closed
        Dependencies- => Depends on bugs #46650
    2017-08-04 rik5 StatusNone => Confirmed
        Summaryint64: 0/0 => Octave:divide-by-zero warning not issued for anything but scalars
    2017-08-03 ernstreissner Carbon-Copy- => Added -email is unavailable-

    Back to the top

    Powered by Savane 3.3