Bugs: Browse | Submit New | Admin

[#9261] BigDecimal initialisation bug

Date:
2007-03-13 17:32
Priority:
3
Submitted By:
Mark Somerville (spakman)
Assigned To:
Akinori MUSHA (knu)
Category:
Math
State:
Open
Platform:
 
Summary:
BigDecimal initialisation bug

Detailed description
Seems like the BigDecimal intialisation code has a bug:

This positive value is interpretted as I'd expect:

>> BigDecimal.new(".31").to_s
=> "0.31"

But this negative one isn't:

>> BigDecimal.new("-.31").to_s
=> "0.31"

Cheers,

Mark

Add A Comment: Notepad

Please login


Followup

Message
Date: 2007-03-24 19:08
Sender: Benjamin Atkin

If you have a leading zero, it works:

irb(main):005:0> BigDecimal.new("-0.31").to_s
=> "-0.31E0"

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
assigned_tonone2007-06-12 02:24zenspider
category_idMisc / Other Standard Library2007-05-29 21:27zenspider