[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51283] function min/max inconsistent handling
From: |
Joel Dahne |
Subject: |
[Octave-bug-tracker] [bug #51283] function min/max inconsistent handling of -0 |
Date: |
Wed, 21 Jun 2017 04:56:38 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0 |
URL:
<http://savannah.gnu.org/bugs/?51283>
Summary: function min/max inconsistent handling of -0
Project: GNU Octave
Submitted by: urathai
Submitted on: Wed 21 Jun 2017 08:56:37 AM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Joel
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.2.1
Operating System: GNU/Linux
_______________________________________________________
Details:
The min/max functions does not seem to be aware of the difference between -0
and 0. We have (-0 == 0) = 1 and (-0 < 0) = 0, so it is not clear how to
handle this case. The main problem however lies in that the result is
different when comparing scalars versus when comparing vectors. For max we
have
> max (-0, 0)
ans = 0
>max (0, -0)
ans = -0
>max ([-0, -0], [0, 0])
ans = [-0, -0]
>max ([0, 0], [-0, -0])
ans = [0, 0]
It looks like the function make no difference between -0 and 0, it probably
just returns the first (or last?) of them it encounters. But as can be seen
the order differs between scalars and vectors.
I think it would be more natural to return 0 in all cases, but at least be
consistent with it.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51283>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #51283] function min/max inconsistent handling of -0,
Joel Dahne <=