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: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Missed Error or Warning
Status: ConfirmedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)

You are not logged in

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


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 File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

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

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 04 Aug 2017 11:11:55 PM UTCrik5StatusNone=>Confirmed
      Summaryint64: 0/0=>Octave:divide-by-zero warning not issued for anything but scalars
    Thu 03 Aug 2017 08:51:51 AM UTCernstreissnerCarbon-Copy-=>Added -unavailable-

    Back to the top

    Powered by Savane 3.1-cleanup1