lib/rdf/model/literal/double.rb in rdf-0.3.8 vs lib/rdf/model/literal/double.rb in rdf-0.3.9
- old
+ new
@@ -45,10 +45,10 @@
@string = case
when @object.nan? then 'NaN'
when @object.infinite? then @object.to_s[0...-'inity'.length].upcase
when @object.zero? then '0.0E0'
else
- i, f, e = ('%.16E' % @object.to_f).split(/[\.E]/)
+ i, f, e = ('%.15E' % @object.to_f).split(/[\.E]/)
f.sub!(/0*$/, '') # remove any trailing zeroes
f = '0' if f.empty? # ...but there must be a digit to the right of the decimal point
e.sub!(/^\+?0+(\d)$/, '\1') # remove the optional leading '+' sign and any extra leading zeroes
"#{i}.#{f}E#{e}"
end