octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #65714] "hist" throws error when input numbers


From: Hartmut
Subject: [Octave-bug-tracker] [bug #65714] "hist" throws error when input numbers are very close
Date: Wed, 8 May 2024 10:29:12 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?65714>

                 Summary: "hist" throws error when input numbers are very
close
                   Group: GNU Octave
               Submitter: hardy
               Submitted: Wed 08 May 2024 02:29:12 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error or Warning
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 9.1.0
         Discussion Lock: Any
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Wed 08 May 2024 02:29:12 PM UTC By: Hartmut <hardy>
I observed this akward behavior of the "hist" function in Octave. When I run
this (artificially simplified demo) code:


clear
close all

figure
hist([1, 1+0.1*eps]) % -> OK

figure
hist([1, 1+eps])     % -> throws error in Octave

Then the first "hist" command gives me a reasonable histogram figure, but the
second call to "hist" throws the following error:


error: bar: X vector values must be unique
error: called from
    __bar__ at line 70 column 9
    bar at line 117 column 18
    hist at line 249 column 5
    bug_hist at line 8 column 1


I know that I cannot expect a beautiful histogram figure from these input
numbers. But a similar scenario happend with my "real numbers" as well. And
what I expected in this case is a histogram that shows me that all my numbers
are very close to each other. The current Octave behavior, to only throw an
error and exit the m-script, is not very useful in this real life situation.

In addition, Matlab produces a histogram figure also for the second part of my
above sample script, it does not throw an error in this situation.

I know that the OpenGL plotting has a problem with limited resolution in
plotting, maybe this is the deeper reason for the above behavior. But even in
this case, I think that our hist command should then do just some rounding
(and just discard differences that a smaller than eps maybe, that could not be
plotted anyways) before calling the bar command, in order to avoid this nasty
erroring.







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65714>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]