summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/extconf.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-09 08:51:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-09 08:51:26 +0000
commita424741c8e73bbca5d893594abbdfda489794739 (patch)
treee17d97a861721f05bf0a197650fa814462854253 /ext/bigdecimal/extconf.rb
parent0e66903fca6743ab09504a5b9bd711c6d99821fb (diff)
* ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): use strtod() for more
precision. [ruby-talk:290296] * ext/bigdecimal/bigdecimal.c (BASE_FIG): made constant. * ext/bigdecimal/extconf.rb: ditto. [ruby-dev:33658] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal/extconf.rb')
-rw-r--r--ext/bigdecimal/extconf.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/bigdecimal/extconf.rb b/ext/bigdecimal/extconf.rb
index a68a6560441..864aaad862f 100644
--- a/ext/bigdecimal/extconf.rb
+++ b/ext/bigdecimal/extconf.rb
@@ -1,2 +1,12 @@
require 'mkmf'
+
+base_fig = 0
+src = ("(BASE > 0) && "
+ "(BASE * (BASE+1)) > BASE && "
+ "(BASE * (BASE+1)) / BASE == (BASE+1)")
+while try_static_assert(src, nil, "-DBASE=10#{'0'*base_fig}UL")
+ base_fig += 1
+end
+$defs << "-DBASE=1#{'0'*base_fig}UL" << "-DBASE_FIG=#{base_fig}"
+
create_makefile('bigdecimal')