Skip Menu |

This queue is for tickets about the Number-Format CPAN distribution.

Report information
The Basics
Id: 17540
Status: resolved
Priority: 0/
Queue: Number-Format

People
Owner: WRW [...] cpan.org
Requestors: mukundaj [...] deshaw.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Problem with format_number
Hi, $ perl -MNumber::Format -e'$\ = "\n";print $Number::Format::VERSION; $x = 0.000010; print Number::Format::format_number($x, 6, 1);' 1.45 0.-05000 $ As I see it, format_number seem calculate the decimal part like $decimal = substr($number, length($integer)+1) if (length($integer) < length($number)); At this point $number becomes 1-e5 (i.e., gets into scientific form). So calculating the decimal part in the above way results in the decimal part to be .-05000. Or in other words, it doesn't seem to take the scientific notation into consideration. The distribution is Number::Format-1.45 perl version is 5.8.6 OS arch info : Sun sparc Solaris. The simplest patch I see is to do $number + 1 and then get the decimal part like DB<8> x substr($number + 1, length($integer)+1) 0 00001 DB<9> Let me know if I need to provide more info. Thanks, Jayesh
With 1.71 the output of your test program is 1.71 1e-05