I believe Devel::DumpTrace quickly identifies the root cause of the problem.
perl -d:DumpTrace=+Number::Format -MNumber::Format -E 'say Number::For +mat::format_number(-0.00004, 5)' >>> -e:1:[__top__]: say Number::Format::format_number(-0.00004, 5 +) >>> Number/Format.pm:316:[_get_self]: unless (ref $_:(-4e-05,5)[0 +] && UNIVERSAL::isa($_:(-4e-05,5)[0], "Number::Format"))

It seems that perl immediately interprets the value passed to the function (-0.00004) as scientific notation inside the function (-4e-05). A diff of this output vs. the output of a passing case with one less zero (-0.0004) shows where in the code the 2 cases diverge. I uploaded a patch to the open bug report.

It then occurred to me to take a look a the coverage results (cpancover.com: new web site for CPAN code coverage). Sure enough, the line of code I patched was not covered by the test suite. This shows the value in using coverage to determine test quality.

Why did I delay posting this? I tried using Devel::DumpTrace shortly after the original posting, but it did not give me the result I expected. It dawned on me that I may not have the latest version of the module. A quick check of CPAN showed that the attentive author had uploaded several versions newer than what I had installed (it is a fairly young module).

I installed the latest version, and the results were a little better, but still not what I expected. I submitted a bug report, and as it turned out, Number::Format sensitized a bug in Devel::DumpTrace! Within a few hours, the author identified the root cause, and uploaded a fixed version the next day. Kudos to the author.

Morals of this story:


In reply to Re: Sign bug in Number::Format (Devel::DumpTrace) by toolic
in thread Sign bug in Number::Format by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.