Project

General

Profile

Actions

Bug #14026

closed

RUBY ERROR ON DIVISION with FDIV

Added by frankpimenta (Frank Pimenta) about 7 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
>2.4
[ruby-core:83339]

Description

~$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
~$ rvm use 2.4.2
Using /Users/frankpimenta/.rvm/gems/ruby-2.4.2
~$ ruby -rbigdecimal -e 'p 196.fdiv(BigDecimal("13.0"))'
2.203413367e-314
~$ rvm use 2.4.1
Using /Users/frankpimenta/.rvm/gems/ruby-2.4.1
~$ ruby -rbigdecimal -e 'p 196.fdiv(BigDecimal("13.0"))'
2.1358685693e-314
~$ rvm use 2.3.5
Using /Users/frankpimenta/.rvm/gems/ruby-2.3.5
~$ ruby -rbigdecimal -e 'p 196.fdiv(BigDecimal("13.0"))'
#<BigDecimal:7fefe380a428,'0.1507692307 6923076923E2',27(36)>
~$ ruby -rbigdecimal -e 'p 196.fdiv(BigDecimal("13.0")).to_s("F")'
"15.076923076923076923"
~$ rvm use 2.4.2
Using /Users/frankpimenta/.rvm/gems/ruby-2.4.2
~$ ruby -rbigdecimal -e 'p 4.fdiv(BigDecimal("2.0"))'
2.236682878e-314
~$ ruby -rbigdecimal -e 'p 4.fdiv(BigDecimal("2"))'
2.2136573e-314
~$ man ruby
~$ ruby -e 'p Float::MIN'
2.2250738585072014e-308
~$ ruby -rbigdecimal -e 'p 4.fdiv(BigDecimal("2")).class'
Float
~$ ruby -e 'p Float::MAX'
1.7976931348623157e+308
~$


Files

Screen Shot 2017-10-18 at 16.50.46.png (205 KB) Screen Shot 2017-10-18 at 16.50.46.png frankpimenta (Frank Pimenta), 10/18/2017 02:51 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0