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

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

[Octave-bug-tracker] [bug #41827] Fix dead assignment octave_rand::do_fl


From: Rik
Subject: [Octave-bug-tracker] [bug #41827] Fix dead assignment octave_rand::do_float_scalar
Date: Thu, 13 Mar 2014 22:43:37 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0

Update of bug #41827 (project octave):

                Priority:              5 - Normal => 6                      
                  Status:                    None => In Progress            

    _______________________________________________________

Follow-up Comment #1:

Okay, I ran Octave under gdb to trace this down and the error is real.  Sample
code to reproduce the problem is


randg ("seed", 1);  # Use old-style generators
randg ([-2 Inf], "single")  # Return "float" values
ans =

   0   0


To add a test case for this, take a look at Appendix B of the manual (Test and
Demo Functions).  Basically, you just need to add the Octave code example I
posted along with an assert statement that the return results are NaN, rather
than 0.

The place to add this is with the rest of the built-in randg tests.  The file
in question is oct-rand.cc in libinterp/corefcn.  Search for DEFUN.*randg to
find the function definition for randg.  At the end of the function, in a long
C-style comment block, are the built-in tests.  You will find tests that use a
fixed "seed".  Add the test in there somewhere.

For the changset comment format, take a look at Appendix D (Contributing
guidelines).  You are almost there.  We like to append the bug number that is
being fixed in the first line like so


Comment comment comment comment (bug #XXXXX).


Further on, we name the file and function and what was modified.  We report
*what* was done, rather than *why* it was done.  The justification for why is
usually in the very first line, like fix bug XXXXX.  So instead of explaining
what Clang found, we would probably write

* oct-rand.cc (do_float_scalar): Correctly assign temporary output to dretval
rather than retval.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?41827>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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