lib/nio/fmt.rb in nio-0.2.2 vs lib/nio/fmt.rb in nio-0.2.3
- old
+ new
@@ -1847,10 +1847,13 @@
neutral = x.nio_xr.nio_write_neutral(fmt)
converted = true
end
if !converted
if fmt.get_base==10
- txt = x.to_s
+ # Don't use x.to_s because of bugs in BigDecimal in Ruby 1.9 revisions 20359-20797
+ # x.to_s('F') is not affected by that problem, but produces innecesary long strings
+ sgn,ds,b,e = x.split
+ txt = "#{sgn<0 ? '-' : ''}0.#{ds}E#{e}"
sign = '+'
if txt[0,1]=='-'
sign = '-'
txt = txt[1...txt.length]