Project

General

Profile

Actions

Bug #4894

closed

incorrect conversions from BigDecimal to Float

Added by loosecannon (Cannon Matthews) over 13 years ago. Updated over 13 years ago.

Status:
Rejected
Target version:
ruby -v:
ruby 1.8.7 (2009-06-08 patchlevel 173) [x86_64-linux]
[ruby-core:37179]

Description

=begin
I am working with BigDecimals, and was previously using floats. I came across this strange bug where when converting from BigDecimal down to float, zeros in the middle of the number get removed.

require 'bigdecimal' #=> true
require 'bigdecimal/util' #=> true

BigDecimal.new("40.08").to_f #=> 40.8

which are obviously 2 very different numbers. This happens with implicit converisons too:

BigDecimal.new("48.08") - 40.00 #=> 8.8

if this has already been fixed, my apologies.
=end

Updated by sorah (Sorah Fukumori) over 13 years ago

  • Category set to lib
  • Status changed from Open to Assigned
  • Assignee set to mrkn (Kenta Murata)

Updated by sorah (Sorah Fukumori) over 13 years ago

  • Status changed from Assigned to Rejected

You're using old release of ruby1.8.7.

It seems already fixed at ruby1.8.7p334.

Please be sure to use latest version before reporting bug.

Thanks,
sora_h

Actions

Also available in: Atom PDF

Like0
Like0Like0