therubyracer 0.8.1.pre2 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of therubyracer might be problematic. Click here for more details.
- data/Changelog.md +2 -1
- data/README.md +6 -3
- data/ext/v8/upstream/3.1.8/.gitignore +31 -0
- data/ext/v8/upstream/3.1.8/AUTHORS +40 -0
- data/ext/v8/upstream/3.1.8/ChangeLog +2566 -0
- data/ext/v8/upstream/3.1.8/LICENSE +52 -0
- data/ext/v8/upstream/3.1.8/LICENSE.strongtalk +29 -0
- data/ext/v8/upstream/3.1.8/LICENSE.v8 +26 -0
- data/ext/v8/upstream/3.1.8/LICENSE.valgrind +45 -0
- data/ext/v8/upstream/3.1.8/SConstruct +1192 -0
- data/ext/v8/upstream/3.1.8/build/README.txt +25 -0
- data/ext/v8/upstream/3.1.8/build/all.gyp +18 -0
- data/ext/v8/upstream/3.1.8/build/armu.gypi +32 -0
- data/ext/v8/upstream/3.1.8/build/common.gypi +82 -0
- data/ext/v8/upstream/3.1.8/build/gyp_v8 +145 -0
- data/ext/v8/upstream/3.1.8/include/v8-debug.h +384 -0
- data/ext/v8/upstream/3.1.8/include/v8-preparser.h +116 -0
- data/ext/v8/upstream/3.1.8/include/v8-profiler.h +426 -0
- data/ext/v8/upstream/3.1.8/include/v8-testing.h +99 -0
- data/ext/v8/upstream/3.1.8/include/v8.h +3846 -0
- data/ext/v8/upstream/3.1.8/include/v8stdint.h +53 -0
- data/ext/v8/upstream/3.1.8/preparser/preparser-process.cc +206 -0
- data/ext/v8/upstream/3.1.8/src/SConscript +356 -0
- data/ext/v8/upstream/3.1.8/src/accessors.cc +907 -0
- data/ext/v8/upstream/3.1.8/src/accessors.h +121 -0
- data/ext/v8/upstream/3.1.8/src/allocation.cc +204 -0
- data/ext/v8/upstream/3.1.8/src/allocation.h +176 -0
- data/ext/v8/upstream/3.1.8/src/api.cc +5191 -0
- data/ext/v8/upstream/3.1.8/src/api.h +508 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/apinatives.js +0 -0
- data/ext/v8/upstream/3.1.8/src/apiutils.h +80 -0
- data/ext/v8/upstream/3.1.8/src/arguments.h +105 -0
- data/ext/v8/upstream/3.1.8/src/arm/assembler-arm-inl.h +352 -0
- data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.cc +2756 -0
- data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.h +1294 -0
- data/ext/v8/upstream/3.1.8/src/arm/builtins-arm.cc +1628 -0
- data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.cc +6783 -0
- data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.h +657 -0
- data/ext/v8/upstream/3.1.8/src/arm/codegen-arm-inl.h +48 -0
- data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.cc +7403 -0
- data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.h +595 -0
- data/ext/v8/upstream/3.1.8/src/arm/constants-arm.cc +152 -0
- data/ext/v8/upstream/3.1.8/src/arm/constants-arm.h +769 -0
- data/ext/v8/upstream/3.1.8/src/arm/cpu-arm.cc +147 -0
- data/ext/v8/upstream/3.1.8/src/arm/debug-arm.cc +315 -0
- data/ext/v8/upstream/3.1.8/src/arm/deoptimizer-arm.cc +700 -0
- data/ext/v8/upstream/3.1.8/src/arm/disasm-arm.cc +1439 -0
- data/ext/v8/upstream/3.1.8/src/arm/frames-arm.cc +45 -0
- data/ext/v8/upstream/3.1.8/src/arm/frames-arm.h +168 -0
- data/ext/v8/upstream/3.1.8/src/arm/full-codegen-arm.cc +4230 -0
- data/ext/v8/upstream/3.1.8/src/arm/ic-arm.cc +1799 -0
- data/ext/v8/upstream/3.1.8/src/arm/jump-target-arm.cc +174 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.cc +2041 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.h +2046 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.cc +3822 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.h +312 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.cc +303 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.h +84 -0
- data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.cc +2701 -0
- data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.h +1015 -0
- data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.cc +1280 -0
- data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.h +252 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm.h +0 -0
- data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.cc +3165 -0
- data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.h +402 -0
- data/ext/v8/upstream/3.1.8/src/arm/stub-cache-arm.cc +4077 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/virtual-frame-arm-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.cc +843 -0
- data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.h +520 -0
- data/ext/v8/upstream/3.1.8/src/array.js +1231 -0
- data/ext/v8/upstream/3.1.8/src/assembler.cc +973 -0
- data/ext/v8/upstream/3.1.8/src/assembler.h +787 -0
- data/ext/v8/upstream/3.1.8/src/ast-inl.h +107 -0
- data/ext/v8/upstream/3.1.8/src/ast.cc +1067 -0
- data/ext/v8/upstream/3.1.8/src/ast.h +2177 -0
- data/ext/v8/upstream/3.1.8/src/atomicops.h +165 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_arm_gcc.h +145 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_gcc.cc +126 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_gcc.h +287 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_macosx.h +301 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_msvc.h +203 -0
- data/ext/v8/upstream/3.1.8/src/bignum-dtoa.cc +655 -0
- data/ext/v8/upstream/3.1.8/src/bignum-dtoa.h +81 -0
- data/ext/v8/upstream/3.1.8/src/bignum.cc +768 -0
- data/ext/v8/upstream/3.1.8/src/bignum.h +140 -0
- data/ext/v8/upstream/3.1.8/src/bootstrapper.cc +1888 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/bootstrapper.h +0 -0
- data/ext/v8/upstream/3.1.8/src/builtins.cc +1586 -0
- data/ext/v8/upstream/3.1.8/src/builtins.h +339 -0
- data/ext/v8/upstream/3.1.8/src/bytecodes-irregexp.h +105 -0
- data/ext/v8/upstream/3.1.8/src/cached-powers.cc +177 -0
- data/ext/v8/upstream/3.1.8/src/cached-powers.h +65 -0
- data/ext/v8/upstream/3.1.8/src/char-predicates-inl.h +94 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/char-predicates.h +0 -0
- data/ext/v8/upstream/3.1.8/src/checks.cc +110 -0
- data/ext/v8/upstream/3.1.8/src/checks.h +292 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/circular-queue-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/circular-queue.cc +122 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/circular-queue.h +0 -0
- data/ext/v8/upstream/3.1.8/src/code-stubs.cc +230 -0
- data/ext/v8/upstream/3.1.8/src/code-stubs.h +950 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/code.h +0 -0
- data/ext/v8/upstream/3.1.8/src/codegen-inl.h +64 -0
- data/ext/v8/upstream/3.1.8/src/codegen.cc +495 -0
- data/ext/v8/upstream/3.1.8/src/codegen.h +245 -0
- data/ext/v8/upstream/3.1.8/src/compilation-cache.cc +654 -0
- data/ext/v8/upstream/3.1.8/src/compilation-cache.h +112 -0
- data/ext/v8/upstream/3.1.8/src/compiler.cc +806 -0
- data/ext/v8/upstream/3.1.8/src/compiler.h +290 -0
- data/ext/v8/upstream/3.1.8/src/contexts.cc +320 -0
- data/ext/v8/upstream/3.1.8/src/contexts.h +376 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/conversions-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/conversions.cc +1069 -0
- data/ext/v8/upstream/3.1.8/src/conversions.h +122 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/counters.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/counters.h +242 -0
- data/ext/v8/upstream/3.1.8/src/cpu-profiler-inl.h +100 -0
- data/ext/v8/upstream/3.1.8/src/cpu-profiler.cc +554 -0
- data/ext/v8/upstream/3.1.8/src/cpu-profiler.h +291 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/cpu.h +0 -0
- data/ext/v8/upstream/3.1.8/src/d8-debug.cc +367 -0
- data/ext/v8/upstream/3.1.8/src/d8-debug.h +157 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-posix.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-readline.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-windows.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/d8.cc +792 -0
- data/ext/v8/upstream/3.1.8/src/d8.gyp +85 -0
- data/ext/v8/upstream/3.1.8/src/d8.h +231 -0
- data/ext/v8/upstream/3.1.8/src/d8.js +2798 -0
- data/ext/v8/upstream/3.1.8/src/data-flow.cc +545 -0
- data/ext/v8/upstream/3.1.8/src/data-flow.h +379 -0
- data/ext/v8/upstream/3.1.8/src/date.js +1103 -0
- data/ext/v8/upstream/3.1.8/src/dateparser-inl.h +125 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/dateparser.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/dateparser.h +263 -0
- data/ext/v8/upstream/3.1.8/src/debug-agent.cc +446 -0
- data/ext/v8/upstream/3.1.8/src/debug-agent.h +131 -0
- data/ext/v8/upstream/3.1.8/src/debug-debugger.js +2569 -0
- data/ext/v8/upstream/3.1.8/src/debug.cc +3085 -0
- data/ext/v8/upstream/3.1.8/src/debug.h +1025 -0
- data/ext/v8/upstream/3.1.8/src/deoptimizer.cc +1185 -0
- data/ext/v8/upstream/3.1.8/src/deoptimizer.h +529 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/disasm.h +0 -0
- data/ext/v8/upstream/3.1.8/src/disassembler.cc +338 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/disassembler.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/diy-fp.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/diy-fp.h +0 -0
- data/ext/v8/upstream/3.1.8/src/double.h +238 -0
- data/ext/v8/upstream/3.1.8/src/dtoa.cc +103 -0
- data/ext/v8/upstream/3.1.8/src/dtoa.h +85 -0
- data/ext/v8/upstream/3.1.8/src/execution.cc +735 -0
- data/ext/v8/upstream/3.1.8/src/execution.h +322 -0
- data/ext/v8/upstream/3.1.8/src/extensions/experimental/experimental.gyp +53 -0
- data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.cc +264 -0
- data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.h +64 -0
- data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.cc +141 -0
- data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.h +50 -0
- data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.cc +58 -0
- data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.h +49 -0
- data/ext/v8/upstream/3.1.8/src/factory.cc +1087 -0
- data/ext/v8/upstream/3.1.8/src/factory.h +432 -0
- data/ext/v8/upstream/3.1.8/src/fast-dtoa.cc +736 -0
- data/ext/v8/upstream/3.1.8/src/fast-dtoa.h +83 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/fixed-dtoa.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/fixed-dtoa.h +0 -0
- data/ext/v8/upstream/3.1.8/src/flag-definitions.h +552 -0
- data/ext/v8/upstream/3.1.8/src/flags.cc +551 -0
- data/ext/v8/upstream/3.1.8/src/flags.h +79 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/frame-element.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/frame-element.h +277 -0
- data/ext/v8/upstream/3.1.8/src/frames-inl.h +210 -0
- data/ext/v8/upstream/3.1.8/src/frames.cc +1232 -0
- data/ext/v8/upstream/3.1.8/src/frames.h +826 -0
- data/ext/v8/upstream/3.1.8/src/full-codegen.cc +1382 -0
- data/ext/v8/upstream/3.1.8/src/full-codegen.h +751 -0
- data/ext/v8/upstream/3.1.8/src/func-name-inferrer.cc +90 -0
- data/ext/v8/upstream/3.1.8/src/func-name-inferrer.h +111 -0
- data/ext/v8/upstream/3.1.8/src/gdb-jit.cc +1547 -0
- data/ext/v8/upstream/3.1.8/src/gdb-jit.h +138 -0
- data/ext/v8/upstream/3.1.8/src/global-handles.cc +534 -0
- data/ext/v8/upstream/3.1.8/src/global-handles.h +181 -0
- data/ext/v8/upstream/3.1.8/src/globals.h +325 -0
- data/ext/v8/upstream/3.1.8/src/handles-inl.h +80 -0
- data/ext/v8/upstream/3.1.8/src/handles.cc +910 -0
- data/ext/v8/upstream/3.1.8/src/handles.h +424 -0
- data/ext/v8/upstream/3.1.8/src/hashmap.cc +230 -0
- data/ext/v8/upstream/3.1.8/src/hashmap.h +121 -0
- data/ext/v8/upstream/3.1.8/src/heap-inl.h +587 -0
- data/ext/v8/upstream/3.1.8/src/heap-profiler.cc +1128 -0
- data/ext/v8/upstream/3.1.8/src/heap-profiler.h +381 -0
- data/ext/v8/upstream/3.1.8/src/heap.cc +5610 -0
- data/ext/v8/upstream/3.1.8/src/heap.h +2218 -0
- data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.cc +1490 -0
- data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.h +3493 -0
- data/ext/v8/upstream/3.1.8/src/hydrogen.cc +6056 -0
- data/ext/v8/upstream/3.1.8/src/hydrogen.h +1091 -0
- data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32-inl.h +429 -0
- data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.cc +2800 -0
- data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.h +1093 -0
- data/ext/v8/upstream/3.1.8/src/ia32/builtins-ia32.cc +1590 -0
- data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.cc +6624 -0
- data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.h +536 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/codegen-ia32-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.cc +10354 -0
- data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.h +798 -0
- data/ext/v8/upstream/3.1.8/src/ia32/cpu-ia32.cc +87 -0
- data/ext/v8/upstream/3.1.8/src/ia32/debug-ia32.cc +309 -0
- data/ext/v8/upstream/3.1.8/src/ia32/deoptimizer-ia32.cc +664 -0
- data/ext/v8/upstream/3.1.8/src/ia32/disasm-ia32.cc +1597 -0
- data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.cc +45 -0
- data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.h +140 -0
- data/ext/v8/upstream/3.1.8/src/ia32/full-codegen-ia32.cc +4278 -0
- data/ext/v8/upstream/3.1.8/src/ia32/ic-ia32.cc +1786 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/jump-target-ia32.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.cc +3880 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.h +309 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.cc +460 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.cc +2095 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.h +2127 -0
- data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.cc +2031 -0
- data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.h +798 -0
- data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.cc +1253 -0
- data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.h +215 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/simulator-ia32.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/ia32/simulator-ia32.h +72 -0
- data/ext/v8/upstream/3.1.8/src/ia32/stub-cache-ia32.cc +3732 -0
- data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.cc +1360 -0
- data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.h +646 -0
- data/ext/v8/upstream/3.1.8/src/ic-inl.h +129 -0
- data/ext/v8/upstream/3.1.8/src/ic.cc +2333 -0
- data/ext/v8/upstream/3.1.8/src/ic.h +639 -0
- data/ext/v8/upstream/3.1.8/src/inspector.cc +63 -0
- data/ext/v8/upstream/3.1.8/src/inspector.h +62 -0
- data/ext/v8/upstream/3.1.8/src/interpreter-irregexp.cc +655 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/interpreter-irregexp.h +0 -0
- data/ext/v8/upstream/3.1.8/src/json.js +342 -0
- data/ext/v8/upstream/3.1.8/src/jsregexp.cc +5340 -0
- data/ext/v8/upstream/3.1.8/src/jsregexp.h +1484 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-heavy-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/jump-target-heavy.cc +430 -0
- data/ext/v8/upstream/3.1.8/src/jump-target-heavy.h +244 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-light-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/jump-target-light.cc +111 -0
- data/ext/v8/upstream/3.1.8/src/jump-target-light.h +193 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target.h +0 -0
- data/ext/v8/upstream/3.1.8/src/list-inl.h +206 -0
- data/ext/v8/upstream/3.1.8/src/list.h +164 -0
- data/ext/v8/upstream/3.1.8/src/lithium-allocator-inl.h +140 -0
- data/ext/v8/upstream/3.1.8/src/lithium-allocator.cc +2093 -0
- data/ext/v8/upstream/3.1.8/src/lithium-allocator.h +644 -0
- data/ext/v8/upstream/3.1.8/src/lithium.cc +168 -0
- data/ext/v8/upstream/3.1.8/src/lithium.h +592 -0
- data/ext/v8/upstream/3.1.8/src/liveedit-debugger.js +1082 -0
- data/ext/v8/upstream/3.1.8/src/liveedit.cc +1650 -0
- data/ext/v8/upstream/3.1.8/src/liveedit.h +174 -0
- data/ext/v8/upstream/3.1.8/src/liveobjectlist-inl.h +126 -0
- data/ext/v8/upstream/3.1.8/src/liveobjectlist.cc +2527 -0
- data/ext/v8/upstream/3.1.8/src/liveobjectlist.h +322 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/log-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/log-utils.cc +336 -0
- data/ext/v8/upstream/3.1.8/src/log-utils.h +232 -0
- data/ext/v8/upstream/3.1.8/src/log.cc +1608 -0
- data/ext/v8/upstream/3.1.8/src/log.h +379 -0
- data/ext/v8/upstream/3.1.8/src/macro-assembler.h +120 -0
- data/ext/v8/upstream/3.1.8/src/macros.py +178 -0
- data/ext/v8/upstream/3.1.8/src/mark-compact.cc +2957 -0
- data/ext/v8/upstream/3.1.8/src/mark-compact.h +433 -0
- data/ext/v8/upstream/3.1.8/src/math.js +264 -0
- data/ext/v8/upstream/3.1.8/src/memory.h +82 -0
- data/ext/v8/upstream/3.1.8/src/messages.cc +164 -0
- data/ext/v8/upstream/3.1.8/src/messages.h +114 -0
- data/ext/v8/upstream/3.1.8/src/messages.js +1071 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/assembler-mips-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/assembler-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/assembler-mips.h +667 -0
- data/ext/v8/upstream/3.1.8/src/mips/builtins-mips.cc +205 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/codegen-mips-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/codegen-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/codegen-mips.h +431 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/constants-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/constants-mips.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/cpu-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/debug-mips.cc +127 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/disasm-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/fast-codegen-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/frames-mips.cc +96 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/frames-mips.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/full-codegen-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/ic-mips.cc +208 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/jump-target-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/macro-assembler-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/macro-assembler-mips.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips.h +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.cc +1650 -0
- data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.h +311 -0
- data/ext/v8/upstream/3.1.8/src/mips/stub-cache-mips.cc +418 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/virtual-frame-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/virtual-frame-mips.h +0 -0
- data/ext/v8/upstream/3.1.8/src/mirror-debugger.js +2380 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mksnapshot.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/natives.h +0 -0
- data/ext/v8/upstream/3.1.8/src/objects-debug.cc +722 -0
- data/ext/v8/upstream/3.1.8/src/objects-inl.h +3946 -0
- data/ext/v8/upstream/3.1.8/src/objects-printer.cc +801 -0
- data/ext/v8/upstream/3.1.8/src/objects-visiting.cc +142 -0
- data/ext/v8/upstream/3.1.8/src/objects-visiting.h +401 -0
- data/ext/v8/upstream/3.1.8/src/objects.cc +10044 -0
- data/ext/v8/upstream/3.1.8/src/objects.h +6571 -0
- data/ext/v8/upstream/3.1.8/src/parser.cc +5165 -0
- data/ext/v8/upstream/3.1.8/src/parser.h +802 -0
- data/ext/v8/upstream/3.1.8/src/platform-cygwin.cc +745 -0
- data/ext/v8/upstream/3.1.8/src/platform-freebsd.cc +702 -0
- data/ext/v8/upstream/3.1.8/src/platform-linux.cc +981 -0
- data/ext/v8/upstream/3.1.8/src/platform-macos.cc +732 -0
- data/ext/v8/upstream/3.1.8/src/platform-nullos.cc +498 -0
- data/ext/v8/upstream/3.1.8/src/platform-openbsd.cc +657 -0
- data/ext/v8/upstream/3.1.8/src/platform-posix.cc +399 -0
- data/ext/v8/upstream/3.1.8/src/platform-solaris.cc +714 -0
- data/ext/v8/upstream/3.1.8/src/platform-win32.cc +1974 -0
- data/ext/v8/upstream/3.1.8/src/platform.h +636 -0
- data/ext/v8/upstream/3.1.8/src/preparse-data.cc +183 -0
- data/ext/v8/upstream/3.1.8/src/preparse-data.h +249 -0
- data/ext/v8/upstream/3.1.8/src/preparser-api.cc +213 -0
- data/ext/v8/upstream/3.1.8/src/preparser.cc +1205 -0
- data/ext/v8/upstream/3.1.8/src/preparser.h +278 -0
- data/ext/v8/upstream/3.1.8/src/prettyprinter.cc +1539 -0
- data/ext/v8/upstream/3.1.8/src/prettyprinter.h +223 -0
- data/ext/v8/upstream/3.1.8/src/profile-generator-inl.h +128 -0
- data/ext/v8/upstream/3.1.8/src/profile-generator.cc +2899 -0
- data/ext/v8/upstream/3.1.8/src/profile-generator.h +1151 -0
- data/ext/v8/upstream/3.1.8/src/property.cc +96 -0
- data/ext/v8/upstream/3.1.8/src/property.h +337 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-macro-assembler-irregexp-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.cc +470 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.h +142 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-tracer.cc +373 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-tracer.h +104 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.cc +257 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.h +231 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-stack.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-stack.h +0 -0
- data/ext/v8/upstream/3.1.8/src/regexp.js +483 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator.h +0 -0
- data/ext/v8/upstream/3.1.8/src/rewriter.cc +1023 -0
- data/ext/v8/upstream/3.1.8/src/rewriter.h +59 -0
- data/ext/v8/upstream/3.1.8/src/runtime-profiler.cc +443 -0
- data/ext/v8/upstream/3.1.8/src/runtime-profiler.h +77 -0
- data/ext/v8/upstream/3.1.8/src/runtime.cc +11592 -0
- data/ext/v8/upstream/3.1.8/src/runtime.h +582 -0
- data/ext/v8/upstream/3.1.8/src/runtime.js +643 -0
- data/ext/v8/upstream/3.1.8/src/safepoint-table.cc +253 -0
- data/ext/v8/upstream/3.1.8/src/safepoint-table.h +263 -0
- data/ext/v8/upstream/3.1.8/src/scanner-base.cc +971 -0
- data/ext/v8/upstream/3.1.8/src/scanner-base.h +653 -0
- data/ext/v8/upstream/3.1.8/src/scanner.cc +586 -0
- data/ext/v8/upstream/3.1.8/src/scanner.h +194 -0
- data/ext/v8/upstream/3.1.8/src/scopeinfo.cc +636 -0
- data/ext/v8/upstream/3.1.8/src/scopeinfo.h +238 -0
- data/ext/v8/upstream/3.1.8/src/scopes.cc +1063 -0
- data/ext/v8/upstream/3.1.8/src/scopes.h +494 -0
- data/ext/v8/upstream/3.1.8/src/serialize.cc +1535 -0
- data/ext/v8/upstream/3.1.8/src/serialize.h +584 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/shell.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/simulator.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/smart-pointer.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot-common.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot-empty.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot.h +0 -0
- data/ext/v8/upstream/3.1.8/src/spaces-inl.h +524 -0
- data/ext/v8/upstream/3.1.8/src/spaces.cc +3254 -0
- data/ext/v8/upstream/3.1.8/src/spaces.h +2362 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/splay-tree-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/splay-tree.h +0 -0
- data/ext/v8/upstream/3.1.8/src/string-search.cc +40 -0
- data/ext/v8/upstream/3.1.8/src/string-search.h +567 -0
- data/ext/v8/upstream/3.1.8/src/string-stream.cc +584 -0
- data/ext/v8/upstream/3.1.8/src/string-stream.h +191 -0
- data/ext/v8/upstream/3.1.8/src/string.js +915 -0
- data/ext/v8/upstream/3.1.8/src/strtod.cc +440 -0
- data/ext/v8/upstream/3.1.8/src/strtod.h +40 -0
- data/ext/v8/upstream/3.1.8/src/stub-cache.cc +1878 -0
- data/ext/v8/upstream/3.1.8/src/stub-cache.h +849 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/third_party/valgrind/valgrind.h +0 -0
- data/ext/v8/upstream/3.1.8/src/token.cc +63 -0
- data/ext/v8/upstream/3.1.8/src/token.h +288 -0
- data/ext/v8/upstream/3.1.8/src/top.cc +1152 -0
- data/ext/v8/upstream/3.1.8/src/top.h +608 -0
- data/ext/v8/upstream/3.1.8/src/type-info.cc +406 -0
- data/ext/v8/upstream/3.1.8/src/type-info.h +283 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/unbound-queue-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/unbound-queue.h +0 -0
- data/ext/v8/upstream/3.1.8/src/unicode-inl.h +238 -0
- data/ext/v8/upstream/3.1.8/src/unicode.cc +1624 -0
- data/ext/v8/upstream/3.1.8/src/unicode.h +280 -0
- data/ext/v8/upstream/3.1.8/src/uri.js +402 -0
- data/ext/v8/upstream/3.1.8/src/utils.cc +371 -0
- data/ext/v8/upstream/3.1.8/src/utils.h +793 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/v8-counters.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/v8-counters.h +290 -0
- data/ext/v8/upstream/3.1.8/src/v8.cc +270 -0
- data/ext/v8/upstream/3.1.8/src/v8.h +127 -0
- data/ext/v8/upstream/3.1.8/src/v8checks.h +64 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/v8dll-main.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/v8globals.h +480 -0
- data/ext/v8/upstream/3.1.8/src/v8natives.js +1252 -0
- data/ext/v8/upstream/3.1.8/src/v8preparserdll-main.cc +39 -0
- data/ext/v8/upstream/3.1.8/src/v8threads.cc +440 -0
- data/ext/v8/upstream/3.1.8/src/v8threads.h +157 -0
- data/ext/v8/upstream/3.1.8/src/v8utils.h +354 -0
- data/ext/v8/upstream/3.1.8/src/variables.cc +132 -0
- data/ext/v8/upstream/3.1.8/src/variables.h +212 -0
- data/ext/v8/upstream/3.1.8/src/version.cc +95 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/version.h +0 -0
- data/ext/v8/upstream/3.1.8/src/virtual-frame-heavy-inl.h +190 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-heavy.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-light-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-light.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/virtual-frame.h +59 -0
- data/ext/v8/upstream/3.1.8/src/vm-state-inl.h +134 -0
- data/ext/v8/upstream/3.1.8/src/vm-state.h +68 -0
- data/ext/v8/upstream/3.1.8/src/win32-headers.h +95 -0
- data/ext/v8/upstream/3.1.8/src/x64/assembler-x64-inl.h +455 -0
- data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.cc +3162 -0
- data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.h +1584 -0
- data/ext/v8/upstream/3.1.8/src/x64/builtins-x64.cc +1492 -0
- data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.cc +5150 -0
- data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.h +519 -0
- data/ext/v8/upstream/3.1.8/src/x64/codegen-x64-inl.h +46 -0
- data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.cc +8835 -0
- data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.h +750 -0
- data/ext/v8/upstream/3.1.8/src/x64/cpu-x64.cc +86 -0
- data/ext/v8/upstream/3.1.8/src/x64/debug-x64.cc +316 -0
- data/ext/v8/upstream/3.1.8/src/x64/deoptimizer-x64.cc +781 -0
- data/ext/v8/upstream/3.1.8/src/x64/disasm-x64.cc +1737 -0
- data/ext/v8/upstream/3.1.8/src/x64/frames-x64.cc +45 -0
- data/ext/v8/upstream/3.1.8/src/x64/frames-x64.h +130 -0
- data/ext/v8/upstream/3.1.8/src/x64/full-codegen-x64.cc +3984 -0
- data/ext/v8/upstream/3.1.8/src/x64/ic-x64.cc +1761 -0
- data/ext/v8/upstream/3.1.8/src/x64/jump-target-x64.cc +437 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.cc +3639 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.h +305 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-gap-resolver-x64.cc +320 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-gap-resolver-x64.h +74 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.cc +2044 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.h +2052 -0
- data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.cc +2660 -0
- data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.h +1852 -0
- data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.cc +1382 -0
- data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.h +278 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/simulator-x64.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/x64/simulator-x64.h +71 -0
- data/ext/v8/upstream/3.1.8/src/x64/stub-cache-x64.cc +3509 -0
- data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.cc +1292 -0
- data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.h +593 -0
- data/ext/v8/upstream/3.1.8/src/zone-inl.h +83 -0
- data/ext/v8/upstream/3.1.8/src/zone.cc +195 -0
- data/ext/v8/upstream/3.1.8/src/zone.h +233 -0
- data/ext/v8/upstream/3.1.8/tools/codemap.js +265 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/consarray.js +0 -0
- data/ext/v8/upstream/3.1.8/tools/csvparser.js +78 -0
- data/ext/v8/upstream/3.1.8/tools/disasm.py +92 -0
- data/ext/v8/upstream/3.1.8/tools/gc-nvp-trace-processor.py +328 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/generate-ten-powers.scm +0 -0
- data/ext/v8/upstream/3.1.8/tools/grokdump.py +840 -0
- data/ext/v8/upstream/3.1.8/tools/gyp/v8.gyp +869 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/js2c.py +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/jsmin.py +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/linux-tick-processor +0 -0
- data/ext/v8/upstream/3.1.8/tools/ll_prof.py +919 -0
- data/ext/v8/upstream/3.1.8/tools/logreader.js +185 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/mac-nm +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/mac-tick-processor +0 -0
- data/ext/v8/upstream/3.1.8/tools/oom_dump/README +31 -0
- data/ext/v8/upstream/3.1.8/tools/oom_dump/SConstruct +42 -0
- data/ext/v8/upstream/3.1.8/tools/oom_dump/oom_dump.cc +288 -0
- data/ext/v8/upstream/3.1.8/tools/presubmit.py +305 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/process-heap-prof.py +0 -0
- data/ext/v8/upstream/3.1.8/tools/profile.js +751 -0
- data/ext/v8/upstream/3.1.8/tools/profile_view.js +219 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/run-valgrind.py +0 -0
- data/ext/v8/upstream/3.1.8/tools/splaytree.js +316 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/stats-viewer.py +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/tickprocessor-driver.js +0 -0
- data/ext/v8/upstream/3.1.8/tools/tickprocessor.js +863 -0
- data/ext/v8/upstream/3.1.8/tools/utils.py +96 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/README.txt +70 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/arm.vsprops +0 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/common.vsprops +34 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8_arm.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8js2c.cmd +0 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/debug.vsprops +17 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/ia32.vsprops +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/js2c.cmd +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/release.vsprops +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8.sln +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_arm.sln +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_arm.vcproj +0 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base.vcproj +1296 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_arm.vcproj +1234 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_x64.vcproj +1296 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest_arm.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_mksnapshot.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample_arm.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample_x64.vcproj +0 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample.vcproj +147 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample_arm.vcproj +147 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample_x64.vcproj +163 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_cc.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_x64.sln +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/x64.vsprops +0 -0
- data/ext/v8/upstream/3.1.8/tools/windows-tick-processor.bat +30 -0
- data/ext/v8/upstream/Makefile +2 -1
- data/ext/v8/v8_template.cpp +2 -2
- data/lib/v8/version.rb +1 -1
- data/spec/redjs/jsapi_spec.rb +2 -2
- metadata +552 -490
- data/ext/v8/upstream/2.3.3/.gitignore +0 -26
- data/ext/v8/upstream/2.3.3/AUTHORS +0 -31
- data/ext/v8/upstream/2.3.3/ChangeLog +0 -1916
- data/ext/v8/upstream/2.3.3/LICENSE +0 -55
- data/ext/v8/upstream/2.3.3/SConstruct +0 -1154
- data/ext/v8/upstream/2.3.3/include/v8-debug.h +0 -381
- data/ext/v8/upstream/2.3.3/include/v8-profiler.h +0 -353
- data/ext/v8/upstream/2.3.3/include/v8.h +0 -3616
- data/ext/v8/upstream/2.3.3/src/SConscript +0 -330
- data/ext/v8/upstream/2.3.3/src/accessors.cc +0 -661
- data/ext/v8/upstream/2.3.3/src/accessors.h +0 -114
- data/ext/v8/upstream/2.3.3/src/allocation.cc +0 -198
- data/ext/v8/upstream/2.3.3/src/allocation.h +0 -169
- data/ext/v8/upstream/2.3.3/src/api.cc +0 -4795
- data/ext/v8/upstream/2.3.3/src/api.h +0 -485
- data/ext/v8/upstream/2.3.3/src/apiutils.h +0 -69
- data/ext/v8/upstream/2.3.3/src/arguments.h +0 -96
- data/ext/v8/upstream/2.3.3/src/arm/assembler-arm-inl.h +0 -305
- data/ext/v8/upstream/2.3.3/src/arm/assembler-arm.cc +0 -2580
- data/ext/v8/upstream/2.3.3/src/arm/assembler-arm.h +0 -1275
- data/ext/v8/upstream/2.3.3/src/arm/builtins-arm.cc +0 -1320
- data/ext/v8/upstream/2.3.3/src/arm/codegen-arm-inl.h +0 -48
- data/ext/v8/upstream/2.3.3/src/arm/codegen-arm.cc +0 -11398
- data/ext/v8/upstream/2.3.3/src/arm/codegen-arm.h +0 -1102
- data/ext/v8/upstream/2.3.3/src/arm/constants-arm.cc +0 -154
- data/ext/v8/upstream/2.3.3/src/arm/constants-arm.h +0 -388
- data/ext/v8/upstream/2.3.3/src/arm/cpu-arm.cc +0 -142
- data/ext/v8/upstream/2.3.3/src/arm/debug-arm.cc +0 -309
- data/ext/v8/upstream/2.3.3/src/arm/disasm-arm.cc +0 -1459
- data/ext/v8/upstream/2.3.3/src/arm/fast-codegen-arm.cc +0 -241
- data/ext/v8/upstream/2.3.3/src/arm/frames-arm.cc +0 -123
- data/ext/v8/upstream/2.3.3/src/arm/frames-arm.h +0 -162
- data/ext/v8/upstream/2.3.3/src/arm/full-codegen-arm.cc +0 -3178
- data/ext/v8/upstream/2.3.3/src/arm/ic-arm.cc +0 -2258
- data/ext/v8/upstream/2.3.3/src/arm/jump-target-arm.cc +0 -164
- data/ext/v8/upstream/2.3.3/src/arm/macro-assembler-arm.cc +0 -1892
- data/ext/v8/upstream/2.3.3/src/arm/macro-assembler-arm.h +0 -727
- data/ext/v8/upstream/2.3.3/src/arm/regexp-macro-assembler-arm.cc +0 -1261
- data/ext/v8/upstream/2.3.3/src/arm/regexp-macro-assembler-arm.h +0 -266
- data/ext/v8/upstream/2.3.3/src/arm/simulator-arm.cc +0 -2822
- data/ext/v8/upstream/2.3.3/src/arm/simulator-arm.h +0 -361
- data/ext/v8/upstream/2.3.3/src/arm/stub-cache-arm.cc +0 -2387
- data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm.cc +0 -834
- data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm.h +0 -519
- data/ext/v8/upstream/2.3.3/src/array.js +0 -1127
- data/ext/v8/upstream/2.3.3/src/assembler.cc +0 -801
- data/ext/v8/upstream/2.3.3/src/assembler.h +0 -573
- data/ext/v8/upstream/2.3.3/src/ast-inl.h +0 -81
- data/ext/v8/upstream/2.3.3/src/ast.cc +0 -1152
- data/ext/v8/upstream/2.3.3/src/ast.h +0 -2106
- data/ext/v8/upstream/2.3.3/src/bootstrapper.cc +0 -1819
- data/ext/v8/upstream/2.3.3/src/builtins.cc +0 -1529
- data/ext/v8/upstream/2.3.3/src/builtins.h +0 -263
- data/ext/v8/upstream/2.3.3/src/bytecodes-irregexp.h +0 -104
- data/ext/v8/upstream/2.3.3/src/cached-powers.h +0 -119
- data/ext/v8/upstream/2.3.3/src/char-predicates-inl.h +0 -86
- data/ext/v8/upstream/2.3.3/src/checks.cc +0 -100
- data/ext/v8/upstream/2.3.3/src/checks.h +0 -310
- data/ext/v8/upstream/2.3.3/src/circular-queue.cc +0 -121
- data/ext/v8/upstream/2.3.3/src/code-stubs.cc +0 -177
- data/ext/v8/upstream/2.3.3/src/code-stubs.h +0 -177
- data/ext/v8/upstream/2.3.3/src/codegen-inl.h +0 -60
- data/ext/v8/upstream/2.3.3/src/codegen.cc +0 -516
- data/ext/v8/upstream/2.3.3/src/codegen.h +0 -897
- data/ext/v8/upstream/2.3.3/src/compilation-cache.cc +0 -562
- data/ext/v8/upstream/2.3.3/src/compilation-cache.h +0 -102
- data/ext/v8/upstream/2.3.3/src/compiler.cc +0 -654
- data/ext/v8/upstream/2.3.3/src/compiler.h +0 -299
- data/ext/v8/upstream/2.3.3/src/contexts.cc +0 -256
- data/ext/v8/upstream/2.3.3/src/contexts.h +0 -342
- data/ext/v8/upstream/2.3.3/src/conversions.cc +0 -1119
- data/ext/v8/upstream/2.3.3/src/conversions.h +0 -123
- data/ext/v8/upstream/2.3.3/src/counters.h +0 -239
- data/ext/v8/upstream/2.3.3/src/cpu-profiler-inl.h +0 -100
- data/ext/v8/upstream/2.3.3/src/cpu-profiler.cc +0 -538
- data/ext/v8/upstream/2.3.3/src/cpu-profiler.h +0 -285
- data/ext/v8/upstream/2.3.3/src/d8-debug.cc +0 -356
- data/ext/v8/upstream/2.3.3/src/d8-debug.h +0 -155
- data/ext/v8/upstream/2.3.3/src/d8.cc +0 -783
- data/ext/v8/upstream/2.3.3/src/d8.h +0 -227
- data/ext/v8/upstream/2.3.3/src/d8.js +0 -1683
- data/ext/v8/upstream/2.3.3/src/data-flow.cc +0 -758
- data/ext/v8/upstream/2.3.3/src/data-flow.h +0 -278
- data/ext/v8/upstream/2.3.3/src/date.js +0 -1059
- data/ext/v8/upstream/2.3.3/src/dateparser-inl.h +0 -123
- data/ext/v8/upstream/2.3.3/src/dateparser.h +0 -244
- data/ext/v8/upstream/2.3.3/src/debug-agent.cc +0 -427
- data/ext/v8/upstream/2.3.3/src/debug-agent.h +0 -129
- data/ext/v8/upstream/2.3.3/src/debug-debugger.js +0 -2227
- data/ext/v8/upstream/2.3.3/src/debug.cc +0 -3005
- data/ext/v8/upstream/2.3.3/src/debug.h +0 -993
- data/ext/v8/upstream/2.3.3/src/disassembler.cc +0 -312
- data/ext/v8/upstream/2.3.3/src/double.h +0 -169
- data/ext/v8/upstream/2.3.3/src/dtoa-config.c +0 -92
- data/ext/v8/upstream/2.3.3/src/dtoa.cc +0 -77
- data/ext/v8/upstream/2.3.3/src/dtoa.h +0 -81
- data/ext/v8/upstream/2.3.3/src/execution.cc +0 -809
- data/ext/v8/upstream/2.3.3/src/execution.h +0 -336
- data/ext/v8/upstream/2.3.3/src/factory.cc +0 -1003
- data/ext/v8/upstream/2.3.3/src/factory.h +0 -410
- data/ext/v8/upstream/2.3.3/src/fast-codegen.cc +0 -746
- data/ext/v8/upstream/2.3.3/src/fast-codegen.h +0 -161
- data/ext/v8/upstream/2.3.3/src/fast-dtoa.cc +0 -505
- data/ext/v8/upstream/2.3.3/src/fast-dtoa.h +0 -58
- data/ext/v8/upstream/2.3.3/src/flag-definitions.h +0 -455
- data/ext/v8/upstream/2.3.3/src/flags.cc +0 -551
- data/ext/v8/upstream/2.3.3/src/flags.h +0 -81
- data/ext/v8/upstream/2.3.3/src/flow-graph.cc +0 -763
- data/ext/v8/upstream/2.3.3/src/flow-graph.h +0 -180
- data/ext/v8/upstream/2.3.3/src/frame-element.h +0 -273
- data/ext/v8/upstream/2.3.3/src/frames-inl.h +0 -217
- data/ext/v8/upstream/2.3.3/src/frames.cc +0 -826
- data/ext/v8/upstream/2.3.3/src/frames.h +0 -682
- data/ext/v8/upstream/2.3.3/src/full-codegen.cc +0 -1443
- data/ext/v8/upstream/2.3.3/src/full-codegen.h +0 -548
- data/ext/v8/upstream/2.3.3/src/func-name-inferrer.cc +0 -76
- data/ext/v8/upstream/2.3.3/src/func-name-inferrer.h +0 -135
- data/ext/v8/upstream/2.3.3/src/global-handles.cc +0 -520
- data/ext/v8/upstream/2.3.3/src/global-handles.h +0 -180
- data/ext/v8/upstream/2.3.3/src/globals.h +0 -669
- data/ext/v8/upstream/2.3.3/src/handles-inl.h +0 -76
- data/ext/v8/upstream/2.3.3/src/handles.cc +0 -825
- data/ext/v8/upstream/2.3.3/src/handles.h +0 -393
- data/ext/v8/upstream/2.3.3/src/hashmap.cc +0 -226
- data/ext/v8/upstream/2.3.3/src/hashmap.h +0 -120
- data/ext/v8/upstream/2.3.3/src/heap-inl.h +0 -493
- data/ext/v8/upstream/2.3.3/src/heap-profiler.cc +0 -779
- data/ext/v8/upstream/2.3.3/src/heap-profiler.h +0 -323
- data/ext/v8/upstream/2.3.3/src/heap.cc +0 -4994
- data/ext/v8/upstream/2.3.3/src/heap.h +0 -1984
- data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32-inl.h +0 -360
- data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32.cc +0 -2600
- data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32.h +0 -969
- data/ext/v8/upstream/2.3.3/src/ia32/builtins-ia32.cc +0 -1261
- data/ext/v8/upstream/2.3.3/src/ia32/codegen-ia32.cc +0 -13968
- data/ext/v8/upstream/2.3.3/src/ia32/codegen-ia32.h +0 -1097
- data/ext/v8/upstream/2.3.3/src/ia32/cpu-ia32.cc +0 -83
- data/ext/v8/upstream/2.3.3/src/ia32/debug-ia32.cc +0 -309
- data/ext/v8/upstream/2.3.3/src/ia32/disasm-ia32.cc +0 -1471
- data/ext/v8/upstream/2.3.3/src/ia32/fast-codegen-ia32.cc +0 -954
- data/ext/v8/upstream/2.3.3/src/ia32/fast-codegen-ia32.h +0 -155
- data/ext/v8/upstream/2.3.3/src/ia32/frames-ia32.cc +0 -115
- data/ext/v8/upstream/2.3.3/src/ia32/frames-ia32.h +0 -135
- data/ext/v8/upstream/2.3.3/src/ia32/full-codegen-ia32.cc +0 -3281
- data/ext/v8/upstream/2.3.3/src/ia32/ic-ia32.cc +0 -1966
- data/ext/v8/upstream/2.3.3/src/ia32/macro-assembler-ia32.cc +0 -1610
- data/ext/v8/upstream/2.3.3/src/ia32/macro-assembler-ia32.h +0 -610
- data/ext/v8/upstream/2.3.3/src/ia32/regexp-macro-assembler-ia32.cc +0 -1247
- data/ext/v8/upstream/2.3.3/src/ia32/regexp-macro-assembler-ia32.h +0 -214
- data/ext/v8/upstream/2.3.3/src/ia32/simulator-ia32.h +0 -62
- data/ext/v8/upstream/2.3.3/src/ia32/stub-cache-ia32.cc +0 -2750
- data/ext/v8/upstream/2.3.3/src/ia32/virtual-frame-ia32.cc +0 -1334
- data/ext/v8/upstream/2.3.3/src/ia32/virtual-frame-ia32.h +0 -627
- data/ext/v8/upstream/2.3.3/src/ic-inl.h +0 -120
- data/ext/v8/upstream/2.3.3/src/ic.cc +0 -1827
- data/ext/v8/upstream/2.3.3/src/ic.h +0 -515
- data/ext/v8/upstream/2.3.3/src/interpreter-irregexp.cc +0 -646
- data/ext/v8/upstream/2.3.3/src/json.js +0 -268
- data/ext/v8/upstream/2.3.3/src/jsregexp.cc +0 -5283
- data/ext/v8/upstream/2.3.3/src/jsregexp.h +0 -1463
- data/ext/v8/upstream/2.3.3/src/jump-target-heavy.cc +0 -429
- data/ext/v8/upstream/2.3.3/src/jump-target-heavy.h +0 -244
- data/ext/v8/upstream/2.3.3/src/jump-target-light.cc +0 -110
- data/ext/v8/upstream/2.3.3/src/jump-target-light.h +0 -192
- data/ext/v8/upstream/2.3.3/src/list-inl.h +0 -166
- data/ext/v8/upstream/2.3.3/src/list.h +0 -159
- data/ext/v8/upstream/2.3.3/src/liveedit-debugger.js +0 -1057
- data/ext/v8/upstream/2.3.3/src/liveedit.cc +0 -1480
- data/ext/v8/upstream/2.3.3/src/liveedit.h +0 -170
- data/ext/v8/upstream/2.3.3/src/log-utils.cc +0 -497
- data/ext/v8/upstream/2.3.3/src/log-utils.h +0 -289
- data/ext/v8/upstream/2.3.3/src/log.cc +0 -1561
- data/ext/v8/upstream/2.3.3/src/log.h +0 -384
- data/ext/v8/upstream/2.3.3/src/macro-assembler.h +0 -86
- data/ext/v8/upstream/2.3.3/src/macros.py +0 -177
- data/ext/v8/upstream/2.3.3/src/mark-compact.cc +0 -2330
- data/ext/v8/upstream/2.3.3/src/mark-compact.h +0 -451
- data/ext/v8/upstream/2.3.3/src/math.js +0 -264
- data/ext/v8/upstream/2.3.3/src/memory.h +0 -74
- data/ext/v8/upstream/2.3.3/src/messages.cc +0 -183
- data/ext/v8/upstream/2.3.3/src/messages.h +0 -113
- data/ext/v8/upstream/2.3.3/src/messages.js +0 -982
- data/ext/v8/upstream/2.3.3/src/mips/assembler-mips.h +0 -668
- data/ext/v8/upstream/2.3.3/src/mips/builtins-mips.cc +0 -205
- data/ext/v8/upstream/2.3.3/src/mips/codegen-mips.h +0 -434
- data/ext/v8/upstream/2.3.3/src/mips/debug-mips.cc +0 -131
- data/ext/v8/upstream/2.3.3/src/mips/frames-mips.cc +0 -102
- data/ext/v8/upstream/2.3.3/src/mips/ic-mips.cc +0 -220
- data/ext/v8/upstream/2.3.3/src/mips/simulator-mips.cc +0 -1651
- data/ext/v8/upstream/2.3.3/src/mips/simulator-mips.h +0 -311
- data/ext/v8/upstream/2.3.3/src/mips/stub-cache-mips.cc +0 -403
- data/ext/v8/upstream/2.3.3/src/mirror-debugger.js +0 -2380
- data/ext/v8/upstream/2.3.3/src/objects-debug.cc +0 -1366
- data/ext/v8/upstream/2.3.3/src/objects-inl.h +0 -3333
- data/ext/v8/upstream/2.3.3/src/objects.cc +0 -8820
- data/ext/v8/upstream/2.3.3/src/objects.h +0 -5373
- data/ext/v8/upstream/2.3.3/src/oprofile-agent.cc +0 -108
- data/ext/v8/upstream/2.3.3/src/oprofile-agent.h +0 -77
- data/ext/v8/upstream/2.3.3/src/parser.cc +0 -5207
- data/ext/v8/upstream/2.3.3/src/parser.h +0 -197
- data/ext/v8/upstream/2.3.3/src/platform-freebsd.cc +0 -667
- data/ext/v8/upstream/2.3.3/src/platform-linux.cc +0 -862
- data/ext/v8/upstream/2.3.3/src/platform-macos.cc +0 -665
- data/ext/v8/upstream/2.3.3/src/platform-nullos.cc +0 -454
- data/ext/v8/upstream/2.3.3/src/platform-openbsd.cc +0 -622
- data/ext/v8/upstream/2.3.3/src/platform-posix.cc +0 -362
- data/ext/v8/upstream/2.3.3/src/platform-solaris.cc +0 -653
- data/ext/v8/upstream/2.3.3/src/platform-win32.cc +0 -1911
- data/ext/v8/upstream/2.3.3/src/platform.h +0 -577
- data/ext/v8/upstream/2.3.3/src/powers-ten.h +0 -2461
- data/ext/v8/upstream/2.3.3/src/prettyprinter.cc +0 -1531
- data/ext/v8/upstream/2.3.3/src/prettyprinter.h +0 -221
- data/ext/v8/upstream/2.3.3/src/profile-generator-inl.h +0 -148
- data/ext/v8/upstream/2.3.3/src/profile-generator.cc +0 -1830
- data/ext/v8/upstream/2.3.3/src/profile-generator.h +0 -853
- data/ext/v8/upstream/2.3.3/src/property.cc +0 -96
- data/ext/v8/upstream/2.3.3/src/property.h +0 -315
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-irregexp.cc +0 -464
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-irregexp.h +0 -141
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-tracer.cc +0 -356
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-tracer.h +0 -103
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler.cc +0 -261
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler.h +0 -228
- data/ext/v8/upstream/2.3.3/src/regexp.js +0 -549
- data/ext/v8/upstream/2.3.3/src/rewriter.cc +0 -1038
- data/ext/v8/upstream/2.3.3/src/rewriter.h +0 -54
- data/ext/v8/upstream/2.3.3/src/runtime.cc +0 -10599
- data/ext/v8/upstream/2.3.3/src/runtime.h +0 -459
- data/ext/v8/upstream/2.3.3/src/runtime.js +0 -629
- data/ext/v8/upstream/2.3.3/src/scanner.cc +0 -1346
- data/ext/v8/upstream/2.3.3/src/scanner.h +0 -503
- data/ext/v8/upstream/2.3.3/src/scopeinfo.cc +0 -637
- data/ext/v8/upstream/2.3.3/src/scopeinfo.h +0 -233
- data/ext/v8/upstream/2.3.3/src/scopes.cc +0 -962
- data/ext/v8/upstream/2.3.3/src/scopes.h +0 -400
- data/ext/v8/upstream/2.3.3/src/serialize.cc +0 -1461
- data/ext/v8/upstream/2.3.3/src/serialize.h +0 -581
- data/ext/v8/upstream/2.3.3/src/spaces-inl.h +0 -483
- data/ext/v8/upstream/2.3.3/src/spaces.cc +0 -2901
- data/ext/v8/upstream/2.3.3/src/spaces.h +0 -2197
- data/ext/v8/upstream/2.3.3/src/string-stream.cc +0 -584
- data/ext/v8/upstream/2.3.3/src/string-stream.h +0 -189
- data/ext/v8/upstream/2.3.3/src/string.js +0 -1006
- data/ext/v8/upstream/2.3.3/src/stub-cache.cc +0 -1379
- data/ext/v8/upstream/2.3.3/src/stub-cache.h +0 -756
- data/ext/v8/upstream/2.3.3/src/third_party/dtoa/COPYING +0 -15
- data/ext/v8/upstream/2.3.3/src/third_party/dtoa/dtoa.c +0 -3334
- data/ext/v8/upstream/2.3.3/src/token.cc +0 -56
- data/ext/v8/upstream/2.3.3/src/token.h +0 -270
- data/ext/v8/upstream/2.3.3/src/top.cc +0 -1067
- data/ext/v8/upstream/2.3.3/src/top.h +0 -463
- data/ext/v8/upstream/2.3.3/src/type-info.cc +0 -53
- data/ext/v8/upstream/2.3.3/src/type-info.h +0 -244
- data/ext/v8/upstream/2.3.3/src/unicode-inl.h +0 -238
- data/ext/v8/upstream/2.3.3/src/unicode.cc +0 -749
- data/ext/v8/upstream/2.3.3/src/unicode.h +0 -279
- data/ext/v8/upstream/2.3.3/src/uri.js +0 -415
- data/ext/v8/upstream/2.3.3/src/utils.cc +0 -285
- data/ext/v8/upstream/2.3.3/src/utils.h +0 -745
- data/ext/v8/upstream/2.3.3/src/v8-counters.h +0 -250
- data/ext/v8/upstream/2.3.3/src/v8.cc +0 -228
- data/ext/v8/upstream/2.3.3/src/v8.h +0 -121
- data/ext/v8/upstream/2.3.3/src/v8natives.js +0 -1188
- data/ext/v8/upstream/2.3.3/src/v8threads.cc +0 -461
- data/ext/v8/upstream/2.3.3/src/v8threads.h +0 -159
- data/ext/v8/upstream/2.3.3/src/variables.cc +0 -119
- data/ext/v8/upstream/2.3.3/src/variables.h +0 -205
- data/ext/v8/upstream/2.3.3/src/version.cc +0 -88
- data/ext/v8/upstream/2.3.3/src/virtual-frame-heavy-inl.h +0 -192
- data/ext/v8/upstream/2.3.3/src/virtual-frame.h +0 -46
- data/ext/v8/upstream/2.3.3/src/vm-state-inl.h +0 -137
- data/ext/v8/upstream/2.3.3/src/vm-state.cc +0 -39
- data/ext/v8/upstream/2.3.3/src/vm-state.h +0 -77
- data/ext/v8/upstream/2.3.3/src/x64/assembler-x64-inl.h +0 -400
- data/ext/v8/upstream/2.3.3/src/x64/assembler-x64.cc +0 -2963
- data/ext/v8/upstream/2.3.3/src/x64/assembler-x64.h +0 -1438
- data/ext/v8/upstream/2.3.3/src/x64/builtins-x64.cc +0 -1296
- data/ext/v8/upstream/2.3.3/src/x64/codegen-x64-inl.h +0 -46
- data/ext/v8/upstream/2.3.3/src/x64/codegen-x64.cc +0 -12491
- data/ext/v8/upstream/2.3.3/src/x64/codegen-x64.h +0 -1090
- data/ext/v8/upstream/2.3.3/src/x64/cpu-x64.cc +0 -83
- data/ext/v8/upstream/2.3.3/src/x64/debug-x64.cc +0 -267
- data/ext/v8/upstream/2.3.3/src/x64/disasm-x64.cc +0 -1696
- data/ext/v8/upstream/2.3.3/src/x64/fast-codegen-x64.cc +0 -250
- data/ext/v8/upstream/2.3.3/src/x64/frames-x64.cc +0 -113
- data/ext/v8/upstream/2.3.3/src/x64/frames-x64.h +0 -125
- data/ext/v8/upstream/2.3.3/src/x64/full-codegen-x64.cc +0 -3270
- data/ext/v8/upstream/2.3.3/src/x64/ic-x64.cc +0 -1907
- data/ext/v8/upstream/2.3.3/src/x64/jump-target-x64.cc +0 -437
- data/ext/v8/upstream/2.3.3/src/x64/macro-assembler-x64.cc +0 -2793
- data/ext/v8/upstream/2.3.3/src/x64/macro-assembler-x64.h +0 -916
- data/ext/v8/upstream/2.3.3/src/x64/regexp-macro-assembler-x64.cc +0 -1374
- data/ext/v8/upstream/2.3.3/src/x64/regexp-macro-assembler-x64.h +0 -277
- data/ext/v8/upstream/2.3.3/src/x64/simulator-x64.h +0 -63
- data/ext/v8/upstream/2.3.3/src/x64/stub-cache-x64.cc +0 -2560
- data/ext/v8/upstream/2.3.3/src/x64/virtual-frame-x64.cc +0 -1264
- data/ext/v8/upstream/2.3.3/src/x64/virtual-frame-x64.h +0 -590
- data/ext/v8/upstream/2.3.3/src/zone-inl.h +0 -82
- data/ext/v8/upstream/2.3.3/src/zone.cc +0 -194
- data/ext/v8/upstream/2.3.3/src/zone.h +0 -221
- data/ext/v8/upstream/2.3.3/tools/codemap.js +0 -270
- data/ext/v8/upstream/2.3.3/tools/csvparser.js +0 -83
- data/ext/v8/upstream/2.3.3/tools/gc-nvp-trace-processor.py +0 -317
- data/ext/v8/upstream/2.3.3/tools/gyp/v8.gyp +0 -749
- data/ext/v8/upstream/2.3.3/tools/linux-tick-processor.py +0 -78
- data/ext/v8/upstream/2.3.3/tools/logreader.js +0 -338
- data/ext/v8/upstream/2.3.3/tools/oprofile/annotate +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/common +0 -19
- data/ext/v8/upstream/2.3.3/tools/oprofile/dump +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/report +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/reset +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/run +0 -14
- data/ext/v8/upstream/2.3.3/tools/oprofile/shutdown +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/start +0 -7
- data/ext/v8/upstream/2.3.3/tools/presubmit.py +0 -299
- data/ext/v8/upstream/2.3.3/tools/profile.js +0 -691
- data/ext/v8/upstream/2.3.3/tools/profile_view.js +0 -224
- data/ext/v8/upstream/2.3.3/tools/splaytree.js +0 -322
- data/ext/v8/upstream/2.3.3/tools/splaytree.py +0 -226
- data/ext/v8/upstream/2.3.3/tools/tickprocessor.js +0 -862
- data/ext/v8/upstream/2.3.3/tools/tickprocessor.py +0 -571
- data/ext/v8/upstream/2.3.3/tools/utils.py +0 -88
- data/ext/v8/upstream/2.3.3/tools/visual_studio/README.txt +0 -71
- data/ext/v8/upstream/2.3.3/tools/visual_studio/common.vsprops +0 -34
- data/ext/v8/upstream/2.3.3/tools/visual_studio/debug.vsprops +0 -17
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base.vcproj +0 -1143
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base_arm.vcproj +0 -1115
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base_x64.vcproj +0 -1096
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample.vcproj +0 -145
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -145
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -161
- data/ext/v8/upstream/2.3.3/tools/windows-tick-processor.bat +0 -29
- data/ext/v8/upstream/2.3.3/tools/windows-tick-processor.py +0 -137
@@ -1,15 +0,0 @@
|
|
1
|
-
The author of this software is David M. Gay.
|
2
|
-
|
3
|
-
Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
|
4
|
-
|
5
|
-
Permission to use, copy, modify, and distribute this software for any
|
6
|
-
purpose without fee is hereby granted, provided that this entire
|
7
|
-
notice is included in all copies of any software which is or includes
|
8
|
-
a copy or modification of this software and in all copies of the
|
9
|
-
supporting documentation for such software.
|
10
|
-
|
11
|
-
THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
|
12
|
-
IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES
|
13
|
-
ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
|
14
|
-
MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
|
15
|
-
PURPOSE.
|
@@ -1,3334 +0,0 @@
|
|
1
|
-
/****************************************************************
|
2
|
-
*
|
3
|
-
* The author of this software is David M. Gay.
|
4
|
-
*
|
5
|
-
* Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
|
6
|
-
*
|
7
|
-
* Permission to use, copy, modify, and distribute this software for any
|
8
|
-
* purpose without fee is hereby granted, provided that this entire notice
|
9
|
-
* is included in all copies of any software which is or includes a copy
|
10
|
-
* or modification of this software and in all copies of the supporting
|
11
|
-
* documentation for such software.
|
12
|
-
*
|
13
|
-
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
|
14
|
-
* WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY
|
15
|
-
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
|
16
|
-
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
17
|
-
*
|
18
|
-
***************************************************************/
|
19
|
-
|
20
|
-
/* Please send bug reports to David M. Gay (dmg at acm dot org,
|
21
|
-
* with " at " changed at "@" and " dot " changed to "."). */
|
22
|
-
|
23
|
-
/* On a machine with IEEE extended-precision registers, it is
|
24
|
-
* necessary to specify double-precision (53-bit) rounding precision
|
25
|
-
* before invoking strtod or dtoa. If the machine uses (the equivalent
|
26
|
-
* of) Intel 80x87 arithmetic, the call
|
27
|
-
* _control87(PC_53, MCW_PC);
|
28
|
-
* does this with many compilers. Whether this or another call is
|
29
|
-
* appropriate depends on the compiler; for this to work, it may be
|
30
|
-
* necessary to #include "float.h" or another system-dependent header
|
31
|
-
* file.
|
32
|
-
*/
|
33
|
-
|
34
|
-
/* strtod for IEEE-, VAX-, and IBM-arithmetic machines.
|
35
|
-
*
|
36
|
-
* This strtod returns a nearest machine number to the input decimal
|
37
|
-
* string (or sets errno to ERANGE). With IEEE arithmetic, ties are
|
38
|
-
* broken by the IEEE round-even rule. Otherwise ties are broken by
|
39
|
-
* biased rounding (add half and chop).
|
40
|
-
*
|
41
|
-
* Inspired loosely by William D. Clinger's paper "How to Read Floating
|
42
|
-
* Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101].
|
43
|
-
*
|
44
|
-
* Modifications:
|
45
|
-
*
|
46
|
-
* 1. We only require IEEE, IBM, or VAX double-precision
|
47
|
-
* arithmetic (not IEEE double-extended).
|
48
|
-
* 2. We get by with floating-point arithmetic in a case that
|
49
|
-
* Clinger missed -- when we're computing d * 10^n
|
50
|
-
* for a small integer d and the integer n is not too
|
51
|
-
* much larger than 22 (the maximum integer k for which
|
52
|
-
* we can represent 10^k exactly), we may be able to
|
53
|
-
* compute (d*10^k) * 10^(e-k) with just one roundoff.
|
54
|
-
* 3. Rather than a bit-at-a-time adjustment of the binary
|
55
|
-
* result in the hard case, we use floating-point
|
56
|
-
* arithmetic to determine the adjustment to within
|
57
|
-
* one bit; only in really hard cases do we need to
|
58
|
-
* compute a second residual.
|
59
|
-
* 4. Because of 3., we don't need a large table of powers of 10
|
60
|
-
* for ten-to-e (just some small tables, e.g. of 10^k
|
61
|
-
* for 0 <= k <= 22).
|
62
|
-
*/
|
63
|
-
|
64
|
-
/*
|
65
|
-
* #define IEEE_8087 for IEEE-arithmetic machines where the least
|
66
|
-
* significant byte has the lowest address.
|
67
|
-
* #define IEEE_MC68k for IEEE-arithmetic machines where the most
|
68
|
-
* significant byte has the lowest address.
|
69
|
-
* #define Long int on machines with 32-bit ints and 64-bit longs.
|
70
|
-
* #define IBM for IBM mainframe-style floating-point arithmetic.
|
71
|
-
* #define VAX for VAX-style floating-point arithmetic (D_floating).
|
72
|
-
* #define No_leftright to omit left-right logic in fast floating-point
|
73
|
-
* computation of dtoa.
|
74
|
-
* #define Honor_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3
|
75
|
-
* and strtod and dtoa should round accordingly.
|
76
|
-
* #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3
|
77
|
-
* and Honor_FLT_ROUNDS is not #defined.
|
78
|
-
* #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines
|
79
|
-
* that use extended-precision instructions to compute rounded
|
80
|
-
* products and quotients) with IBM.
|
81
|
-
* #define ROUND_BIASED for IEEE-format with biased rounding.
|
82
|
-
* #define Inaccurate_Divide for IEEE-format with correctly rounded
|
83
|
-
* products but inaccurate quotients, e.g., for Intel i860.
|
84
|
-
* #define NO_LONG_LONG on machines that do not have a "long long"
|
85
|
-
* integer type (of >= 64 bits). On such machines, you can
|
86
|
-
* #define Just_16 to store 16 bits per 32-bit Long when doing
|
87
|
-
* high-precision integer arithmetic. Whether this speeds things
|
88
|
-
* up or slows things down depends on the machine and the number
|
89
|
-
* being converted. If long long is available and the name is
|
90
|
-
* something other than "long long", #define Llong to be the name,
|
91
|
-
* and if "unsigned Llong" does not work as an unsigned version of
|
92
|
-
* Llong, #define #ULLong to be the corresponding unsigned type.
|
93
|
-
* #define KR_headers for old-style C function headers.
|
94
|
-
* #define Bad_float_h if your system lacks a float.h or if it does not
|
95
|
-
* define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP,
|
96
|
-
* FLT_RADIX, FLT_ROUNDS, and DBL_MAX.
|
97
|
-
* #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n)
|
98
|
-
* if memory is available and otherwise does something you deem
|
99
|
-
* appropriate. If MALLOC is undefined, malloc will be invoked
|
100
|
-
* directly -- and assumed always to succeed.
|
101
|
-
* #define Omit_Private_Memory to omit logic (added Jan. 1998) for making
|
102
|
-
* memory allocations from a private pool of memory when possible.
|
103
|
-
* When used, the private pool is PRIVATE_MEM bytes long: 2304 bytes,
|
104
|
-
* unless #defined to be a different length. This default length
|
105
|
-
* suffices to get rid of MALLOC calls except for unusual cases,
|
106
|
-
* such as decimal-to-binary conversion of a very long string of
|
107
|
-
* digits. The longest string dtoa can return is about 751 bytes
|
108
|
-
* long. For conversions by strtod of strings of 800 digits and
|
109
|
-
* all dtoa conversions in single-threaded executions with 8-byte
|
110
|
-
* pointers, PRIVATE_MEM >= 7400 appears to suffice; with 4-byte
|
111
|
-
* pointers, PRIVATE_MEM >= 7112 appears adequate.
|
112
|
-
* #define INFNAN_CHECK on IEEE systems to cause strtod to check for
|
113
|
-
* Infinity and NaN (case insensitively). On some systems (e.g.,
|
114
|
-
* some HP systems), it may be necessary to #define NAN_WORD0
|
115
|
-
* appropriately -- to the most significant word of a quiet NaN.
|
116
|
-
* (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.)
|
117
|
-
* When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined,
|
118
|
-
* strtod also accepts (case insensitively) strings of the form
|
119
|
-
* NaN(x), where x is a string of hexadecimal digits and spaces;
|
120
|
-
* if there is only one string of hexadecimal digits, it is taken
|
121
|
-
* for the 52 fraction bits of the resulting NaN; if there are two
|
122
|
-
* or more strings of hex digits, the first is for the high 20 bits,
|
123
|
-
* the second and subsequent for the low 32 bits, with intervening
|
124
|
-
* white space ignored; but if this results in none of the 52
|
125
|
-
* fraction bits being on (an IEEE Infinity symbol), then NAN_WORD0
|
126
|
-
* and NAN_WORD1 are used instead.
|
127
|
-
* #define MULTIPLE_THREADS if the system offers preemptively scheduled
|
128
|
-
* multiple threads. In this case, you must provide (or suitably
|
129
|
-
* #define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed
|
130
|
-
* by FREE_DTOA_LOCK(n) for n = 0 or 1. (The second lock, accessed
|
131
|
-
* in pow5mult, ensures lazy evaluation of only one copy of high
|
132
|
-
* powers of 5; omitting this lock would introduce a small
|
133
|
-
* probability of wasting memory, but would otherwise be harmless.)
|
134
|
-
* You must also invoke freedtoa(s) to free the value s returned by
|
135
|
-
* dtoa. You may do so whether or not MULTIPLE_THREADS is #defined.
|
136
|
-
* #define NO_IEEE_Scale to disable new (Feb. 1997) logic in strtod that
|
137
|
-
* avoids underflows on inputs whose result does not underflow.
|
138
|
-
* If you #define NO_IEEE_Scale on a machine that uses IEEE-format
|
139
|
-
* floating-point numbers and flushes underflows to zero rather
|
140
|
-
* than implementing gradual underflow, then you must also #define
|
141
|
-
* Sudden_Underflow.
|
142
|
-
* #define YES_ALIAS to permit aliasing certain double values with
|
143
|
-
* arrays of ULongs. This leads to slightly better code with
|
144
|
-
* some compilers and was always used prior to 19990916, but it
|
145
|
-
* is not strictly legal and can cause trouble with aggressively
|
146
|
-
* optimizing compilers (e.g., gcc 2.95.1 under -O2).
|
147
|
-
* #define USE_LOCALE to use the current locale's decimal_point value.
|
148
|
-
* #define SET_INEXACT if IEEE arithmetic is being used and extra
|
149
|
-
* computation should be done to set the inexact flag when the
|
150
|
-
* result is inexact and avoid setting inexact when the result
|
151
|
-
* is exact. In this case, dtoa.c must be compiled in
|
152
|
-
* an environment, perhaps provided by #include "dtoa.c" in a
|
153
|
-
* suitable wrapper, that defines two functions,
|
154
|
-
* int get_inexact(void);
|
155
|
-
* void clear_inexact(void);
|
156
|
-
* such that get_inexact() returns a nonzero value if the
|
157
|
-
* inexact bit is already set, and clear_inexact() sets the
|
158
|
-
* inexact bit to 0. When SET_INEXACT is #defined, strtod
|
159
|
-
* also does extra computations to set the underflow and overflow
|
160
|
-
* flags when appropriate (i.e., when the result is tiny and
|
161
|
-
* inexact or when it is a numeric value rounded to +-infinity).
|
162
|
-
* #define NO_ERRNO if strtod should not assign errno = ERANGE when
|
163
|
-
* the result overflows to +-Infinity or underflows to 0.
|
164
|
-
*/
|
165
|
-
|
166
|
-
#ifndef Long
|
167
|
-
#if __LP64__
|
168
|
-
#define Long int
|
169
|
-
#else
|
170
|
-
#define Long long
|
171
|
-
#endif
|
172
|
-
#endif
|
173
|
-
#ifndef ULong
|
174
|
-
typedef unsigned Long ULong;
|
175
|
-
#endif
|
176
|
-
|
177
|
-
#ifdef DEBUG
|
178
|
-
#include "stdio.h"
|
179
|
-
#define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);}
|
180
|
-
#endif
|
181
|
-
|
182
|
-
#include "stdlib.h"
|
183
|
-
#include "string.h"
|
184
|
-
|
185
|
-
#ifdef USE_LOCALE
|
186
|
-
#include "locale.h"
|
187
|
-
#endif
|
188
|
-
|
189
|
-
#ifdef MALLOC
|
190
|
-
#ifdef KR_headers
|
191
|
-
extern char *MALLOC();
|
192
|
-
#else
|
193
|
-
extern void *MALLOC(size_t);
|
194
|
-
#endif
|
195
|
-
#else
|
196
|
-
#define MALLOC malloc
|
197
|
-
#endif
|
198
|
-
|
199
|
-
#ifndef Omit_Private_Memory
|
200
|
-
#ifndef PRIVATE_MEM
|
201
|
-
#define PRIVATE_MEM 2304
|
202
|
-
#endif
|
203
|
-
#define PRIVATE_mem ((PRIVATE_MEM+sizeof(double)-1)/sizeof(double))
|
204
|
-
static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
|
205
|
-
#endif
|
206
|
-
|
207
|
-
#undef IEEE_Arith
|
208
|
-
#undef Avoid_Underflow
|
209
|
-
#ifdef IEEE_MC68k
|
210
|
-
#define IEEE_Arith
|
211
|
-
#endif
|
212
|
-
#ifdef IEEE_8087
|
213
|
-
#define IEEE_Arith
|
214
|
-
#endif
|
215
|
-
|
216
|
-
#include "errno.h"
|
217
|
-
|
218
|
-
#ifdef Bad_float_h
|
219
|
-
|
220
|
-
#ifdef IEEE_Arith
|
221
|
-
#define DBL_DIG 15
|
222
|
-
#define DBL_MAX_10_EXP 308
|
223
|
-
#define DBL_MAX_EXP 1024
|
224
|
-
#define FLT_RADIX 2
|
225
|
-
#endif /*IEEE_Arith*/
|
226
|
-
|
227
|
-
#ifdef IBM
|
228
|
-
#define DBL_DIG 16
|
229
|
-
#define DBL_MAX_10_EXP 75
|
230
|
-
#define DBL_MAX_EXP 63
|
231
|
-
#define FLT_RADIX 16
|
232
|
-
#define DBL_MAX 7.2370055773322621e+75
|
233
|
-
#endif
|
234
|
-
|
235
|
-
#ifdef VAX
|
236
|
-
#define DBL_DIG 16
|
237
|
-
#define DBL_MAX_10_EXP 38
|
238
|
-
#define DBL_MAX_EXP 127
|
239
|
-
#define FLT_RADIX 2
|
240
|
-
#define DBL_MAX 1.7014118346046923e+38
|
241
|
-
#endif
|
242
|
-
|
243
|
-
#ifndef LONG_MAX
|
244
|
-
#define LONG_MAX 2147483647
|
245
|
-
#endif
|
246
|
-
|
247
|
-
#else /* ifndef Bad_float_h */
|
248
|
-
#include "float.h"
|
249
|
-
#endif /* Bad_float_h */
|
250
|
-
|
251
|
-
#ifndef __MATH_H__
|
252
|
-
#include "math.h"
|
253
|
-
#endif
|
254
|
-
|
255
|
-
#ifdef __cplusplus
|
256
|
-
extern "C" {
|
257
|
-
#endif
|
258
|
-
|
259
|
-
#ifndef CONST
|
260
|
-
#ifdef KR_headers
|
261
|
-
#define CONST /* blank */
|
262
|
-
#else
|
263
|
-
#define CONST const
|
264
|
-
#endif
|
265
|
-
#endif
|
266
|
-
|
267
|
-
#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1
|
268
|
-
Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
|
269
|
-
#endif
|
270
|
-
|
271
|
-
typedef union { double d; ULong L[2]; } U;
|
272
|
-
|
273
|
-
#ifdef YES_ALIAS
|
274
|
-
#define dval(x) x
|
275
|
-
#ifdef IEEE_8087
|
276
|
-
#define word0(x) ((ULong *)&x)[1]
|
277
|
-
#define word1(x) ((ULong *)&x)[0]
|
278
|
-
#else
|
279
|
-
#define word0(x) ((ULong *)&x)[0]
|
280
|
-
#define word1(x) ((ULong *)&x)[1]
|
281
|
-
#endif
|
282
|
-
#else
|
283
|
-
#ifdef IEEE_8087
|
284
|
-
#define word0(x) ((U*)&x)->L[1]
|
285
|
-
#define word1(x) ((U*)&x)->L[0]
|
286
|
-
#else
|
287
|
-
#define word0(x) ((U*)&x)->L[0]
|
288
|
-
#define word1(x) ((U*)&x)->L[1]
|
289
|
-
#endif
|
290
|
-
#define dval(x) ((U*)&x)->d
|
291
|
-
#endif
|
292
|
-
|
293
|
-
/* The following definition of Storeinc is appropriate for MIPS processors.
|
294
|
-
* An alternative that might be better on some machines is
|
295
|
-
* #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff)
|
296
|
-
*/
|
297
|
-
#if defined(IEEE_8087) + defined(VAX)
|
298
|
-
#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \
|
299
|
-
((unsigned short *)a)[0] = (unsigned short)c, a++)
|
300
|
-
#else
|
301
|
-
#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \
|
302
|
-
((unsigned short *)a)[1] = (unsigned short)c, a++)
|
303
|
-
#endif
|
304
|
-
|
305
|
-
/* #define P DBL_MANT_DIG */
|
306
|
-
/* Ten_pmax = floor(P*log(2)/log(5)) */
|
307
|
-
/* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */
|
308
|
-
/* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */
|
309
|
-
/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */
|
310
|
-
|
311
|
-
#ifdef IEEE_Arith
|
312
|
-
#define Exp_shift 20
|
313
|
-
#define Exp_shift1 20
|
314
|
-
#define Exp_msk1 0x100000
|
315
|
-
#define Exp_msk11 0x100000
|
316
|
-
#define Exp_mask 0x7ff00000
|
317
|
-
#define P 53
|
318
|
-
#define Bias 1023
|
319
|
-
#define Emin (-1022)
|
320
|
-
#define Exp_1 0x3ff00000
|
321
|
-
#define Exp_11 0x3ff00000
|
322
|
-
#define Ebits 11
|
323
|
-
#define Frac_mask 0xfffff
|
324
|
-
#define Frac_mask1 0xfffff
|
325
|
-
#define Ten_pmax 22
|
326
|
-
#define Bletch 0x10
|
327
|
-
#define Bndry_mask 0xfffff
|
328
|
-
#define Bndry_mask1 0xfffff
|
329
|
-
#define LSB 1
|
330
|
-
#define Sign_bit 0x80000000
|
331
|
-
#define Log2P 1
|
332
|
-
#define Tiny0 0
|
333
|
-
#define Tiny1 1
|
334
|
-
#define Quick_max 14
|
335
|
-
#define Int_max 14
|
336
|
-
#ifndef NO_IEEE_Scale
|
337
|
-
#define Avoid_Underflow
|
338
|
-
#ifdef Flush_Denorm /* debugging option */
|
339
|
-
#undef Sudden_Underflow
|
340
|
-
#endif
|
341
|
-
#endif
|
342
|
-
|
343
|
-
#ifndef Flt_Rounds
|
344
|
-
#ifdef FLT_ROUNDS
|
345
|
-
#define Flt_Rounds FLT_ROUNDS
|
346
|
-
#else
|
347
|
-
#define Flt_Rounds 1
|
348
|
-
#endif
|
349
|
-
#endif /*Flt_Rounds*/
|
350
|
-
|
351
|
-
#ifdef Honor_FLT_ROUNDS
|
352
|
-
#define Rounding rounding
|
353
|
-
#undef Check_FLT_ROUNDS
|
354
|
-
#define Check_FLT_ROUNDS
|
355
|
-
#else
|
356
|
-
#define Rounding Flt_Rounds
|
357
|
-
#endif
|
358
|
-
|
359
|
-
#else /* ifndef IEEE_Arith */
|
360
|
-
#undef Check_FLT_ROUNDS
|
361
|
-
#undef Honor_FLT_ROUNDS
|
362
|
-
#undef SET_INEXACT
|
363
|
-
#undef Sudden_Underflow
|
364
|
-
#define Sudden_Underflow
|
365
|
-
#ifdef IBM
|
366
|
-
#undef Flt_Rounds
|
367
|
-
#define Flt_Rounds 0
|
368
|
-
#define Exp_shift 24
|
369
|
-
#define Exp_shift1 24
|
370
|
-
#define Exp_msk1 0x1000000
|
371
|
-
#define Exp_msk11 0x1000000
|
372
|
-
#define Exp_mask 0x7f000000
|
373
|
-
#define P 14
|
374
|
-
#define Bias 65
|
375
|
-
#define Exp_1 0x41000000
|
376
|
-
#define Exp_11 0x41000000
|
377
|
-
#define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */
|
378
|
-
#define Frac_mask 0xffffff
|
379
|
-
#define Frac_mask1 0xffffff
|
380
|
-
#define Bletch 4
|
381
|
-
#define Ten_pmax 22
|
382
|
-
#define Bndry_mask 0xefffff
|
383
|
-
#define Bndry_mask1 0xffffff
|
384
|
-
#define LSB 1
|
385
|
-
#define Sign_bit 0x80000000
|
386
|
-
#define Log2P 4
|
387
|
-
#define Tiny0 0x100000
|
388
|
-
#define Tiny1 0
|
389
|
-
#define Quick_max 14
|
390
|
-
#define Int_max 15
|
391
|
-
#else /* VAX */
|
392
|
-
#undef Flt_Rounds
|
393
|
-
#define Flt_Rounds 1
|
394
|
-
#define Exp_shift 23
|
395
|
-
#define Exp_shift1 7
|
396
|
-
#define Exp_msk1 0x80
|
397
|
-
#define Exp_msk11 0x800000
|
398
|
-
#define Exp_mask 0x7f80
|
399
|
-
#define P 56
|
400
|
-
#define Bias 129
|
401
|
-
#define Exp_1 0x40800000
|
402
|
-
#define Exp_11 0x4080
|
403
|
-
#define Ebits 8
|
404
|
-
#define Frac_mask 0x7fffff
|
405
|
-
#define Frac_mask1 0xffff007f
|
406
|
-
#define Ten_pmax 24
|
407
|
-
#define Bletch 2
|
408
|
-
#define Bndry_mask 0xffff007f
|
409
|
-
#define Bndry_mask1 0xffff007f
|
410
|
-
#define LSB 0x10000
|
411
|
-
#define Sign_bit 0x8000
|
412
|
-
#define Log2P 1
|
413
|
-
#define Tiny0 0x80
|
414
|
-
#define Tiny1 0
|
415
|
-
#define Quick_max 15
|
416
|
-
#define Int_max 15
|
417
|
-
#endif /* IBM, VAX */
|
418
|
-
#endif /* IEEE_Arith */
|
419
|
-
|
420
|
-
#ifndef IEEE_Arith
|
421
|
-
#define ROUND_BIASED
|
422
|
-
#endif
|
423
|
-
|
424
|
-
#ifdef RND_PRODQUOT
|
425
|
-
#define rounded_product(a,b) a = rnd_prod(a, b)
|
426
|
-
#define rounded_quotient(a,b) a = rnd_quot(a, b)
|
427
|
-
#ifdef KR_headers
|
428
|
-
extern double rnd_prod(), rnd_quot();
|
429
|
-
#else
|
430
|
-
extern double rnd_prod(double, double), rnd_quot(double, double);
|
431
|
-
#endif
|
432
|
-
#else
|
433
|
-
#define rounded_product(a,b) a *= b
|
434
|
-
#define rounded_quotient(a,b) a /= b
|
435
|
-
#endif
|
436
|
-
|
437
|
-
#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
|
438
|
-
#define Big1 0xffffffff
|
439
|
-
|
440
|
-
#ifndef Pack_32
|
441
|
-
#define Pack_32
|
442
|
-
#endif
|
443
|
-
|
444
|
-
#ifdef KR_headers
|
445
|
-
#define FFFFFFFF ((((unsigned long)0xffff)<<16)|(unsigned long)0xffff)
|
446
|
-
#else
|
447
|
-
#define FFFFFFFF 0xffffffffUL
|
448
|
-
#endif
|
449
|
-
|
450
|
-
#ifdef NO_LONG_LONG
|
451
|
-
#undef ULLong
|
452
|
-
#ifdef Just_16
|
453
|
-
#undef Pack_32
|
454
|
-
/* When Pack_32 is not defined, we store 16 bits per 32-bit Long.
|
455
|
-
* This makes some inner loops simpler and sometimes saves work
|
456
|
-
* during multiplications, but it often seems to make things slightly
|
457
|
-
* slower. Hence the default is now to store 32 bits per Long.
|
458
|
-
*/
|
459
|
-
#endif
|
460
|
-
#else /* long long available */
|
461
|
-
#ifndef Llong
|
462
|
-
#define Llong long long
|
463
|
-
#endif
|
464
|
-
#ifndef ULLong
|
465
|
-
#define ULLong unsigned Llong
|
466
|
-
#endif
|
467
|
-
#endif /* NO_LONG_LONG */
|
468
|
-
|
469
|
-
#ifndef MULTIPLE_THREADS
|
470
|
-
#define ACQUIRE_DTOA_LOCK(n) /*nothing*/
|
471
|
-
#define FREE_DTOA_LOCK(n) /*nothing*/
|
472
|
-
#endif
|
473
|
-
|
474
|
-
#define Kmax 15
|
475
|
-
|
476
|
-
#ifdef __cplusplus
|
477
|
-
extern "C" double strtod(const char *s00, char **se);
|
478
|
-
extern "C" char *dtoa(double d, int mode, int ndigits,
|
479
|
-
int *decpt, int *sign, char **rve);
|
480
|
-
#endif
|
481
|
-
|
482
|
-
struct
|
483
|
-
Bigint {
|
484
|
-
struct Bigint *next;
|
485
|
-
int k, maxwds, sign, wds;
|
486
|
-
ULong x[1];
|
487
|
-
};
|
488
|
-
|
489
|
-
typedef struct Bigint Bigint;
|
490
|
-
|
491
|
-
static Bigint *freelist[Kmax+1];
|
492
|
-
|
493
|
-
static Bigint *
|
494
|
-
Balloc
|
495
|
-
#ifdef KR_headers
|
496
|
-
(k) int k;
|
497
|
-
#else
|
498
|
-
(int k)
|
499
|
-
#endif
|
500
|
-
{
|
501
|
-
int x;
|
502
|
-
Bigint *rv;
|
503
|
-
#ifndef Omit_Private_Memory
|
504
|
-
unsigned int len;
|
505
|
-
#endif
|
506
|
-
|
507
|
-
ACQUIRE_DTOA_LOCK(0);
|
508
|
-
/* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0). */
|
509
|
-
/* but this case seems very unlikely. */
|
510
|
-
if (k <= Kmax && (rv = freelist[k])) {
|
511
|
-
freelist[k] = rv->next;
|
512
|
-
}
|
513
|
-
else {
|
514
|
-
x = 1 << k;
|
515
|
-
#ifdef Omit_Private_Memory
|
516
|
-
rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong));
|
517
|
-
#else
|
518
|
-
len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1)
|
519
|
-
/sizeof(double);
|
520
|
-
if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) {
|
521
|
-
rv = (Bigint*)pmem_next;
|
522
|
-
pmem_next += len;
|
523
|
-
}
|
524
|
-
else
|
525
|
-
rv = (Bigint*)MALLOC(len*sizeof(double));
|
526
|
-
#endif
|
527
|
-
rv->k = k;
|
528
|
-
rv->maxwds = x;
|
529
|
-
}
|
530
|
-
FREE_DTOA_LOCK(0);
|
531
|
-
rv->sign = rv->wds = 0;
|
532
|
-
return rv;
|
533
|
-
}
|
534
|
-
|
535
|
-
static void
|
536
|
-
Bfree
|
537
|
-
#ifdef KR_headers
|
538
|
-
(v) Bigint *v;
|
539
|
-
#else
|
540
|
-
(Bigint *v)
|
541
|
-
#endif
|
542
|
-
{
|
543
|
-
if (v) {
|
544
|
-
if (v->k > Kmax)
|
545
|
-
free((void*)v);
|
546
|
-
else {
|
547
|
-
ACQUIRE_DTOA_LOCK(0);
|
548
|
-
v->next = freelist[v->k];
|
549
|
-
freelist[v->k] = v;
|
550
|
-
FREE_DTOA_LOCK(0);
|
551
|
-
}
|
552
|
-
}
|
553
|
-
}
|
554
|
-
|
555
|
-
#define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \
|
556
|
-
y->wds*sizeof(Long) + 2*sizeof(int))
|
557
|
-
|
558
|
-
static Bigint *
|
559
|
-
multadd
|
560
|
-
#ifdef KR_headers
|
561
|
-
(b, m, a) Bigint *b; int m, a;
|
562
|
-
#else
|
563
|
-
(Bigint *b, int m, int a) /* multiply by m and add a */
|
564
|
-
#endif
|
565
|
-
{
|
566
|
-
int i, wds;
|
567
|
-
#ifdef ULLong
|
568
|
-
ULong *x;
|
569
|
-
ULLong carry, y;
|
570
|
-
#else
|
571
|
-
ULong carry, *x, y;
|
572
|
-
#ifdef Pack_32
|
573
|
-
ULong xi, z;
|
574
|
-
#endif
|
575
|
-
#endif
|
576
|
-
Bigint *b1;
|
577
|
-
|
578
|
-
wds = b->wds;
|
579
|
-
x = b->x;
|
580
|
-
i = 0;
|
581
|
-
carry = a;
|
582
|
-
do {
|
583
|
-
#ifdef ULLong
|
584
|
-
y = *x * (ULLong)m + carry;
|
585
|
-
carry = y >> 32;
|
586
|
-
*x++ = y & FFFFFFFF;
|
587
|
-
#else
|
588
|
-
#ifdef Pack_32
|
589
|
-
xi = *x;
|
590
|
-
y = (xi & 0xffff) * m + carry;
|
591
|
-
z = (xi >> 16) * m + (y >> 16);
|
592
|
-
carry = z >> 16;
|
593
|
-
*x++ = (z << 16) + (y & 0xffff);
|
594
|
-
#else
|
595
|
-
y = *x * m + carry;
|
596
|
-
carry = y >> 16;
|
597
|
-
*x++ = y & 0xffff;
|
598
|
-
#endif
|
599
|
-
#endif
|
600
|
-
}
|
601
|
-
while(++i < wds);
|
602
|
-
if (carry) {
|
603
|
-
if (wds >= b->maxwds) {
|
604
|
-
b1 = Balloc(b->k+1);
|
605
|
-
Bcopy(b1, b);
|
606
|
-
Bfree(b);
|
607
|
-
b = b1;
|
608
|
-
}
|
609
|
-
b->x[wds++] = carry;
|
610
|
-
b->wds = wds;
|
611
|
-
}
|
612
|
-
return b;
|
613
|
-
}
|
614
|
-
|
615
|
-
static Bigint *
|
616
|
-
s2b
|
617
|
-
#ifdef KR_headers
|
618
|
-
(s, nd0, nd, y9) CONST char *s; int nd0, nd; ULong y9;
|
619
|
-
#else
|
620
|
-
(CONST char *s, int nd0, int nd, ULong y9)
|
621
|
-
#endif
|
622
|
-
{
|
623
|
-
Bigint *b;
|
624
|
-
int i, k;
|
625
|
-
Long x, y;
|
626
|
-
|
627
|
-
x = (nd + 8) / 9;
|
628
|
-
for(k = 0, y = 1; x > y; y <<= 1, k++) ;
|
629
|
-
#ifdef Pack_32
|
630
|
-
b = Balloc(k);
|
631
|
-
b->x[0] = y9;
|
632
|
-
b->wds = 1;
|
633
|
-
#else
|
634
|
-
b = Balloc(k+1);
|
635
|
-
b->x[0] = y9 & 0xffff;
|
636
|
-
b->wds = (b->x[1] = y9 >> 16) ? 2 : 1;
|
637
|
-
#endif
|
638
|
-
|
639
|
-
i = 9;
|
640
|
-
if (9 < nd0) {
|
641
|
-
s += 9;
|
642
|
-
do b = multadd(b, 10, *s++ - '0');
|
643
|
-
while(++i < nd0);
|
644
|
-
s++;
|
645
|
-
}
|
646
|
-
else
|
647
|
-
s += 10;
|
648
|
-
for(; i < nd; i++)
|
649
|
-
b = multadd(b, 10, *s++ - '0');
|
650
|
-
return b;
|
651
|
-
}
|
652
|
-
|
653
|
-
static int
|
654
|
-
hi0bits
|
655
|
-
#ifdef KR_headers
|
656
|
-
(x) register ULong x;
|
657
|
-
#else
|
658
|
-
(register ULong x)
|
659
|
-
#endif
|
660
|
-
{
|
661
|
-
register int k = 0;
|
662
|
-
|
663
|
-
if (!(x & 0xffff0000)) {
|
664
|
-
k = 16;
|
665
|
-
x <<= 16;
|
666
|
-
}
|
667
|
-
if (!(x & 0xff000000)) {
|
668
|
-
k += 8;
|
669
|
-
x <<= 8;
|
670
|
-
}
|
671
|
-
if (!(x & 0xf0000000)) {
|
672
|
-
k += 4;
|
673
|
-
x <<= 4;
|
674
|
-
}
|
675
|
-
if (!(x & 0xc0000000)) {
|
676
|
-
k += 2;
|
677
|
-
x <<= 2;
|
678
|
-
}
|
679
|
-
if (!(x & 0x80000000)) {
|
680
|
-
k++;
|
681
|
-
if (!(x & 0x40000000))
|
682
|
-
return 32;
|
683
|
-
}
|
684
|
-
return k;
|
685
|
-
}
|
686
|
-
|
687
|
-
static int
|
688
|
-
lo0bits
|
689
|
-
#ifdef KR_headers
|
690
|
-
(y) ULong *y;
|
691
|
-
#else
|
692
|
-
(ULong *y)
|
693
|
-
#endif
|
694
|
-
{
|
695
|
-
register int k;
|
696
|
-
register ULong x = *y;
|
697
|
-
|
698
|
-
if (x & 7) {
|
699
|
-
if (x & 1)
|
700
|
-
return 0;
|
701
|
-
if (x & 2) {
|
702
|
-
*y = x >> 1;
|
703
|
-
return 1;
|
704
|
-
}
|
705
|
-
*y = x >> 2;
|
706
|
-
return 2;
|
707
|
-
}
|
708
|
-
k = 0;
|
709
|
-
if (!(x & 0xffff)) {
|
710
|
-
k = 16;
|
711
|
-
x >>= 16;
|
712
|
-
}
|
713
|
-
if (!(x & 0xff)) {
|
714
|
-
k += 8;
|
715
|
-
x >>= 8;
|
716
|
-
}
|
717
|
-
if (!(x & 0xf)) {
|
718
|
-
k += 4;
|
719
|
-
x >>= 4;
|
720
|
-
}
|
721
|
-
if (!(x & 0x3)) {
|
722
|
-
k += 2;
|
723
|
-
x >>= 2;
|
724
|
-
}
|
725
|
-
if (!(x & 1)) {
|
726
|
-
k++;
|
727
|
-
x >>= 1;
|
728
|
-
if (!x)
|
729
|
-
return 32;
|
730
|
-
}
|
731
|
-
*y = x;
|
732
|
-
return k;
|
733
|
-
}
|
734
|
-
|
735
|
-
static Bigint *
|
736
|
-
i2b
|
737
|
-
#ifdef KR_headers
|
738
|
-
(i) int i;
|
739
|
-
#else
|
740
|
-
(int i)
|
741
|
-
#endif
|
742
|
-
{
|
743
|
-
Bigint *b;
|
744
|
-
|
745
|
-
b = Balloc(1);
|
746
|
-
b->x[0] = i;
|
747
|
-
b->wds = 1;
|
748
|
-
return b;
|
749
|
-
}
|
750
|
-
|
751
|
-
static Bigint *
|
752
|
-
mult
|
753
|
-
#ifdef KR_headers
|
754
|
-
(a, b) Bigint *a, *b;
|
755
|
-
#else
|
756
|
-
(Bigint *a, Bigint *b)
|
757
|
-
#endif
|
758
|
-
{
|
759
|
-
Bigint *c;
|
760
|
-
int k, wa, wb, wc;
|
761
|
-
ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0;
|
762
|
-
ULong y;
|
763
|
-
#ifdef ULLong
|
764
|
-
ULLong carry, z;
|
765
|
-
#else
|
766
|
-
ULong carry, z;
|
767
|
-
#ifdef Pack_32
|
768
|
-
ULong z2;
|
769
|
-
#endif
|
770
|
-
#endif
|
771
|
-
|
772
|
-
if (a->wds < b->wds) {
|
773
|
-
c = a;
|
774
|
-
a = b;
|
775
|
-
b = c;
|
776
|
-
}
|
777
|
-
k = a->k;
|
778
|
-
wa = a->wds;
|
779
|
-
wb = b->wds;
|
780
|
-
wc = wa + wb;
|
781
|
-
if (wc > a->maxwds)
|
782
|
-
k++;
|
783
|
-
c = Balloc(k);
|
784
|
-
for(x = c->x, xa = x + wc; x < xa; x++)
|
785
|
-
*x = 0;
|
786
|
-
xa = a->x;
|
787
|
-
xae = xa + wa;
|
788
|
-
xb = b->x;
|
789
|
-
xbe = xb + wb;
|
790
|
-
xc0 = c->x;
|
791
|
-
#ifdef ULLong
|
792
|
-
for(; xb < xbe; xc0++) {
|
793
|
-
if ((y = *xb++)) {
|
794
|
-
x = xa;
|
795
|
-
xc = xc0;
|
796
|
-
carry = 0;
|
797
|
-
do {
|
798
|
-
z = *x++ * (ULLong)y + *xc + carry;
|
799
|
-
carry = z >> 32;
|
800
|
-
*xc++ = z & FFFFFFFF;
|
801
|
-
}
|
802
|
-
while(x < xae);
|
803
|
-
*xc = carry;
|
804
|
-
}
|
805
|
-
}
|
806
|
-
#else
|
807
|
-
#ifdef Pack_32
|
808
|
-
for(; xb < xbe; xb++, xc0++) {
|
809
|
-
if (y = *xb & 0xffff) {
|
810
|
-
x = xa;
|
811
|
-
xc = xc0;
|
812
|
-
carry = 0;
|
813
|
-
do {
|
814
|
-
z = (*x & 0xffff) * y + (*xc & 0xffff) + carry;
|
815
|
-
carry = z >> 16;
|
816
|
-
z2 = (*x++ >> 16) * y + (*xc >> 16) + carry;
|
817
|
-
carry = z2 >> 16;
|
818
|
-
Storeinc(xc, z2, z);
|
819
|
-
}
|
820
|
-
while(x < xae);
|
821
|
-
*xc = carry;
|
822
|
-
}
|
823
|
-
if (y = *xb >> 16) {
|
824
|
-
x = xa;
|
825
|
-
xc = xc0;
|
826
|
-
carry = 0;
|
827
|
-
z2 = *xc;
|
828
|
-
do {
|
829
|
-
z = (*x & 0xffff) * y + (*xc >> 16) + carry;
|
830
|
-
carry = z >> 16;
|
831
|
-
Storeinc(xc, z, z2);
|
832
|
-
z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry;
|
833
|
-
carry = z2 >> 16;
|
834
|
-
}
|
835
|
-
while(x < xae);
|
836
|
-
*xc = z2;
|
837
|
-
}
|
838
|
-
}
|
839
|
-
#else
|
840
|
-
for(; xb < xbe; xc0++) {
|
841
|
-
if (y = *xb++) {
|
842
|
-
x = xa;
|
843
|
-
xc = xc0;
|
844
|
-
carry = 0;
|
845
|
-
do {
|
846
|
-
z = *x++ * y + *xc + carry;
|
847
|
-
carry = z >> 16;
|
848
|
-
*xc++ = z & 0xffff;
|
849
|
-
}
|
850
|
-
while(x < xae);
|
851
|
-
*xc = carry;
|
852
|
-
}
|
853
|
-
}
|
854
|
-
#endif
|
855
|
-
#endif
|
856
|
-
for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ;
|
857
|
-
c->wds = wc;
|
858
|
-
return c;
|
859
|
-
}
|
860
|
-
|
861
|
-
static Bigint *p5s;
|
862
|
-
|
863
|
-
static Bigint *
|
864
|
-
pow5mult
|
865
|
-
#ifdef KR_headers
|
866
|
-
(b, k) Bigint *b; int k;
|
867
|
-
#else
|
868
|
-
(Bigint *b, int k)
|
869
|
-
#endif
|
870
|
-
{
|
871
|
-
Bigint *b1, *p5, *p51;
|
872
|
-
int i;
|
873
|
-
static int p05[3] = { 5, 25, 125 };
|
874
|
-
|
875
|
-
if ((i = k & 3))
|
876
|
-
b = multadd(b, p05[i-1], 0);
|
877
|
-
|
878
|
-
if (!(k >>= 2))
|
879
|
-
return b;
|
880
|
-
if (!(p5 = p5s)) {
|
881
|
-
/* first time */
|
882
|
-
#ifdef MULTIPLE_THREADS
|
883
|
-
ACQUIRE_DTOA_LOCK(1);
|
884
|
-
if (!(p5 = p5s)) {
|
885
|
-
p5 = p5s = i2b(625);
|
886
|
-
p5->next = 0;
|
887
|
-
}
|
888
|
-
FREE_DTOA_LOCK(1);
|
889
|
-
#else
|
890
|
-
p5 = p5s = i2b(625);
|
891
|
-
p5->next = 0;
|
892
|
-
#endif
|
893
|
-
}
|
894
|
-
for(;;) {
|
895
|
-
if (k & 1) {
|
896
|
-
b1 = mult(b, p5);
|
897
|
-
Bfree(b);
|
898
|
-
b = b1;
|
899
|
-
}
|
900
|
-
if (!(k >>= 1))
|
901
|
-
break;
|
902
|
-
if (!(p51 = p5->next)) {
|
903
|
-
#ifdef MULTIPLE_THREADS
|
904
|
-
ACQUIRE_DTOA_LOCK(1);
|
905
|
-
if (!(p51 = p5->next)) {
|
906
|
-
p51 = p5->next = mult(p5,p5);
|
907
|
-
p51->next = 0;
|
908
|
-
}
|
909
|
-
FREE_DTOA_LOCK(1);
|
910
|
-
#else
|
911
|
-
p51 = p5->next = mult(p5,p5);
|
912
|
-
p51->next = 0;
|
913
|
-
#endif
|
914
|
-
}
|
915
|
-
p5 = p51;
|
916
|
-
}
|
917
|
-
return b;
|
918
|
-
}
|
919
|
-
|
920
|
-
static Bigint *
|
921
|
-
lshift
|
922
|
-
#ifdef KR_headers
|
923
|
-
(b, k) Bigint *b; int k;
|
924
|
-
#else
|
925
|
-
(Bigint *b, int k)
|
926
|
-
#endif
|
927
|
-
{
|
928
|
-
int i, k1, n, n1;
|
929
|
-
Bigint *b1;
|
930
|
-
ULong *x, *x1, *xe, z;
|
931
|
-
|
932
|
-
#ifdef Pack_32
|
933
|
-
n = k >> 5;
|
934
|
-
#else
|
935
|
-
n = k >> 4;
|
936
|
-
#endif
|
937
|
-
k1 = b->k;
|
938
|
-
n1 = n + b->wds + 1;
|
939
|
-
for(i = b->maxwds; n1 > i; i <<= 1)
|
940
|
-
k1++;
|
941
|
-
b1 = Balloc(k1);
|
942
|
-
x1 = b1->x;
|
943
|
-
for(i = 0; i < n; i++)
|
944
|
-
*x1++ = 0;
|
945
|
-
x = b->x;
|
946
|
-
xe = x + b->wds;
|
947
|
-
#ifdef Pack_32
|
948
|
-
if (k &= 0x1f) {
|
949
|
-
k1 = 32 - k;
|
950
|
-
z = 0;
|
951
|
-
do {
|
952
|
-
*x1++ = *x << k | z;
|
953
|
-
z = *x++ >> k1;
|
954
|
-
}
|
955
|
-
while(x < xe);
|
956
|
-
if ((*x1 = z))
|
957
|
-
++n1;
|
958
|
-
}
|
959
|
-
#else
|
960
|
-
if (k &= 0xf) {
|
961
|
-
k1 = 16 - k;
|
962
|
-
z = 0;
|
963
|
-
do {
|
964
|
-
*x1++ = *x << k & 0xffff | z;
|
965
|
-
z = *x++ >> k1;
|
966
|
-
}
|
967
|
-
while(x < xe);
|
968
|
-
if (*x1 = z)
|
969
|
-
++n1;
|
970
|
-
}
|
971
|
-
#endif
|
972
|
-
else do
|
973
|
-
*x1++ = *x++;
|
974
|
-
while(x < xe);
|
975
|
-
b1->wds = n1 - 1;
|
976
|
-
Bfree(b);
|
977
|
-
return b1;
|
978
|
-
}
|
979
|
-
|
980
|
-
static int
|
981
|
-
cmp
|
982
|
-
#ifdef KR_headers
|
983
|
-
(a, b) Bigint *a, *b;
|
984
|
-
#else
|
985
|
-
(Bigint *a, Bigint *b)
|
986
|
-
#endif
|
987
|
-
{
|
988
|
-
ULong *xa, *xa0, *xb, *xb0;
|
989
|
-
int i, j;
|
990
|
-
|
991
|
-
i = a->wds;
|
992
|
-
j = b->wds;
|
993
|
-
#ifdef DEBUG
|
994
|
-
if (i > 1 && !a->x[i-1])
|
995
|
-
Bug("cmp called with a->x[a->wds-1] == 0");
|
996
|
-
if (j > 1 && !b->x[j-1])
|
997
|
-
Bug("cmp called with b->x[b->wds-1] == 0");
|
998
|
-
#endif
|
999
|
-
if (i -= j)
|
1000
|
-
return i;
|
1001
|
-
xa0 = a->x;
|
1002
|
-
xa = xa0 + j;
|
1003
|
-
xb0 = b->x;
|
1004
|
-
xb = xb0 + j;
|
1005
|
-
for(;;) {
|
1006
|
-
if (*--xa != *--xb)
|
1007
|
-
return *xa < *xb ? -1 : 1;
|
1008
|
-
if (xa <= xa0)
|
1009
|
-
break;
|
1010
|
-
}
|
1011
|
-
return 0;
|
1012
|
-
}
|
1013
|
-
|
1014
|
-
static Bigint *
|
1015
|
-
diff
|
1016
|
-
#ifdef KR_headers
|
1017
|
-
(a, b) Bigint *a, *b;
|
1018
|
-
#else
|
1019
|
-
(Bigint *a, Bigint *b)
|
1020
|
-
#endif
|
1021
|
-
{
|
1022
|
-
Bigint *c;
|
1023
|
-
int i, wa, wb;
|
1024
|
-
ULong *xa, *xae, *xb, *xbe, *xc;
|
1025
|
-
#ifdef ULLong
|
1026
|
-
ULLong borrow, y;
|
1027
|
-
#else
|
1028
|
-
ULong borrow, y;
|
1029
|
-
#ifdef Pack_32
|
1030
|
-
ULong z;
|
1031
|
-
#endif
|
1032
|
-
#endif
|
1033
|
-
|
1034
|
-
i = cmp(a,b);
|
1035
|
-
if (!i) {
|
1036
|
-
c = Balloc(0);
|
1037
|
-
c->wds = 1;
|
1038
|
-
c->x[0] = 0;
|
1039
|
-
return c;
|
1040
|
-
}
|
1041
|
-
if (i < 0) {
|
1042
|
-
c = a;
|
1043
|
-
a = b;
|
1044
|
-
b = c;
|
1045
|
-
i = 1;
|
1046
|
-
}
|
1047
|
-
else
|
1048
|
-
i = 0;
|
1049
|
-
c = Balloc(a->k);
|
1050
|
-
c->sign = i;
|
1051
|
-
wa = a->wds;
|
1052
|
-
xa = a->x;
|
1053
|
-
xae = xa + wa;
|
1054
|
-
wb = b->wds;
|
1055
|
-
xb = b->x;
|
1056
|
-
xbe = xb + wb;
|
1057
|
-
xc = c->x;
|
1058
|
-
borrow = 0;
|
1059
|
-
#ifdef ULLong
|
1060
|
-
do {
|
1061
|
-
y = (ULLong)*xa++ - *xb++ - borrow;
|
1062
|
-
borrow = y >> 32 & (ULong)1;
|
1063
|
-
*xc++ = y & FFFFFFFF;
|
1064
|
-
}
|
1065
|
-
while(xb < xbe);
|
1066
|
-
while(xa < xae) {
|
1067
|
-
y = *xa++ - borrow;
|
1068
|
-
borrow = y >> 32 & (ULong)1;
|
1069
|
-
*xc++ = y & FFFFFFFF;
|
1070
|
-
}
|
1071
|
-
#else
|
1072
|
-
#ifdef Pack_32
|
1073
|
-
do {
|
1074
|
-
y = (*xa & 0xffff) - (*xb & 0xffff) - borrow;
|
1075
|
-
borrow = (y & 0x10000) >> 16;
|
1076
|
-
z = (*xa++ >> 16) - (*xb++ >> 16) - borrow;
|
1077
|
-
borrow = (z & 0x10000) >> 16;
|
1078
|
-
Storeinc(xc, z, y);
|
1079
|
-
}
|
1080
|
-
while(xb < xbe);
|
1081
|
-
while(xa < xae) {
|
1082
|
-
y = (*xa & 0xffff) - borrow;
|
1083
|
-
borrow = (y & 0x10000) >> 16;
|
1084
|
-
z = (*xa++ >> 16) - borrow;
|
1085
|
-
borrow = (z & 0x10000) >> 16;
|
1086
|
-
Storeinc(xc, z, y);
|
1087
|
-
}
|
1088
|
-
#else
|
1089
|
-
do {
|
1090
|
-
y = *xa++ - *xb++ - borrow;
|
1091
|
-
borrow = (y & 0x10000) >> 16;
|
1092
|
-
*xc++ = y & 0xffff;
|
1093
|
-
}
|
1094
|
-
while(xb < xbe);
|
1095
|
-
while(xa < xae) {
|
1096
|
-
y = *xa++ - borrow;
|
1097
|
-
borrow = (y & 0x10000) >> 16;
|
1098
|
-
*xc++ = y & 0xffff;
|
1099
|
-
}
|
1100
|
-
#endif
|
1101
|
-
#endif
|
1102
|
-
while(!*--xc)
|
1103
|
-
wa--;
|
1104
|
-
c->wds = wa;
|
1105
|
-
return c;
|
1106
|
-
}
|
1107
|
-
|
1108
|
-
static double
|
1109
|
-
ulp
|
1110
|
-
#ifdef KR_headers
|
1111
|
-
(x) double x;
|
1112
|
-
#else
|
1113
|
-
(double x)
|
1114
|
-
#endif
|
1115
|
-
{
|
1116
|
-
register Long L;
|
1117
|
-
double a;
|
1118
|
-
|
1119
|
-
L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1;
|
1120
|
-
#ifndef Avoid_Underflow
|
1121
|
-
#ifndef Sudden_Underflow
|
1122
|
-
if (L > 0) {
|
1123
|
-
#endif
|
1124
|
-
#endif
|
1125
|
-
#ifdef IBM
|
1126
|
-
L |= Exp_msk1 >> 4;
|
1127
|
-
#endif
|
1128
|
-
word0(a) = L;
|
1129
|
-
word1(a) = 0;
|
1130
|
-
#ifndef Avoid_Underflow
|
1131
|
-
#ifndef Sudden_Underflow
|
1132
|
-
}
|
1133
|
-
else {
|
1134
|
-
L = -L >> Exp_shift;
|
1135
|
-
if (L < Exp_shift) {
|
1136
|
-
word0(a) = 0x80000 >> L;
|
1137
|
-
word1(a) = 0;
|
1138
|
-
}
|
1139
|
-
else {
|
1140
|
-
word0(a) = 0;
|
1141
|
-
L -= Exp_shift;
|
1142
|
-
word1(a) = L >= 31 ? 1 : 1 << 31 - L;
|
1143
|
-
}
|
1144
|
-
}
|
1145
|
-
#endif
|
1146
|
-
#endif
|
1147
|
-
return dval(a);
|
1148
|
-
}
|
1149
|
-
|
1150
|
-
static double
|
1151
|
-
b2d
|
1152
|
-
#ifdef KR_headers
|
1153
|
-
(a, e) Bigint *a; int *e;
|
1154
|
-
#else
|
1155
|
-
(Bigint *a, int *e)
|
1156
|
-
#endif
|
1157
|
-
{
|
1158
|
-
ULong *xa, *xa0, w, y, z;
|
1159
|
-
int k;
|
1160
|
-
double d;
|
1161
|
-
#ifdef VAX
|
1162
|
-
ULong d0, d1;
|
1163
|
-
#else
|
1164
|
-
#define d0 word0(d)
|
1165
|
-
#define d1 word1(d)
|
1166
|
-
#endif
|
1167
|
-
|
1168
|
-
xa0 = a->x;
|
1169
|
-
xa = xa0 + a->wds;
|
1170
|
-
y = *--xa;
|
1171
|
-
#ifdef DEBUG
|
1172
|
-
if (!y) Bug("zero y in b2d");
|
1173
|
-
#endif
|
1174
|
-
k = hi0bits(y);
|
1175
|
-
*e = 32 - k;
|
1176
|
-
#ifdef Pack_32
|
1177
|
-
if (k < Ebits) {
|
1178
|
-
d0 = Exp_1 | (y >> (Ebits - k));
|
1179
|
-
w = xa > xa0 ? *--xa : 0;
|
1180
|
-
d1 = (y << ((32-Ebits) + k)) | (w >> (Ebits - k));
|
1181
|
-
goto ret_d;
|
1182
|
-
}
|
1183
|
-
z = xa > xa0 ? *--xa : 0;
|
1184
|
-
if (k -= Ebits) {
|
1185
|
-
d0 = Exp_1 | (y << k) | (z >> (32 - k));
|
1186
|
-
y = xa > xa0 ? *--xa : 0;
|
1187
|
-
d1 = (z << k) | (y >> (32 - k));
|
1188
|
-
}
|
1189
|
-
else {
|
1190
|
-
d0 = Exp_1 | y;
|
1191
|
-
d1 = z;
|
1192
|
-
}
|
1193
|
-
#else
|
1194
|
-
if (k < Ebits + 16) {
|
1195
|
-
z = xa > xa0 ? *--xa : 0;
|
1196
|
-
d0 = Exp_1 | (y << (k - Ebits)) | (z >> (Ebits + 16 - k));
|
1197
|
-
w = xa > xa0 ? *--xa : 0;
|
1198
|
-
y = xa > xa0 ? *--xa : 0;
|
1199
|
-
d1 = (z << (k + 16 - Ebits)) | (w << (k - Ebits)) | (y >> (16 + Ebits - k));
|
1200
|
-
goto ret_d;
|
1201
|
-
}
|
1202
|
-
z = xa > xa0 ? *--xa : 0;
|
1203
|
-
w = xa > xa0 ? *--xa : 0;
|
1204
|
-
k -= Ebits + 16;
|
1205
|
-
d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k;
|
1206
|
-
y = xa > xa0 ? *--xa : 0;
|
1207
|
-
d1 = w << k + 16 | y << k;
|
1208
|
-
#endif
|
1209
|
-
ret_d:
|
1210
|
-
#ifdef VAX
|
1211
|
-
word0(d) = d0 >> 16 | d0 << 16;
|
1212
|
-
word1(d) = d1 >> 16 | d1 << 16;
|
1213
|
-
#else
|
1214
|
-
#undef d0
|
1215
|
-
#undef d1
|
1216
|
-
#endif
|
1217
|
-
return dval(d);
|
1218
|
-
}
|
1219
|
-
|
1220
|
-
static Bigint *
|
1221
|
-
d2b
|
1222
|
-
#ifdef KR_headers
|
1223
|
-
(d, e, bits) double d; int *e, *bits;
|
1224
|
-
#else
|
1225
|
-
(double d, int *e, int *bits)
|
1226
|
-
#endif
|
1227
|
-
{
|
1228
|
-
Bigint *b;
|
1229
|
-
int de, k;
|
1230
|
-
ULong *x, y, z;
|
1231
|
-
#ifndef Sudden_Underflow
|
1232
|
-
int i;
|
1233
|
-
#endif
|
1234
|
-
#ifdef VAX
|
1235
|
-
ULong d0, d1;
|
1236
|
-
d0 = word0(d) >> 16 | word0(d) << 16;
|
1237
|
-
d1 = word1(d) >> 16 | word1(d) << 16;
|
1238
|
-
#else
|
1239
|
-
#define d0 word0(d)
|
1240
|
-
#define d1 word1(d)
|
1241
|
-
#endif
|
1242
|
-
|
1243
|
-
#ifdef Pack_32
|
1244
|
-
b = Balloc(1);
|
1245
|
-
#else
|
1246
|
-
b = Balloc(2);
|
1247
|
-
#endif
|
1248
|
-
x = b->x;
|
1249
|
-
|
1250
|
-
z = d0 & Frac_mask;
|
1251
|
-
d0 &= 0x7fffffff; /* clear sign bit, which we ignore */
|
1252
|
-
#ifdef Sudden_Underflow
|
1253
|
-
de = (int)(d0 >> Exp_shift);
|
1254
|
-
#ifndef IBM
|
1255
|
-
z |= Exp_msk11;
|
1256
|
-
#endif
|
1257
|
-
#else
|
1258
|
-
if ((de = (int)(d0 >> Exp_shift)))
|
1259
|
-
z |= Exp_msk1;
|
1260
|
-
#endif
|
1261
|
-
#ifdef Pack_32
|
1262
|
-
if ((y = d1)) {
|
1263
|
-
if ((k = lo0bits(&y))) {
|
1264
|
-
x[0] = y | (z << (32 - k));
|
1265
|
-
z >>= k;
|
1266
|
-
}
|
1267
|
-
else
|
1268
|
-
x[0] = y;
|
1269
|
-
#ifndef Sudden_Underflow
|
1270
|
-
i =
|
1271
|
-
#endif
|
1272
|
-
b->wds = (x[1] = z) ? 2 : 1;
|
1273
|
-
}
|
1274
|
-
else {
|
1275
|
-
/* This assertion fails for "1e-500" and other very
|
1276
|
-
* small numbers. It provides the right result (0)
|
1277
|
-
* though. This assert has also been removed from KJS's
|
1278
|
-
* version of dtoa.c.
|
1279
|
-
*
|
1280
|
-
* #ifdef DEBUG
|
1281
|
-
* if (!z) Bug("zero z in b2d");
|
1282
|
-
* #endif
|
1283
|
-
*/
|
1284
|
-
k = lo0bits(&z);
|
1285
|
-
x[0] = z;
|
1286
|
-
#ifndef Sudden_Underflow
|
1287
|
-
i =
|
1288
|
-
#endif
|
1289
|
-
b->wds = 1;
|
1290
|
-
k += 32;
|
1291
|
-
}
|
1292
|
-
#else
|
1293
|
-
if (y = d1) {
|
1294
|
-
if (k = lo0bits(&y))
|
1295
|
-
if (k >= 16) {
|
1296
|
-
x[0] = y | z << 32 - k & 0xffff;
|
1297
|
-
x[1] = z >> k - 16 & 0xffff;
|
1298
|
-
x[2] = z >> k;
|
1299
|
-
i = 2;
|
1300
|
-
}
|
1301
|
-
else {
|
1302
|
-
x[0] = y & 0xffff;
|
1303
|
-
x[1] = y >> 16 | z << 16 - k & 0xffff;
|
1304
|
-
x[2] = z >> k & 0xffff;
|
1305
|
-
x[3] = z >> k+16;
|
1306
|
-
i = 3;
|
1307
|
-
}
|
1308
|
-
else {
|
1309
|
-
x[0] = y & 0xffff;
|
1310
|
-
x[1] = y >> 16;
|
1311
|
-
x[2] = z & 0xffff;
|
1312
|
-
x[3] = z >> 16;
|
1313
|
-
i = 3;
|
1314
|
-
}
|
1315
|
-
}
|
1316
|
-
else {
|
1317
|
-
#ifdef DEBUG
|
1318
|
-
if (!z)
|
1319
|
-
Bug("Zero passed to d2b");
|
1320
|
-
#endif
|
1321
|
-
k = lo0bits(&z);
|
1322
|
-
if (k >= 16) {
|
1323
|
-
x[0] = z;
|
1324
|
-
i = 0;
|
1325
|
-
}
|
1326
|
-
else {
|
1327
|
-
x[0] = z & 0xffff;
|
1328
|
-
x[1] = z >> 16;
|
1329
|
-
i = 1;
|
1330
|
-
}
|
1331
|
-
k += 32;
|
1332
|
-
}
|
1333
|
-
while(!x[i])
|
1334
|
-
--i;
|
1335
|
-
b->wds = i + 1;
|
1336
|
-
#endif
|
1337
|
-
#ifndef Sudden_Underflow
|
1338
|
-
if (de) {
|
1339
|
-
#endif
|
1340
|
-
#ifdef IBM
|
1341
|
-
*e = (de - Bias - (P-1) << 2) + k;
|
1342
|
-
*bits = 4*P + 8 - k - hi0bits(word0(d) & Frac_mask);
|
1343
|
-
#else
|
1344
|
-
*e = de - Bias - (P-1) + k;
|
1345
|
-
*bits = P - k;
|
1346
|
-
#endif
|
1347
|
-
#ifndef Sudden_Underflow
|
1348
|
-
}
|
1349
|
-
else {
|
1350
|
-
*e = de - Bias - (P-1) + 1 + k;
|
1351
|
-
#ifdef Pack_32
|
1352
|
-
*bits = 32*i - hi0bits(x[i-1]);
|
1353
|
-
#else
|
1354
|
-
*bits = (i+2)*16 - hi0bits(x[i]);
|
1355
|
-
#endif
|
1356
|
-
}
|
1357
|
-
#endif
|
1358
|
-
return b;
|
1359
|
-
}
|
1360
|
-
#undef d0
|
1361
|
-
#undef d1
|
1362
|
-
|
1363
|
-
static double
|
1364
|
-
ratio
|
1365
|
-
#ifdef KR_headers
|
1366
|
-
(a, b) Bigint *a, *b;
|
1367
|
-
#else
|
1368
|
-
(Bigint *a, Bigint *b)
|
1369
|
-
#endif
|
1370
|
-
{
|
1371
|
-
double da, db;
|
1372
|
-
int k, ka, kb;
|
1373
|
-
|
1374
|
-
dval(da) = b2d(a, &ka);
|
1375
|
-
dval(db) = b2d(b, &kb);
|
1376
|
-
#ifdef Pack_32
|
1377
|
-
k = ka - kb + 32*(a->wds - b->wds);
|
1378
|
-
#else
|
1379
|
-
k = ka - kb + 16*(a->wds - b->wds);
|
1380
|
-
#endif
|
1381
|
-
#ifdef IBM
|
1382
|
-
if (k > 0) {
|
1383
|
-
word0(da) += (k >> 2)*Exp_msk1;
|
1384
|
-
if (k &= 3)
|
1385
|
-
dval(da) *= 1 << k;
|
1386
|
-
}
|
1387
|
-
else {
|
1388
|
-
k = -k;
|
1389
|
-
word0(db) += (k >> 2)*Exp_msk1;
|
1390
|
-
if (k &= 3)
|
1391
|
-
dval(db) *= 1 << k;
|
1392
|
-
}
|
1393
|
-
#else
|
1394
|
-
if (k > 0)
|
1395
|
-
word0(da) += k*Exp_msk1;
|
1396
|
-
else {
|
1397
|
-
k = -k;
|
1398
|
-
word0(db) += k*Exp_msk1;
|
1399
|
-
}
|
1400
|
-
#endif
|
1401
|
-
return dval(da) / dval(db);
|
1402
|
-
}
|
1403
|
-
|
1404
|
-
static CONST double
|
1405
|
-
tens[] = {
|
1406
|
-
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
|
1407
|
-
1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
|
1408
|
-
1e20, 1e21, 1e22
|
1409
|
-
#ifdef VAX
|
1410
|
-
, 1e23, 1e24
|
1411
|
-
#endif
|
1412
|
-
};
|
1413
|
-
|
1414
|
-
static CONST double
|
1415
|
-
#ifdef IEEE_Arith
|
1416
|
-
bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 };
|
1417
|
-
static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128,
|
1418
|
-
#ifdef Avoid_Underflow
|
1419
|
-
9007199254740992.*9007199254740992.e-256
|
1420
|
-
/* = 2^106 * 1e-53 */
|
1421
|
-
#else
|
1422
|
-
1e-256
|
1423
|
-
#endif
|
1424
|
-
};
|
1425
|
-
/* The factor of 2^53 in tinytens[4] helps us avoid setting the underflow */
|
1426
|
-
/* flag unnecessarily. It leads to a song and dance at the end of strtod. */
|
1427
|
-
#define Scale_Bit 0x10
|
1428
|
-
#define n_bigtens 5
|
1429
|
-
#else
|
1430
|
-
#ifdef IBM
|
1431
|
-
bigtens[] = { 1e16, 1e32, 1e64 };
|
1432
|
-
static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64 };
|
1433
|
-
#define n_bigtens 3
|
1434
|
-
#else
|
1435
|
-
bigtens[] = { 1e16, 1e32 };
|
1436
|
-
static CONST double tinytens[] = { 1e-16, 1e-32 };
|
1437
|
-
#define n_bigtens 2
|
1438
|
-
#endif
|
1439
|
-
#endif
|
1440
|
-
|
1441
|
-
#ifndef IEEE_Arith
|
1442
|
-
#undef INFNAN_CHECK
|
1443
|
-
#endif
|
1444
|
-
|
1445
|
-
#ifdef INFNAN_CHECK
|
1446
|
-
|
1447
|
-
#ifndef NAN_WORD0
|
1448
|
-
#define NAN_WORD0 0x7ff80000
|
1449
|
-
#endif
|
1450
|
-
|
1451
|
-
#ifndef NAN_WORD1
|
1452
|
-
#define NAN_WORD1 0
|
1453
|
-
#endif
|
1454
|
-
|
1455
|
-
static int
|
1456
|
-
match
|
1457
|
-
#ifdef KR_headers
|
1458
|
-
(sp, t) char **sp, *t;
|
1459
|
-
#else
|
1460
|
-
(CONST char **sp, char *t)
|
1461
|
-
#endif
|
1462
|
-
{
|
1463
|
-
int c, d;
|
1464
|
-
CONST char *s = *sp;
|
1465
|
-
|
1466
|
-
while(d = *t++) {
|
1467
|
-
if ((c = *++s) >= 'A' && c <= 'Z')
|
1468
|
-
c += 'a' - 'A';
|
1469
|
-
if (c != d)
|
1470
|
-
return 0;
|
1471
|
-
}
|
1472
|
-
*sp = s + 1;
|
1473
|
-
return 1;
|
1474
|
-
}
|
1475
|
-
|
1476
|
-
#ifndef No_Hex_NaN
|
1477
|
-
static void
|
1478
|
-
hexnan
|
1479
|
-
#ifdef KR_headers
|
1480
|
-
(rvp, sp) double *rvp; CONST char **sp;
|
1481
|
-
#else
|
1482
|
-
(double *rvp, CONST char **sp)
|
1483
|
-
#endif
|
1484
|
-
{
|
1485
|
-
ULong c, x[2];
|
1486
|
-
CONST char *s;
|
1487
|
-
int havedig, udx0, xshift;
|
1488
|
-
|
1489
|
-
x[0] = x[1] = 0;
|
1490
|
-
havedig = xshift = 0;
|
1491
|
-
udx0 = 1;
|
1492
|
-
s = *sp;
|
1493
|
-
while(c = *(CONST unsigned char*)++s) {
|
1494
|
-
if (c >= '0' && c <= '9')
|
1495
|
-
c -= '0';
|
1496
|
-
else if (c >= 'a' && c <= 'f')
|
1497
|
-
c += 10 - 'a';
|
1498
|
-
else if (c >= 'A' && c <= 'F')
|
1499
|
-
c += 10 - 'A';
|
1500
|
-
else if (c <= ' ') {
|
1501
|
-
if (udx0 && havedig) {
|
1502
|
-
udx0 = 0;
|
1503
|
-
xshift = 1;
|
1504
|
-
}
|
1505
|
-
continue;
|
1506
|
-
}
|
1507
|
-
else if (/*(*/ c == ')' && havedig) {
|
1508
|
-
*sp = s + 1;
|
1509
|
-
break;
|
1510
|
-
}
|
1511
|
-
else
|
1512
|
-
return; /* invalid form: don't change *sp */
|
1513
|
-
havedig = 1;
|
1514
|
-
if (xshift) {
|
1515
|
-
xshift = 0;
|
1516
|
-
x[0] = x[1];
|
1517
|
-
x[1] = 0;
|
1518
|
-
}
|
1519
|
-
if (udx0)
|
1520
|
-
x[0] = (x[0] << 4) | (x[1] >> 28);
|
1521
|
-
x[1] = (x[1] << 4) | c;
|
1522
|
-
}
|
1523
|
-
if ((x[0] &= 0xfffff) || x[1]) {
|
1524
|
-
word0(*rvp) = Exp_mask | x[0];
|
1525
|
-
word1(*rvp) = x[1];
|
1526
|
-
}
|
1527
|
-
}
|
1528
|
-
#endif /*No_Hex_NaN*/
|
1529
|
-
#endif /* INFNAN_CHECK */
|
1530
|
-
|
1531
|
-
double
|
1532
|
-
strtod
|
1533
|
-
#ifdef KR_headers
|
1534
|
-
(s00, se) CONST char *s00; char **se;
|
1535
|
-
#else
|
1536
|
-
(CONST char *s00, char **se)
|
1537
|
-
#endif
|
1538
|
-
{
|
1539
|
-
#ifdef Avoid_Underflow
|
1540
|
-
int scale;
|
1541
|
-
#endif
|
1542
|
-
int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
|
1543
|
-
e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
|
1544
|
-
CONST char *s, *s0, *s1;
|
1545
|
-
double aadj, aadj1, adj, rv, rv0;
|
1546
|
-
Long L;
|
1547
|
-
ULong y, z;
|
1548
|
-
Bigint *bb = NULL, *bb1, *bd = NULL, *bd0, *bs = NULL, *delta = NULL;
|
1549
|
-
#ifdef SET_INEXACT
|
1550
|
-
int inexact, oldinexact;
|
1551
|
-
#endif
|
1552
|
-
#ifdef Honor_FLT_ROUNDS
|
1553
|
-
int rounding;
|
1554
|
-
#endif
|
1555
|
-
#ifdef USE_LOCALE
|
1556
|
-
CONST char *s2;
|
1557
|
-
#endif
|
1558
|
-
|
1559
|
-
sign = nz0 = nz = 0;
|
1560
|
-
dval(rv) = 0.;
|
1561
|
-
for(s = s00;;s++) switch(*s) {
|
1562
|
-
case '-':
|
1563
|
-
sign = 1;
|
1564
|
-
/* no break */
|
1565
|
-
case '+':
|
1566
|
-
if (*++s)
|
1567
|
-
goto break2;
|
1568
|
-
/* no break */
|
1569
|
-
case 0:
|
1570
|
-
goto ret0;
|
1571
|
-
case '\t':
|
1572
|
-
case '\n':
|
1573
|
-
case '\v':
|
1574
|
-
case '\f':
|
1575
|
-
case '\r':
|
1576
|
-
case ' ':
|
1577
|
-
continue;
|
1578
|
-
default:
|
1579
|
-
goto break2;
|
1580
|
-
}
|
1581
|
-
break2:
|
1582
|
-
if (*s == '0') {
|
1583
|
-
nz0 = 1;
|
1584
|
-
while(*++s == '0') ;
|
1585
|
-
if (!*s)
|
1586
|
-
goto ret;
|
1587
|
-
}
|
1588
|
-
s0 = s;
|
1589
|
-
y = z = 0;
|
1590
|
-
for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++)
|
1591
|
-
if (nd < 9)
|
1592
|
-
y = 10*y + c - '0';
|
1593
|
-
else if (nd < 16)
|
1594
|
-
z = 10*z + c - '0';
|
1595
|
-
nd0 = nd;
|
1596
|
-
#ifdef USE_LOCALE
|
1597
|
-
s1 = localeconv()->decimal_point;
|
1598
|
-
if (c == *s1) {
|
1599
|
-
c = '.';
|
1600
|
-
if (*++s1) {
|
1601
|
-
s2 = s;
|
1602
|
-
for(;;) {
|
1603
|
-
if (*++s2 != *s1) {
|
1604
|
-
c = 0;
|
1605
|
-
break;
|
1606
|
-
}
|
1607
|
-
if (!*++s1) {
|
1608
|
-
s = s2;
|
1609
|
-
break;
|
1610
|
-
}
|
1611
|
-
}
|
1612
|
-
}
|
1613
|
-
}
|
1614
|
-
#endif
|
1615
|
-
if (c == '.') {
|
1616
|
-
c = *++s;
|
1617
|
-
if (!nd) {
|
1618
|
-
for(; c == '0'; c = *++s)
|
1619
|
-
nz++;
|
1620
|
-
if (c > '0' && c <= '9') {
|
1621
|
-
s0 = s;
|
1622
|
-
nf += nz;
|
1623
|
-
nz = 0;
|
1624
|
-
goto have_dig;
|
1625
|
-
}
|
1626
|
-
goto dig_done;
|
1627
|
-
}
|
1628
|
-
for(; c >= '0' && c <= '9'; c = *++s) {
|
1629
|
-
have_dig:
|
1630
|
-
nz++;
|
1631
|
-
if (c -= '0') {
|
1632
|
-
nf += nz;
|
1633
|
-
for(i = 1; i < nz; i++)
|
1634
|
-
if (nd++ < 9)
|
1635
|
-
y *= 10;
|
1636
|
-
else if (nd <= DBL_DIG + 1)
|
1637
|
-
z *= 10;
|
1638
|
-
if (nd++ < 9)
|
1639
|
-
y = 10*y + c;
|
1640
|
-
else if (nd <= DBL_DIG + 1)
|
1641
|
-
z = 10*z + c;
|
1642
|
-
nz = 0;
|
1643
|
-
}
|
1644
|
-
}
|
1645
|
-
}
|
1646
|
-
dig_done:
|
1647
|
-
e = 0;
|
1648
|
-
if (c == 'e' || c == 'E') {
|
1649
|
-
if (!nd && !nz && !nz0) {
|
1650
|
-
goto ret0;
|
1651
|
-
}
|
1652
|
-
s00 = s;
|
1653
|
-
esign = 0;
|
1654
|
-
switch(c = *++s) {
|
1655
|
-
case '-':
|
1656
|
-
esign = 1;
|
1657
|
-
case '+':
|
1658
|
-
c = *++s;
|
1659
|
-
}
|
1660
|
-
if (c >= '0' && c <= '9') {
|
1661
|
-
while(c == '0')
|
1662
|
-
c = *++s;
|
1663
|
-
if (c > '0' && c <= '9') {
|
1664
|
-
L = c - '0';
|
1665
|
-
s1 = s;
|
1666
|
-
while((c = *++s) >= '0' && c <= '9')
|
1667
|
-
L = 10*L + c - '0';
|
1668
|
-
if (s - s1 > 8 || L > 19999)
|
1669
|
-
/* Avoid confusion from exponents
|
1670
|
-
* so large that e might overflow.
|
1671
|
-
*/
|
1672
|
-
e = 19999; /* safe for 16 bit ints */
|
1673
|
-
else
|
1674
|
-
e = (int)L;
|
1675
|
-
if (esign)
|
1676
|
-
e = -e;
|
1677
|
-
}
|
1678
|
-
else
|
1679
|
-
e = 0;
|
1680
|
-
}
|
1681
|
-
else
|
1682
|
-
s = s00;
|
1683
|
-
}
|
1684
|
-
if (!nd) {
|
1685
|
-
if (!nz && !nz0) {
|
1686
|
-
#ifdef INFNAN_CHECK
|
1687
|
-
/* Check for Nan and Infinity */
|
1688
|
-
switch(c) {
|
1689
|
-
case 'i':
|
1690
|
-
case 'I':
|
1691
|
-
if (match(&s,"nf")) {
|
1692
|
-
--s;
|
1693
|
-
if (!match(&s,"inity"))
|
1694
|
-
++s;
|
1695
|
-
word0(rv) = 0x7ff00000;
|
1696
|
-
word1(rv) = 0;
|
1697
|
-
goto ret;
|
1698
|
-
}
|
1699
|
-
break;
|
1700
|
-
case 'n':
|
1701
|
-
case 'N':
|
1702
|
-
if (match(&s, "an")) {
|
1703
|
-
word0(rv) = NAN_WORD0;
|
1704
|
-
word1(rv) = NAN_WORD1;
|
1705
|
-
#ifndef No_Hex_NaN
|
1706
|
-
if (*s == '(') /*)*/
|
1707
|
-
hexnan(&rv, &s);
|
1708
|
-
#endif
|
1709
|
-
goto ret;
|
1710
|
-
}
|
1711
|
-
}
|
1712
|
-
#endif /* INFNAN_CHECK */
|
1713
|
-
ret0:
|
1714
|
-
s = s00;
|
1715
|
-
sign = 0;
|
1716
|
-
}
|
1717
|
-
goto ret;
|
1718
|
-
}
|
1719
|
-
e1 = e -= nf;
|
1720
|
-
|
1721
|
-
/* Now we have nd0 digits, starting at s0, followed by a
|
1722
|
-
* decimal point, followed by nd-nd0 digits. The number we're
|
1723
|
-
* after is the integer represented by those digits times
|
1724
|
-
* 10**e */
|
1725
|
-
|
1726
|
-
if (!nd0)
|
1727
|
-
nd0 = nd;
|
1728
|
-
k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1;
|
1729
|
-
dval(rv) = y;
|
1730
|
-
if (k > 9) {
|
1731
|
-
#ifdef SET_INEXACT
|
1732
|
-
if (k > DBL_DIG)
|
1733
|
-
oldinexact = get_inexact();
|
1734
|
-
#endif
|
1735
|
-
dval(rv) = tens[k - 9] * dval(rv) + z;
|
1736
|
-
}
|
1737
|
-
bd0 = 0;
|
1738
|
-
if (nd <= DBL_DIG
|
1739
|
-
#ifndef RND_PRODQUOT
|
1740
|
-
#ifndef Honor_FLT_ROUNDS
|
1741
|
-
&& Flt_Rounds == 1
|
1742
|
-
#endif
|
1743
|
-
#endif
|
1744
|
-
) {
|
1745
|
-
if (!e)
|
1746
|
-
goto ret;
|
1747
|
-
if (e > 0) {
|
1748
|
-
if (e <= Ten_pmax) {
|
1749
|
-
#ifdef VAX
|
1750
|
-
goto vax_ovfl_check;
|
1751
|
-
#else
|
1752
|
-
#ifdef Honor_FLT_ROUNDS
|
1753
|
-
/* round correctly FLT_ROUNDS = 2 or 3 */
|
1754
|
-
if (sign) {
|
1755
|
-
rv = -rv;
|
1756
|
-
sign = 0;
|
1757
|
-
}
|
1758
|
-
#endif
|
1759
|
-
/* rv = */ rounded_product(dval(rv), tens[e]);
|
1760
|
-
goto ret;
|
1761
|
-
#endif
|
1762
|
-
}
|
1763
|
-
i = DBL_DIG - nd;
|
1764
|
-
if (e <= Ten_pmax + i) {
|
1765
|
-
/* A fancier test would sometimes let us do
|
1766
|
-
* this for larger i values.
|
1767
|
-
*/
|
1768
|
-
#ifdef Honor_FLT_ROUNDS
|
1769
|
-
/* round correctly FLT_ROUNDS = 2 or 3 */
|
1770
|
-
if (sign) {
|
1771
|
-
rv = -rv;
|
1772
|
-
sign = 0;
|
1773
|
-
}
|
1774
|
-
#endif
|
1775
|
-
e -= i;
|
1776
|
-
dval(rv) *= tens[i];
|
1777
|
-
#ifdef VAX
|
1778
|
-
/* VAX exponent range is so narrow we must
|
1779
|
-
* worry about overflow here...
|
1780
|
-
*/
|
1781
|
-
vax_ovfl_check:
|
1782
|
-
word0(rv) -= P*Exp_msk1;
|
1783
|
-
/* rv = */ rounded_product(dval(rv), tens[e]);
|
1784
|
-
if ((word0(rv) & Exp_mask)
|
1785
|
-
> Exp_msk1*(DBL_MAX_EXP+Bias-1-P))
|
1786
|
-
goto ovfl;
|
1787
|
-
word0(rv) += P*Exp_msk1;
|
1788
|
-
#else
|
1789
|
-
/* rv = */ rounded_product(dval(rv), tens[e]);
|
1790
|
-
#endif
|
1791
|
-
goto ret;
|
1792
|
-
}
|
1793
|
-
}
|
1794
|
-
#ifndef Inaccurate_Divide
|
1795
|
-
else if (e >= -Ten_pmax) {
|
1796
|
-
#ifdef Honor_FLT_ROUNDS
|
1797
|
-
/* round correctly FLT_ROUNDS = 2 or 3 */
|
1798
|
-
if (sign) {
|
1799
|
-
rv = -rv;
|
1800
|
-
sign = 0;
|
1801
|
-
}
|
1802
|
-
#endif
|
1803
|
-
/* rv = */ rounded_quotient(dval(rv), tens[-e]);
|
1804
|
-
goto ret;
|
1805
|
-
}
|
1806
|
-
#endif
|
1807
|
-
}
|
1808
|
-
e1 += nd - k;
|
1809
|
-
|
1810
|
-
#ifdef IEEE_Arith
|
1811
|
-
#ifdef SET_INEXACT
|
1812
|
-
inexact = 1;
|
1813
|
-
if (k <= DBL_DIG)
|
1814
|
-
oldinexact = get_inexact();
|
1815
|
-
#endif
|
1816
|
-
#ifdef Avoid_Underflow
|
1817
|
-
scale = 0;
|
1818
|
-
#endif
|
1819
|
-
#ifdef Honor_FLT_ROUNDS
|
1820
|
-
if ((rounding = Flt_Rounds) >= 2) {
|
1821
|
-
if (sign)
|
1822
|
-
rounding = rounding == 2 ? 0 : 2;
|
1823
|
-
else
|
1824
|
-
if (rounding != 2)
|
1825
|
-
rounding = 0;
|
1826
|
-
}
|
1827
|
-
#endif
|
1828
|
-
#endif /*IEEE_Arith*/
|
1829
|
-
|
1830
|
-
/* Get starting approximation = rv * 10**e1 */
|
1831
|
-
|
1832
|
-
if (e1 > 0) {
|
1833
|
-
if ((i = e1 & 15))
|
1834
|
-
dval(rv) *= tens[i];
|
1835
|
-
if (e1 &= ~15) {
|
1836
|
-
if (e1 > DBL_MAX_10_EXP) {
|
1837
|
-
ovfl:
|
1838
|
-
#ifndef NO_ERRNO
|
1839
|
-
errno = ERANGE;
|
1840
|
-
#endif
|
1841
|
-
/* Can't trust HUGE_VAL */
|
1842
|
-
#ifdef IEEE_Arith
|
1843
|
-
#ifdef Honor_FLT_ROUNDS
|
1844
|
-
switch(rounding) {
|
1845
|
-
case 0: /* toward 0 */
|
1846
|
-
case 3: /* toward -infinity */
|
1847
|
-
word0(rv) = Big0;
|
1848
|
-
word1(rv) = Big1;
|
1849
|
-
break;
|
1850
|
-
default:
|
1851
|
-
word0(rv) = Exp_mask;
|
1852
|
-
word1(rv) = 0;
|
1853
|
-
}
|
1854
|
-
#else /*Honor_FLT_ROUNDS*/
|
1855
|
-
word0(rv) = Exp_mask;
|
1856
|
-
word1(rv) = 0;
|
1857
|
-
#endif /*Honor_FLT_ROUNDS*/
|
1858
|
-
#ifdef SET_INEXACT
|
1859
|
-
/* set overflow bit */
|
1860
|
-
dval(rv0) = 1e300;
|
1861
|
-
dval(rv0) *= dval(rv0);
|
1862
|
-
#endif
|
1863
|
-
#else /*IEEE_Arith*/
|
1864
|
-
word0(rv) = Big0;
|
1865
|
-
word1(rv) = Big1;
|
1866
|
-
#endif /*IEEE_Arith*/
|
1867
|
-
if (bd0)
|
1868
|
-
goto retfree;
|
1869
|
-
goto ret;
|
1870
|
-
}
|
1871
|
-
e1 >>= 4;
|
1872
|
-
for(j = 0; e1 > 1; j++, e1 >>= 1)
|
1873
|
-
if (e1 & 1)
|
1874
|
-
dval(rv) *= bigtens[j];
|
1875
|
-
/* The last multiplication could overflow. */
|
1876
|
-
word0(rv) -= P*Exp_msk1;
|
1877
|
-
dval(rv) *= bigtens[j];
|
1878
|
-
if ((z = word0(rv) & Exp_mask)
|
1879
|
-
> Exp_msk1*(DBL_MAX_EXP+Bias-P))
|
1880
|
-
goto ovfl;
|
1881
|
-
if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) {
|
1882
|
-
/* set to largest number */
|
1883
|
-
/* (Can't trust DBL_MAX) */
|
1884
|
-
word0(rv) = Big0;
|
1885
|
-
word1(rv) = Big1;
|
1886
|
-
}
|
1887
|
-
else
|
1888
|
-
word0(rv) += P*Exp_msk1;
|
1889
|
-
}
|
1890
|
-
}
|
1891
|
-
else if (e1 < 0) {
|
1892
|
-
e1 = -e1;
|
1893
|
-
if ((i = e1 & 15))
|
1894
|
-
dval(rv) /= tens[i];
|
1895
|
-
if (e1 >>= 4) {
|
1896
|
-
if (e1 >= 1 << n_bigtens)
|
1897
|
-
goto undfl;
|
1898
|
-
#ifdef Avoid_Underflow
|
1899
|
-
if (e1 & Scale_Bit)
|
1900
|
-
scale = 2*P;
|
1901
|
-
for(j = 0; e1 > 0; j++, e1 >>= 1)
|
1902
|
-
if (e1 & 1)
|
1903
|
-
dval(rv) *= tinytens[j];
|
1904
|
-
if (scale && (j = 2*P + 1 - ((word0(rv) & Exp_mask)
|
1905
|
-
>> Exp_shift)) > 0) {
|
1906
|
-
/* scaled rv is denormal; zap j low bits */
|
1907
|
-
if (j >= 32) {
|
1908
|
-
word1(rv) = 0;
|
1909
|
-
if (j >= 53)
|
1910
|
-
word0(rv) = (P+2)*Exp_msk1;
|
1911
|
-
else
|
1912
|
-
word0(rv) &= 0xffffffff << (j-32);
|
1913
|
-
}
|
1914
|
-
else
|
1915
|
-
word1(rv) &= 0xffffffff << j;
|
1916
|
-
}
|
1917
|
-
#else
|
1918
|
-
for(j = 0; e1 > 1; j++, e1 >>= 1)
|
1919
|
-
if (e1 & 1)
|
1920
|
-
dval(rv) *= tinytens[j];
|
1921
|
-
/* The last multiplication could underflow. */
|
1922
|
-
dval(rv0) = dval(rv);
|
1923
|
-
dval(rv) *= tinytens[j];
|
1924
|
-
if (!dval(rv)) {
|
1925
|
-
dval(rv) = 2.*dval(rv0);
|
1926
|
-
dval(rv) *= tinytens[j];
|
1927
|
-
#endif
|
1928
|
-
if (!dval(rv)) {
|
1929
|
-
undfl:
|
1930
|
-
dval(rv) = 0.;
|
1931
|
-
#ifndef NO_ERRNO
|
1932
|
-
errno = ERANGE;
|
1933
|
-
#endif
|
1934
|
-
if (bd0)
|
1935
|
-
goto retfree;
|
1936
|
-
goto ret;
|
1937
|
-
}
|
1938
|
-
#ifndef Avoid_Underflow
|
1939
|
-
word0(rv) = Tiny0;
|
1940
|
-
word1(rv) = Tiny1;
|
1941
|
-
/* The refinement below will clean
|
1942
|
-
* this approximation up.
|
1943
|
-
*/
|
1944
|
-
}
|
1945
|
-
#endif
|
1946
|
-
}
|
1947
|
-
}
|
1948
|
-
|
1949
|
-
/* Now the hard part -- adjusting rv to the correct value.*/
|
1950
|
-
|
1951
|
-
/* Put digits into bd: true value = bd * 10^e */
|
1952
|
-
|
1953
|
-
bd0 = s2b(s0, nd0, nd, y);
|
1954
|
-
|
1955
|
-
for(;;) {
|
1956
|
-
bd = Balloc(bd0->k);
|
1957
|
-
Bcopy(bd, bd0);
|
1958
|
-
bb = d2b(dval(rv), &bbe, &bbbits); /* rv = bb * 2^bbe */
|
1959
|
-
bs = i2b(1);
|
1960
|
-
|
1961
|
-
if (e >= 0) {
|
1962
|
-
bb2 = bb5 = 0;
|
1963
|
-
bd2 = bd5 = e;
|
1964
|
-
}
|
1965
|
-
else {
|
1966
|
-
bb2 = bb5 = -e;
|
1967
|
-
bd2 = bd5 = 0;
|
1968
|
-
}
|
1969
|
-
if (bbe >= 0)
|
1970
|
-
bb2 += bbe;
|
1971
|
-
else
|
1972
|
-
bd2 -= bbe;
|
1973
|
-
bs2 = bb2;
|
1974
|
-
#ifdef Honor_FLT_ROUNDS
|
1975
|
-
if (rounding != 1)
|
1976
|
-
bs2++;
|
1977
|
-
#endif
|
1978
|
-
#ifdef Avoid_Underflow
|
1979
|
-
j = bbe - scale;
|
1980
|
-
i = j + bbbits - 1; /* logb(rv) */
|
1981
|
-
if (i < Emin) /* denormal */
|
1982
|
-
j += P - Emin;
|
1983
|
-
else
|
1984
|
-
j = P + 1 - bbbits;
|
1985
|
-
#else /*Avoid_Underflow*/
|
1986
|
-
#ifdef Sudden_Underflow
|
1987
|
-
#ifdef IBM
|
1988
|
-
j = 1 + 4*P - 3 - bbbits + ((bbe + bbbits - 1) & 3);
|
1989
|
-
#else
|
1990
|
-
j = P + 1 - bbbits;
|
1991
|
-
#endif
|
1992
|
-
#else /*Sudden_Underflow*/
|
1993
|
-
j = bbe;
|
1994
|
-
i = j + bbbits - 1; /* logb(rv) */
|
1995
|
-
if (i < Emin) /* denormal */
|
1996
|
-
j += P - Emin;
|
1997
|
-
else
|
1998
|
-
j = P + 1 - bbbits;
|
1999
|
-
#endif /*Sudden_Underflow*/
|
2000
|
-
#endif /*Avoid_Underflow*/
|
2001
|
-
bb2 += j;
|
2002
|
-
bd2 += j;
|
2003
|
-
#ifdef Avoid_Underflow
|
2004
|
-
bd2 += scale;
|
2005
|
-
#endif
|
2006
|
-
i = bb2 < bd2 ? bb2 : bd2;
|
2007
|
-
if (i > bs2)
|
2008
|
-
i = bs2;
|
2009
|
-
if (i > 0) {
|
2010
|
-
bb2 -= i;
|
2011
|
-
bd2 -= i;
|
2012
|
-
bs2 -= i;
|
2013
|
-
}
|
2014
|
-
if (bb5 > 0) {
|
2015
|
-
bs = pow5mult(bs, bb5);
|
2016
|
-
bb1 = mult(bs, bb);
|
2017
|
-
Bfree(bb);
|
2018
|
-
bb = bb1;
|
2019
|
-
}
|
2020
|
-
if (bb2 > 0)
|
2021
|
-
bb = lshift(bb, bb2);
|
2022
|
-
if (bd5 > 0)
|
2023
|
-
bd = pow5mult(bd, bd5);
|
2024
|
-
if (bd2 > 0)
|
2025
|
-
bd = lshift(bd, bd2);
|
2026
|
-
if (bs2 > 0)
|
2027
|
-
bs = lshift(bs, bs2);
|
2028
|
-
delta = diff(bb, bd);
|
2029
|
-
dsign = delta->sign;
|
2030
|
-
delta->sign = 0;
|
2031
|
-
i = cmp(delta, bs);
|
2032
|
-
#ifdef Honor_FLT_ROUNDS
|
2033
|
-
if (rounding != 1) {
|
2034
|
-
if (i < 0) {
|
2035
|
-
/* Error is less than an ulp */
|
2036
|
-
if (!delta->x[0] && delta->wds <= 1) {
|
2037
|
-
/* exact */
|
2038
|
-
#ifdef SET_INEXACT
|
2039
|
-
inexact = 0;
|
2040
|
-
#endif
|
2041
|
-
break;
|
2042
|
-
}
|
2043
|
-
if (rounding) {
|
2044
|
-
if (dsign) {
|
2045
|
-
adj = 1.;
|
2046
|
-
goto apply_adj;
|
2047
|
-
}
|
2048
|
-
}
|
2049
|
-
else if (!dsign) {
|
2050
|
-
adj = -1.;
|
2051
|
-
if (!word1(rv)
|
2052
|
-
&& !(word0(rv) & Frac_mask)) {
|
2053
|
-
y = word0(rv) & Exp_mask;
|
2054
|
-
#ifdef Avoid_Underflow
|
2055
|
-
if (!scale || y > 2*P*Exp_msk1)
|
2056
|
-
#else
|
2057
|
-
if (y)
|
2058
|
-
#endif
|
2059
|
-
{
|
2060
|
-
delta = lshift(delta,Log2P);
|
2061
|
-
if (cmp(delta, bs) <= 0)
|
2062
|
-
adj = -0.5;
|
2063
|
-
}
|
2064
|
-
}
|
2065
|
-
apply_adj:
|
2066
|
-
#ifdef Avoid_Underflow
|
2067
|
-
if (scale && (y = word0(rv) & Exp_mask)
|
2068
|
-
<= 2*P*Exp_msk1)
|
2069
|
-
word0(adj) += (2*P+1)*Exp_msk1 - y;
|
2070
|
-
#else
|
2071
|
-
#ifdef Sudden_Underflow
|
2072
|
-
if ((word0(rv) & Exp_mask) <=
|
2073
|
-
P*Exp_msk1) {
|
2074
|
-
word0(rv) += P*Exp_msk1;
|
2075
|
-
dval(rv) += adj*ulp(dval(rv));
|
2076
|
-
word0(rv) -= P*Exp_msk1;
|
2077
|
-
}
|
2078
|
-
else
|
2079
|
-
#endif /*Sudden_Underflow*/
|
2080
|
-
#endif /*Avoid_Underflow*/
|
2081
|
-
dval(rv) += adj*ulp(dval(rv));
|
2082
|
-
}
|
2083
|
-
break;
|
2084
|
-
}
|
2085
|
-
adj = ratio(delta, bs);
|
2086
|
-
if (adj < 1.)
|
2087
|
-
adj = 1.;
|
2088
|
-
if (adj <= 0x7ffffffe) {
|
2089
|
-
/* adj = rounding ? ceil(adj) : floor(adj); */
|
2090
|
-
y = adj;
|
2091
|
-
if (y != adj) {
|
2092
|
-
if (!((rounding>>1) ^ dsign))
|
2093
|
-
y++;
|
2094
|
-
adj = y;
|
2095
|
-
}
|
2096
|
-
}
|
2097
|
-
#ifdef Avoid_Underflow
|
2098
|
-
if (scale && (y = word0(rv) & Exp_mask) <= 2*P*Exp_msk1)
|
2099
|
-
word0(adj) += (2*P+1)*Exp_msk1 - y;
|
2100
|
-
#else
|
2101
|
-
#ifdef Sudden_Underflow
|
2102
|
-
if ((word0(rv) & Exp_mask) <= P*Exp_msk1) {
|
2103
|
-
word0(rv) += P*Exp_msk1;
|
2104
|
-
adj *= ulp(dval(rv));
|
2105
|
-
if (dsign)
|
2106
|
-
dval(rv) += adj;
|
2107
|
-
else
|
2108
|
-
dval(rv) -= adj;
|
2109
|
-
word0(rv) -= P*Exp_msk1;
|
2110
|
-
goto cont;
|
2111
|
-
}
|
2112
|
-
#endif /*Sudden_Underflow*/
|
2113
|
-
#endif /*Avoid_Underflow*/
|
2114
|
-
adj *= ulp(dval(rv));
|
2115
|
-
if (dsign)
|
2116
|
-
dval(rv) += adj;
|
2117
|
-
else
|
2118
|
-
dval(rv) -= adj;
|
2119
|
-
goto cont;
|
2120
|
-
}
|
2121
|
-
#endif /*Honor_FLT_ROUNDS*/
|
2122
|
-
|
2123
|
-
if (i < 0) {
|
2124
|
-
/* Error is less than half an ulp -- check for
|
2125
|
-
* special case of mantissa a power of two.
|
2126
|
-
*/
|
2127
|
-
if (dsign || word1(rv) || word0(rv) & Bndry_mask
|
2128
|
-
#ifdef IEEE_Arith
|
2129
|
-
#ifdef Avoid_Underflow
|
2130
|
-
|| (word0(rv) & Exp_mask) <= (2*P+1)*Exp_msk1
|
2131
|
-
#else
|
2132
|
-
|| (word0(rv) & Exp_mask) <= Exp_msk1
|
2133
|
-
#endif
|
2134
|
-
#endif
|
2135
|
-
) {
|
2136
|
-
#ifdef SET_INEXACT
|
2137
|
-
if (!delta->x[0] && delta->wds <= 1)
|
2138
|
-
inexact = 0;
|
2139
|
-
#endif
|
2140
|
-
break;
|
2141
|
-
}
|
2142
|
-
if (!delta->x[0] && delta->wds <= 1) {
|
2143
|
-
/* exact result */
|
2144
|
-
#ifdef SET_INEXACT
|
2145
|
-
inexact = 0;
|
2146
|
-
#endif
|
2147
|
-
break;
|
2148
|
-
}
|
2149
|
-
delta = lshift(delta,Log2P);
|
2150
|
-
if (cmp(delta, bs) > 0)
|
2151
|
-
goto drop_down;
|
2152
|
-
break;
|
2153
|
-
}
|
2154
|
-
if (i == 0) {
|
2155
|
-
/* exactly half-way between */
|
2156
|
-
if (dsign) {
|
2157
|
-
if ((word0(rv) & Bndry_mask1) == Bndry_mask1
|
2158
|
-
&& word1(rv) == (
|
2159
|
-
#ifdef Avoid_Underflow
|
2160
|
-
(scale && (y = word0(rv) & Exp_mask) <= 2*P*Exp_msk1)
|
2161
|
-
? (0xffffffff & (0xffffffff << (2*P+1-(y>>Exp_shift)))) :
|
2162
|
-
#endif
|
2163
|
-
0xffffffff)) {
|
2164
|
-
/*boundary case -- increment exponent*/
|
2165
|
-
word0(rv) = (word0(rv) & Exp_mask)
|
2166
|
-
+ Exp_msk1
|
2167
|
-
#ifdef IBM
|
2168
|
-
| Exp_msk1 >> 4
|
2169
|
-
#endif
|
2170
|
-
;
|
2171
|
-
word1(rv) = 0;
|
2172
|
-
#ifdef Avoid_Underflow
|
2173
|
-
dsign = 0;
|
2174
|
-
#endif
|
2175
|
-
break;
|
2176
|
-
}
|
2177
|
-
}
|
2178
|
-
else if (!(word0(rv) & Bndry_mask) && !word1(rv)) {
|
2179
|
-
drop_down:
|
2180
|
-
/* boundary case -- decrement exponent */
|
2181
|
-
#ifdef Sudden_Underflow /*{{*/
|
2182
|
-
L = word0(rv) & Exp_mask;
|
2183
|
-
#ifdef IBM
|
2184
|
-
if (L < Exp_msk1)
|
2185
|
-
#else
|
2186
|
-
#ifdef Avoid_Underflow
|
2187
|
-
if (L <= (scale ? (2*P+1)*Exp_msk1 : Exp_msk1))
|
2188
|
-
#else
|
2189
|
-
if (L <= Exp_msk1)
|
2190
|
-
#endif /*Avoid_Underflow*/
|
2191
|
-
#endif /*IBM*/
|
2192
|
-
goto undfl;
|
2193
|
-
L -= Exp_msk1;
|
2194
|
-
#else /*Sudden_Underflow}{*/
|
2195
|
-
#ifdef Avoid_Underflow
|
2196
|
-
if (scale) {
|
2197
|
-
L = word0(rv) & Exp_mask;
|
2198
|
-
if (L <= (2*P+1)*Exp_msk1) {
|
2199
|
-
if (L > (P+2)*Exp_msk1)
|
2200
|
-
/* round even ==> */
|
2201
|
-
/* accept rv */
|
2202
|
-
break;
|
2203
|
-
/* rv = smallest denormal */
|
2204
|
-
goto undfl;
|
2205
|
-
}
|
2206
|
-
}
|
2207
|
-
#endif /*Avoid_Underflow*/
|
2208
|
-
L = (word0(rv) & Exp_mask) - Exp_msk1;
|
2209
|
-
#endif /*Sudden_Underflow}}*/
|
2210
|
-
word0(rv) = L | Bndry_mask1;
|
2211
|
-
word1(rv) = 0xffffffff;
|
2212
|
-
#ifdef IBM
|
2213
|
-
goto cont;
|
2214
|
-
#else
|
2215
|
-
break;
|
2216
|
-
#endif
|
2217
|
-
}
|
2218
|
-
#ifndef ROUND_BIASED
|
2219
|
-
if (!(word1(rv) & LSB))
|
2220
|
-
break;
|
2221
|
-
#endif
|
2222
|
-
if (dsign)
|
2223
|
-
dval(rv) += ulp(dval(rv));
|
2224
|
-
#ifndef ROUND_BIASED
|
2225
|
-
else {
|
2226
|
-
dval(rv) -= ulp(dval(rv));
|
2227
|
-
#ifndef Sudden_Underflow
|
2228
|
-
if (!dval(rv))
|
2229
|
-
goto undfl;
|
2230
|
-
#endif
|
2231
|
-
}
|
2232
|
-
#ifdef Avoid_Underflow
|
2233
|
-
dsign = 1 - dsign;
|
2234
|
-
#endif
|
2235
|
-
#endif
|
2236
|
-
break;
|
2237
|
-
}
|
2238
|
-
if ((aadj = ratio(delta, bs)) <= 2.) {
|
2239
|
-
if (dsign)
|
2240
|
-
aadj = aadj1 = 1.;
|
2241
|
-
else if (word1(rv) || word0(rv) & Bndry_mask) {
|
2242
|
-
#ifndef Sudden_Underflow
|
2243
|
-
if (word1(rv) == Tiny1 && !word0(rv))
|
2244
|
-
goto undfl;
|
2245
|
-
#endif
|
2246
|
-
aadj = 1.;
|
2247
|
-
aadj1 = -1.;
|
2248
|
-
}
|
2249
|
-
else {
|
2250
|
-
/* special case -- power of FLT_RADIX to be */
|
2251
|
-
/* rounded down... */
|
2252
|
-
|
2253
|
-
if (aadj < 2./FLT_RADIX)
|
2254
|
-
aadj = 1./FLT_RADIX;
|
2255
|
-
else
|
2256
|
-
aadj *= 0.5;
|
2257
|
-
aadj1 = -aadj;
|
2258
|
-
}
|
2259
|
-
}
|
2260
|
-
else {
|
2261
|
-
aadj *= 0.5;
|
2262
|
-
aadj1 = dsign ? aadj : -aadj;
|
2263
|
-
#ifdef Check_FLT_ROUNDS
|
2264
|
-
switch(Rounding) {
|
2265
|
-
case 2: /* towards +infinity */
|
2266
|
-
aadj1 -= 0.5;
|
2267
|
-
break;
|
2268
|
-
case 0: /* towards 0 */
|
2269
|
-
case 3: /* towards -infinity */
|
2270
|
-
aadj1 += 0.5;
|
2271
|
-
}
|
2272
|
-
#else
|
2273
|
-
if (Flt_Rounds == 0)
|
2274
|
-
aadj1 += 0.5;
|
2275
|
-
#endif /*Check_FLT_ROUNDS*/
|
2276
|
-
}
|
2277
|
-
y = word0(rv) & Exp_mask;
|
2278
|
-
|
2279
|
-
/* Check for overflow */
|
2280
|
-
|
2281
|
-
if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) {
|
2282
|
-
dval(rv0) = dval(rv);
|
2283
|
-
word0(rv) -= P*Exp_msk1;
|
2284
|
-
adj = aadj1 * ulp(dval(rv));
|
2285
|
-
dval(rv) += adj;
|
2286
|
-
if ((word0(rv) & Exp_mask) >=
|
2287
|
-
Exp_msk1*(DBL_MAX_EXP+Bias-P)) {
|
2288
|
-
if (word0(rv0) == Big0 && word1(rv0) == Big1)
|
2289
|
-
goto ovfl;
|
2290
|
-
word0(rv) = Big0;
|
2291
|
-
word1(rv) = Big1;
|
2292
|
-
goto cont;
|
2293
|
-
}
|
2294
|
-
else
|
2295
|
-
word0(rv) += P*Exp_msk1;
|
2296
|
-
}
|
2297
|
-
else {
|
2298
|
-
#ifdef Avoid_Underflow
|
2299
|
-
if (scale && y <= 2*P*Exp_msk1) {
|
2300
|
-
if (aadj <= 0x7fffffff) {
|
2301
|
-
if ((z = aadj) <= 0)
|
2302
|
-
z = 1;
|
2303
|
-
aadj = z;
|
2304
|
-
aadj1 = dsign ? aadj : -aadj;
|
2305
|
-
}
|
2306
|
-
word0(aadj1) += (2*P+1)*Exp_msk1 - y;
|
2307
|
-
}
|
2308
|
-
adj = aadj1 * ulp(dval(rv));
|
2309
|
-
dval(rv) += adj;
|
2310
|
-
#else
|
2311
|
-
#ifdef Sudden_Underflow
|
2312
|
-
if ((word0(rv) & Exp_mask) <= P*Exp_msk1) {
|
2313
|
-
dval(rv0) = dval(rv);
|
2314
|
-
word0(rv) += P*Exp_msk1;
|
2315
|
-
adj = aadj1 * ulp(dval(rv));
|
2316
|
-
dval(rv) += adj;
|
2317
|
-
#ifdef IBM
|
2318
|
-
if ((word0(rv) & Exp_mask) < P*Exp_msk1)
|
2319
|
-
#else
|
2320
|
-
if ((word0(rv) & Exp_mask) <= P*Exp_msk1)
|
2321
|
-
#endif
|
2322
|
-
{
|
2323
|
-
if (word0(rv0) == Tiny0
|
2324
|
-
&& word1(rv0) == Tiny1)
|
2325
|
-
goto undfl;
|
2326
|
-
word0(rv) = Tiny0;
|
2327
|
-
word1(rv) = Tiny1;
|
2328
|
-
goto cont;
|
2329
|
-
}
|
2330
|
-
else
|
2331
|
-
word0(rv) -= P*Exp_msk1;
|
2332
|
-
}
|
2333
|
-
else {
|
2334
|
-
adj = aadj1 * ulp(dval(rv));
|
2335
|
-
dval(rv) += adj;
|
2336
|
-
}
|
2337
|
-
#else /*Sudden_Underflow*/
|
2338
|
-
/* Compute adj so that the IEEE rounding rules will
|
2339
|
-
* correctly round rv + adj in some half-way cases.
|
2340
|
-
* If rv * ulp(rv) is denormalized (i.e.,
|
2341
|
-
* y <= (P-1)*Exp_msk1), we must adjust aadj to avoid
|
2342
|
-
* trouble from bits lost to denormalization;
|
2343
|
-
* example: 1.2e-307 .
|
2344
|
-
*/
|
2345
|
-
if (y <= (P-1)*Exp_msk1 && aadj > 1.) {
|
2346
|
-
aadj1 = (double)(int)(aadj + 0.5);
|
2347
|
-
if (!dsign)
|
2348
|
-
aadj1 = -aadj1;
|
2349
|
-
}
|
2350
|
-
adj = aadj1 * ulp(dval(rv));
|
2351
|
-
dval(rv) += adj;
|
2352
|
-
#endif /*Sudden_Underflow*/
|
2353
|
-
#endif /*Avoid_Underflow*/
|
2354
|
-
}
|
2355
|
-
z = word0(rv) & Exp_mask;
|
2356
|
-
#ifndef SET_INEXACT
|
2357
|
-
#ifdef Avoid_Underflow
|
2358
|
-
if (!scale)
|
2359
|
-
#endif
|
2360
|
-
if (y == z) {
|
2361
|
-
/* Can we stop now? */
|
2362
|
-
L = (Long)aadj;
|
2363
|
-
aadj -= L;
|
2364
|
-
/* The tolerances below are conservative. */
|
2365
|
-
if (dsign || word1(rv) || word0(rv) & Bndry_mask) {
|
2366
|
-
if (aadj < .4999999 || aadj > .5000001)
|
2367
|
-
break;
|
2368
|
-
}
|
2369
|
-
else if (aadj < .4999999/FLT_RADIX)
|
2370
|
-
break;
|
2371
|
-
}
|
2372
|
-
#endif
|
2373
|
-
cont:
|
2374
|
-
Bfree(bb);
|
2375
|
-
Bfree(bd);
|
2376
|
-
Bfree(bs);
|
2377
|
-
Bfree(delta);
|
2378
|
-
}
|
2379
|
-
#ifdef SET_INEXACT
|
2380
|
-
if (inexact) {
|
2381
|
-
if (!oldinexact) {
|
2382
|
-
word0(rv0) = Exp_1 + (70 << Exp_shift);
|
2383
|
-
word1(rv0) = 0;
|
2384
|
-
dval(rv0) += 1.;
|
2385
|
-
}
|
2386
|
-
}
|
2387
|
-
else if (!oldinexact)
|
2388
|
-
clear_inexact();
|
2389
|
-
#endif
|
2390
|
-
#ifdef Avoid_Underflow
|
2391
|
-
if (scale) {
|
2392
|
-
word0(rv0) = Exp_1 - 2*P*Exp_msk1;
|
2393
|
-
word1(rv0) = 0;
|
2394
|
-
dval(rv) *= dval(rv0);
|
2395
|
-
#ifndef NO_ERRNO
|
2396
|
-
/* try to avoid the bug of testing an 8087 register value */
|
2397
|
-
if (word0(rv) == 0 && word1(rv) == 0)
|
2398
|
-
errno = ERANGE;
|
2399
|
-
#endif
|
2400
|
-
}
|
2401
|
-
#endif /* Avoid_Underflow */
|
2402
|
-
#ifdef SET_INEXACT
|
2403
|
-
if (inexact && !(word0(rv) & Exp_mask)) {
|
2404
|
-
/* set underflow bit */
|
2405
|
-
dval(rv0) = 1e-300;
|
2406
|
-
dval(rv0) *= dval(rv0);
|
2407
|
-
}
|
2408
|
-
#endif
|
2409
|
-
retfree:
|
2410
|
-
Bfree(bb);
|
2411
|
-
Bfree(bd);
|
2412
|
-
Bfree(bs);
|
2413
|
-
Bfree(bd0);
|
2414
|
-
Bfree(delta);
|
2415
|
-
ret:
|
2416
|
-
if (se)
|
2417
|
-
*se = (char *)s;
|
2418
|
-
return sign ? -dval(rv) : dval(rv);
|
2419
|
-
}
|
2420
|
-
|
2421
|
-
static int
|
2422
|
-
quorem
|
2423
|
-
#ifdef KR_headers
|
2424
|
-
(b, S) Bigint *b, *S;
|
2425
|
-
#else
|
2426
|
-
(Bigint *b, Bigint *S)
|
2427
|
-
#endif
|
2428
|
-
{
|
2429
|
-
int n;
|
2430
|
-
ULong *bx, *bxe, q, *sx, *sxe;
|
2431
|
-
#ifdef ULLong
|
2432
|
-
ULLong borrow, carry, y, ys;
|
2433
|
-
#else
|
2434
|
-
ULong borrow, carry, y, ys;
|
2435
|
-
#ifdef Pack_32
|
2436
|
-
ULong si, z, zs;
|
2437
|
-
#endif
|
2438
|
-
#endif
|
2439
|
-
|
2440
|
-
n = S->wds;
|
2441
|
-
#ifdef DEBUG
|
2442
|
-
/*debug*/ if (b->wds > n)
|
2443
|
-
/*debug*/ Bug("oversize b in quorem");
|
2444
|
-
#endif
|
2445
|
-
if (b->wds < n)
|
2446
|
-
return 0;
|
2447
|
-
sx = S->x;
|
2448
|
-
sxe = sx + --n;
|
2449
|
-
bx = b->x;
|
2450
|
-
bxe = bx + n;
|
2451
|
-
q = *bxe / (*sxe + 1); /* ensure q <= true quotient */
|
2452
|
-
#ifdef DEBUG
|
2453
|
-
/*debug*/ if (q > 9)
|
2454
|
-
/*debug*/ Bug("oversized quotient in quorem");
|
2455
|
-
#endif
|
2456
|
-
if (q) {
|
2457
|
-
borrow = 0;
|
2458
|
-
carry = 0;
|
2459
|
-
do {
|
2460
|
-
#ifdef ULLong
|
2461
|
-
ys = *sx++ * (ULLong)q + carry;
|
2462
|
-
carry = ys >> 32;
|
2463
|
-
y = *bx - (ys & FFFFFFFF) - borrow;
|
2464
|
-
borrow = y >> 32 & (ULong)1;
|
2465
|
-
*bx++ = y & FFFFFFFF;
|
2466
|
-
#else
|
2467
|
-
#ifdef Pack_32
|
2468
|
-
si = *sx++;
|
2469
|
-
ys = (si & 0xffff) * q + carry;
|
2470
|
-
zs = (si >> 16) * q + (ys >> 16);
|
2471
|
-
carry = zs >> 16;
|
2472
|
-
y = (*bx & 0xffff) - (ys & 0xffff) - borrow;
|
2473
|
-
borrow = (y & 0x10000) >> 16;
|
2474
|
-
z = (*bx >> 16) - (zs & 0xffff) - borrow;
|
2475
|
-
borrow = (z & 0x10000) >> 16;
|
2476
|
-
Storeinc(bx, z, y);
|
2477
|
-
#else
|
2478
|
-
ys = *sx++ * q + carry;
|
2479
|
-
carry = ys >> 16;
|
2480
|
-
y = *bx - (ys & 0xffff) - borrow;
|
2481
|
-
borrow = (y & 0x10000) >> 16;
|
2482
|
-
*bx++ = y & 0xffff;
|
2483
|
-
#endif
|
2484
|
-
#endif
|
2485
|
-
}
|
2486
|
-
while(sx <= sxe);
|
2487
|
-
if (!*bxe) {
|
2488
|
-
bx = b->x;
|
2489
|
-
while(--bxe > bx && !*bxe)
|
2490
|
-
--n;
|
2491
|
-
b->wds = n;
|
2492
|
-
}
|
2493
|
-
}
|
2494
|
-
if (cmp(b, S) >= 0) {
|
2495
|
-
q++;
|
2496
|
-
borrow = 0;
|
2497
|
-
carry = 0;
|
2498
|
-
bx = b->x;
|
2499
|
-
sx = S->x;
|
2500
|
-
do {
|
2501
|
-
#ifdef ULLong
|
2502
|
-
ys = *sx++ + carry;
|
2503
|
-
carry = ys >> 32;
|
2504
|
-
y = *bx - (ys & FFFFFFFF) - borrow;
|
2505
|
-
borrow = y >> 32 & (ULong)1;
|
2506
|
-
*bx++ = y & FFFFFFFF;
|
2507
|
-
#else
|
2508
|
-
#ifdef Pack_32
|
2509
|
-
si = *sx++;
|
2510
|
-
ys = (si & 0xffff) + carry;
|
2511
|
-
zs = (si >> 16) + (ys >> 16);
|
2512
|
-
carry = zs >> 16;
|
2513
|
-
y = (*bx & 0xffff) - (ys & 0xffff) - borrow;
|
2514
|
-
borrow = (y & 0x10000) >> 16;
|
2515
|
-
z = (*bx >> 16) - (zs & 0xffff) - borrow;
|
2516
|
-
borrow = (z & 0x10000) >> 16;
|
2517
|
-
Storeinc(bx, z, y);
|
2518
|
-
#else
|
2519
|
-
ys = *sx++ + carry;
|
2520
|
-
carry = ys >> 16;
|
2521
|
-
y = *bx - (ys & 0xffff) - borrow;
|
2522
|
-
borrow = (y & 0x10000) >> 16;
|
2523
|
-
*bx++ = y & 0xffff;
|
2524
|
-
#endif
|
2525
|
-
#endif
|
2526
|
-
}
|
2527
|
-
while(sx <= sxe);
|
2528
|
-
bx = b->x;
|
2529
|
-
bxe = bx + n;
|
2530
|
-
if (!*bxe) {
|
2531
|
-
while(--bxe > bx && !*bxe)
|
2532
|
-
--n;
|
2533
|
-
b->wds = n;
|
2534
|
-
}
|
2535
|
-
}
|
2536
|
-
return q;
|
2537
|
-
}
|
2538
|
-
|
2539
|
-
#ifndef MULTIPLE_THREADS
|
2540
|
-
static char *dtoa_result;
|
2541
|
-
#endif
|
2542
|
-
|
2543
|
-
static char *
|
2544
|
-
#ifdef KR_headers
|
2545
|
-
rv_alloc(i) int i;
|
2546
|
-
#else
|
2547
|
-
rv_alloc(int i)
|
2548
|
-
#endif
|
2549
|
-
{
|
2550
|
-
int j, k, *r;
|
2551
|
-
|
2552
|
-
j = sizeof(ULong);
|
2553
|
-
for(k = 0;
|
2554
|
-
sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i;
|
2555
|
-
j <<= 1)
|
2556
|
-
k++;
|
2557
|
-
r = (int*)Balloc(k);
|
2558
|
-
*r = k;
|
2559
|
-
return
|
2560
|
-
#ifndef MULTIPLE_THREADS
|
2561
|
-
dtoa_result =
|
2562
|
-
#endif
|
2563
|
-
(char *)(r+1);
|
2564
|
-
}
|
2565
|
-
|
2566
|
-
static char *
|
2567
|
-
#ifdef KR_headers
|
2568
|
-
nrv_alloc(s, rve, n) char *s, **rve; int n;
|
2569
|
-
#else
|
2570
|
-
nrv_alloc(const char *s, char **rve, int n)
|
2571
|
-
#endif
|
2572
|
-
{
|
2573
|
-
char *rv, *t;
|
2574
|
-
|
2575
|
-
t = rv = rv_alloc(n);
|
2576
|
-
while ((*t = *s++)) t++;
|
2577
|
-
if (rve)
|
2578
|
-
*rve = t;
|
2579
|
-
return rv;
|
2580
|
-
}
|
2581
|
-
|
2582
|
-
/* freedtoa(s) must be used to free values s returned by dtoa
|
2583
|
-
* when MULTIPLE_THREADS is #defined. It should be used in all cases,
|
2584
|
-
* but for consistency with earlier versions of dtoa, it is optional
|
2585
|
-
* when MULTIPLE_THREADS is not defined.
|
2586
|
-
*/
|
2587
|
-
|
2588
|
-
void
|
2589
|
-
#ifdef KR_headers
|
2590
|
-
freedtoa(s) char *s;
|
2591
|
-
#else
|
2592
|
-
freedtoa(char *s)
|
2593
|
-
#endif
|
2594
|
-
{
|
2595
|
-
Bigint *b = (Bigint *)((int *)s - 1);
|
2596
|
-
b->maxwds = 1 << (b->k = *(int*)b);
|
2597
|
-
Bfree(b);
|
2598
|
-
#ifndef MULTIPLE_THREADS
|
2599
|
-
if (s == dtoa_result)
|
2600
|
-
dtoa_result = 0;
|
2601
|
-
#endif
|
2602
|
-
}
|
2603
|
-
|
2604
|
-
/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string.
|
2605
|
-
*
|
2606
|
-
* Inspired by "How to Print Floating-Point Numbers Accurately" by
|
2607
|
-
* Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126].
|
2608
|
-
*
|
2609
|
-
* Modifications:
|
2610
|
-
* 1. Rather than iterating, we use a simple numeric overestimate
|
2611
|
-
* to determine k = floor(log10(d)). We scale relevant
|
2612
|
-
* quantities using O(log2(k)) rather than O(k) multiplications.
|
2613
|
-
* 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't
|
2614
|
-
* try to generate digits strictly left to right. Instead, we
|
2615
|
-
* compute with fewer bits and propagate the carry if necessary
|
2616
|
-
* when rounding the final digit up. This is often faster.
|
2617
|
-
* 3. Under the assumption that input will be rounded nearest,
|
2618
|
-
* mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22.
|
2619
|
-
* That is, we allow equality in stopping tests when the
|
2620
|
-
* round-nearest rule will give the same floating-point value
|
2621
|
-
* as would satisfaction of the stopping test with strict
|
2622
|
-
* inequality.
|
2623
|
-
* 4. We remove common factors of powers of 2 from relevant
|
2624
|
-
* quantities.
|
2625
|
-
* 5. When converting floating-point integers less than 1e16,
|
2626
|
-
* we use floating-point arithmetic rather than resorting
|
2627
|
-
* to multiple-precision integers.
|
2628
|
-
* 6. When asked to produce fewer than 15 digits, we first try
|
2629
|
-
* to get by with floating-point arithmetic; we resort to
|
2630
|
-
* multiple-precision integer arithmetic only if we cannot
|
2631
|
-
* guarantee that the floating-point calculation has given
|
2632
|
-
* the correctly rounded result. For k requested digits and
|
2633
|
-
* "uniformly" distributed input, the probability is
|
2634
|
-
* something like 10^(k-15) that we must resort to the Long
|
2635
|
-
* calculation.
|
2636
|
-
*/
|
2637
|
-
|
2638
|
-
char *
|
2639
|
-
dtoa
|
2640
|
-
#ifdef KR_headers
|
2641
|
-
(d, mode, ndigits, decpt, sign, rve)
|
2642
|
-
double d; int mode, ndigits, *decpt, *sign; char **rve;
|
2643
|
-
#else
|
2644
|
-
(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
|
2645
|
-
#endif
|
2646
|
-
{
|
2647
|
-
/* Arguments ndigits, decpt, sign are similar to those
|
2648
|
-
of ecvt and fcvt; trailing zeros are suppressed from
|
2649
|
-
the returned string. If not null, *rve is set to point
|
2650
|
-
to the end of the return value. If d is +-Infinity or NaN,
|
2651
|
-
then *decpt is set to 9999.
|
2652
|
-
|
2653
|
-
mode:
|
2654
|
-
0 ==> shortest string that yields d when read in
|
2655
|
-
and rounded to nearest.
|
2656
|
-
1 ==> like 0, but with Steele & White stopping rule;
|
2657
|
-
e.g. with IEEE P754 arithmetic , mode 0 gives
|
2658
|
-
1e23 whereas mode 1 gives 9.999999999999999e22.
|
2659
|
-
2 ==> max(1,ndigits) significant digits. This gives a
|
2660
|
-
return value similar to that of ecvt, except
|
2661
|
-
that trailing zeros are suppressed.
|
2662
|
-
3 ==> through ndigits past the decimal point. This
|
2663
|
-
gives a return value similar to that from fcvt,
|
2664
|
-
except that trailing zeros are suppressed, and
|
2665
|
-
ndigits can be negative.
|
2666
|
-
4,5 ==> similar to 2 and 3, respectively, but (in
|
2667
|
-
round-nearest mode) with the tests of mode 0 to
|
2668
|
-
possibly return a shorter string that rounds to d.
|
2669
|
-
With IEEE arithmetic and compilation with
|
2670
|
-
-DHonor_FLT_ROUNDS, modes 4 and 5 behave the same
|
2671
|
-
as modes 2 and 3 when FLT_ROUNDS != 1.
|
2672
|
-
6-9 ==> Debugging modes similar to mode - 4: don't try
|
2673
|
-
fast floating-point estimate (if applicable).
|
2674
|
-
|
2675
|
-
Values of mode other than 0-9 are treated as mode 0.
|
2676
|
-
|
2677
|
-
Sufficient space is allocated to the return value
|
2678
|
-
to hold the suppressed trailing zeros.
|
2679
|
-
*/
|
2680
|
-
|
2681
|
-
int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1,
|
2682
|
-
j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
|
2683
|
-
spec_case, try_quick, bias_round_up;
|
2684
|
-
Long L;
|
2685
|
-
#ifndef Sudden_Underflow
|
2686
|
-
int denorm;
|
2687
|
-
ULong x;
|
2688
|
-
#endif
|
2689
|
-
Bigint *b, *b1, *delta, *mlo, *mhi, *S;
|
2690
|
-
double d2, ds, eps;
|
2691
|
-
char *s, *s0;
|
2692
|
-
#ifdef Honor_FLT_ROUNDS
|
2693
|
-
int rounding;
|
2694
|
-
#endif
|
2695
|
-
#ifdef SET_INEXACT
|
2696
|
-
int inexact, oldinexact;
|
2697
|
-
#endif
|
2698
|
-
|
2699
|
-
/* In mode 2 and 3 we bias rounding up when there are ties. */
|
2700
|
-
bias_round_up = mode == 2 || mode == 3;
|
2701
|
-
|
2702
|
-
ilim = ilim1 = 0; /* to avoid Google3 compiler warnings */
|
2703
|
-
|
2704
|
-
#ifndef MULTIPLE_THREADS
|
2705
|
-
if (dtoa_result) {
|
2706
|
-
freedtoa(dtoa_result);
|
2707
|
-
dtoa_result = 0;
|
2708
|
-
}
|
2709
|
-
#endif
|
2710
|
-
|
2711
|
-
if (word0(d) & Sign_bit) {
|
2712
|
-
/* set sign for everything, including 0's and NaNs */
|
2713
|
-
*sign = 1;
|
2714
|
-
word0(d) &= ~Sign_bit; /* clear sign bit */
|
2715
|
-
}
|
2716
|
-
else
|
2717
|
-
*sign = 0;
|
2718
|
-
|
2719
|
-
#if defined(IEEE_Arith) + defined(VAX)
|
2720
|
-
#ifdef IEEE_Arith
|
2721
|
-
if ((word0(d) & Exp_mask) == Exp_mask)
|
2722
|
-
#else
|
2723
|
-
if (word0(d) == 0x8000)
|
2724
|
-
#endif
|
2725
|
-
{
|
2726
|
-
/* Infinity or NaN */
|
2727
|
-
*decpt = 9999;
|
2728
|
-
#ifdef IEEE_Arith
|
2729
|
-
if (!word1(d) && !(word0(d) & 0xfffff))
|
2730
|
-
return nrv_alloc("Infinity", rve, 8);
|
2731
|
-
#endif
|
2732
|
-
return nrv_alloc("NaN", rve, 3);
|
2733
|
-
}
|
2734
|
-
#endif
|
2735
|
-
#ifdef IBM
|
2736
|
-
dval(d) += 0; /* normalize */
|
2737
|
-
#endif
|
2738
|
-
if (!dval(d)) {
|
2739
|
-
*decpt = 1;
|
2740
|
-
return nrv_alloc("0", rve, 1);
|
2741
|
-
}
|
2742
|
-
|
2743
|
-
#ifdef SET_INEXACT
|
2744
|
-
try_quick = oldinexact = get_inexact();
|
2745
|
-
inexact = 1;
|
2746
|
-
#endif
|
2747
|
-
#ifdef Honor_FLT_ROUNDS
|
2748
|
-
if ((rounding = Flt_Rounds) >= 2) {
|
2749
|
-
if (*sign)
|
2750
|
-
rounding = rounding == 2 ? 0 : 2;
|
2751
|
-
else
|
2752
|
-
if (rounding != 2)
|
2753
|
-
rounding = 0;
|
2754
|
-
}
|
2755
|
-
#endif
|
2756
|
-
|
2757
|
-
b = d2b(dval(d), &be, &bbits);
|
2758
|
-
#ifdef Sudden_Underflow
|
2759
|
-
i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
|
2760
|
-
#else
|
2761
|
-
if ((i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
|
2762
|
-
#endif
|
2763
|
-
dval(d2) = dval(d);
|
2764
|
-
word0(d2) &= Frac_mask1;
|
2765
|
-
word0(d2) |= Exp_11;
|
2766
|
-
#ifdef IBM
|
2767
|
-
if (j = 11 - hi0bits(word0(d2) & Frac_mask))
|
2768
|
-
dval(d2) /= 1 << j;
|
2769
|
-
#endif
|
2770
|
-
|
2771
|
-
/* log(x) ~=~ log(1.5) + (x-1.5)/1.5
|
2772
|
-
* log10(x) = log(x) / log(10)
|
2773
|
-
* ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10))
|
2774
|
-
* log10(d) = (i-Bias)*log(2)/log(10) + log10(d2)
|
2775
|
-
*
|
2776
|
-
* This suggests computing an approximation k to log10(d) by
|
2777
|
-
*
|
2778
|
-
* k = (i - Bias)*0.301029995663981
|
2779
|
-
* + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 );
|
2780
|
-
*
|
2781
|
-
* We want k to be too large rather than too small.
|
2782
|
-
* The error in the first-order Taylor series approximation
|
2783
|
-
* is in our favor, so we just round up the constant enough
|
2784
|
-
* to compensate for any error in the multiplication of
|
2785
|
-
* (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077,
|
2786
|
-
* and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14,
|
2787
|
-
* adding 1e-13 to the constant term more than suffices.
|
2788
|
-
* Hence we adjust the constant term to 0.1760912590558.
|
2789
|
-
* (We could get a more accurate k by invoking log10,
|
2790
|
-
* but this is probably not worthwhile.)
|
2791
|
-
*/
|
2792
|
-
|
2793
|
-
i -= Bias;
|
2794
|
-
#ifdef IBM
|
2795
|
-
i <<= 2;
|
2796
|
-
i += j;
|
2797
|
-
#endif
|
2798
|
-
#ifndef Sudden_Underflow
|
2799
|
-
denorm = 0;
|
2800
|
-
}
|
2801
|
-
else {
|
2802
|
-
/* d is denormalized */
|
2803
|
-
|
2804
|
-
i = bbits + be + (Bias + (P-1) - 1);
|
2805
|
-
x = i > 32 ? (word0(d) << (64 - i)) | (word1(d) >> (i - 32))
|
2806
|
-
: word1(d) << (32 - i);
|
2807
|
-
dval(d2) = x;
|
2808
|
-
word0(d2) -= 31*Exp_msk1; /* adjust exponent */
|
2809
|
-
i -= (Bias + (P-1) - 1) + 1;
|
2810
|
-
denorm = 1;
|
2811
|
-
}
|
2812
|
-
#endif
|
2813
|
-
ds = (dval(d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981;
|
2814
|
-
k = (int)ds;
|
2815
|
-
if (ds < 0. && ds != k)
|
2816
|
-
k--; /* want k = floor(ds) */
|
2817
|
-
k_check = 1;
|
2818
|
-
if (k >= 0 && k <= Ten_pmax) {
|
2819
|
-
if (dval(d) < tens[k])
|
2820
|
-
k--;
|
2821
|
-
k_check = 0;
|
2822
|
-
}
|
2823
|
-
j = bbits - i - 1;
|
2824
|
-
if (j >= 0) {
|
2825
|
-
b2 = 0;
|
2826
|
-
s2 = j;
|
2827
|
-
}
|
2828
|
-
else {
|
2829
|
-
b2 = -j;
|
2830
|
-
s2 = 0;
|
2831
|
-
}
|
2832
|
-
if (k >= 0) {
|
2833
|
-
b5 = 0;
|
2834
|
-
s5 = k;
|
2835
|
-
s2 += k;
|
2836
|
-
}
|
2837
|
-
else {
|
2838
|
-
b2 -= k;
|
2839
|
-
b5 = -k;
|
2840
|
-
s5 = 0;
|
2841
|
-
}
|
2842
|
-
if (mode < 0 || mode > 9)
|
2843
|
-
mode = 0;
|
2844
|
-
|
2845
|
-
#ifndef SET_INEXACT
|
2846
|
-
#ifdef Check_FLT_ROUNDS
|
2847
|
-
try_quick = Rounding == 1;
|
2848
|
-
#else
|
2849
|
-
try_quick = 1;
|
2850
|
-
#endif
|
2851
|
-
#endif /*SET_INEXACT*/
|
2852
|
-
|
2853
|
-
if (mode > 5) {
|
2854
|
-
mode -= 4;
|
2855
|
-
try_quick = 0;
|
2856
|
-
}
|
2857
|
-
leftright = 1;
|
2858
|
-
switch(mode) {
|
2859
|
-
case 0:
|
2860
|
-
case 1:
|
2861
|
-
ilim = ilim1 = -1;
|
2862
|
-
i = 18;
|
2863
|
-
ndigits = 0;
|
2864
|
-
break;
|
2865
|
-
case 2:
|
2866
|
-
leftright = 0;
|
2867
|
-
/* no break */
|
2868
|
-
case 4:
|
2869
|
-
if (ndigits <= 0)
|
2870
|
-
ndigits = 1;
|
2871
|
-
ilim = ilim1 = i = ndigits;
|
2872
|
-
break;
|
2873
|
-
case 3:
|
2874
|
-
leftright = 0;
|
2875
|
-
/* no break */
|
2876
|
-
case 5:
|
2877
|
-
i = ndigits + k + 1;
|
2878
|
-
ilim = i;
|
2879
|
-
ilim1 = i - 1;
|
2880
|
-
if (i <= 0)
|
2881
|
-
i = 1;
|
2882
|
-
}
|
2883
|
-
s = s0 = rv_alloc(i);
|
2884
|
-
|
2885
|
-
#ifdef Honor_FLT_ROUNDS
|
2886
|
-
if (mode > 1 && rounding != 1)
|
2887
|
-
leftright = 0;
|
2888
|
-
#endif
|
2889
|
-
|
2890
|
-
if (ilim >= 0 && ilim <= Quick_max && try_quick) {
|
2891
|
-
|
2892
|
-
/* Try to get by with floating-point arithmetic. */
|
2893
|
-
|
2894
|
-
i = 0;
|
2895
|
-
dval(d2) = dval(d);
|
2896
|
-
k0 = k;
|
2897
|
-
ilim0 = ilim;
|
2898
|
-
ieps = 2; /* conservative */
|
2899
|
-
if (k > 0) {
|
2900
|
-
ds = tens[k&0xf];
|
2901
|
-
j = k >> 4;
|
2902
|
-
if (j & Bletch) {
|
2903
|
-
/* prevent overflows */
|
2904
|
-
j &= Bletch - 1;
|
2905
|
-
dval(d) /= bigtens[n_bigtens-1];
|
2906
|
-
ieps++;
|
2907
|
-
}
|
2908
|
-
for(; j; j >>= 1, i++)
|
2909
|
-
if (j & 1) {
|
2910
|
-
ieps++;
|
2911
|
-
ds *= bigtens[i];
|
2912
|
-
}
|
2913
|
-
dval(d) /= ds;
|
2914
|
-
}
|
2915
|
-
else if ((j1 = -k)) {
|
2916
|
-
dval(d) *= tens[j1 & 0xf];
|
2917
|
-
for(j = j1 >> 4; j; j >>= 1, i++)
|
2918
|
-
if (j & 1) {
|
2919
|
-
ieps++;
|
2920
|
-
dval(d) *= bigtens[i];
|
2921
|
-
}
|
2922
|
-
}
|
2923
|
-
if (k_check && dval(d) < 1. && ilim > 0) {
|
2924
|
-
if (ilim1 <= 0)
|
2925
|
-
goto fast_failed;
|
2926
|
-
ilim = ilim1;
|
2927
|
-
k--;
|
2928
|
-
dval(d) *= 10.;
|
2929
|
-
ieps++;
|
2930
|
-
}
|
2931
|
-
dval(eps) = ieps*dval(d) + 7.;
|
2932
|
-
word0(eps) -= (P-1)*Exp_msk1;
|
2933
|
-
if (ilim == 0) {
|
2934
|
-
S = mhi = 0;
|
2935
|
-
dval(d) -= 5.;
|
2936
|
-
if (dval(d) > dval(eps))
|
2937
|
-
goto one_digit;
|
2938
|
-
if (dval(d) < -dval(eps))
|
2939
|
-
goto no_digits;
|
2940
|
-
goto fast_failed;
|
2941
|
-
}
|
2942
|
-
#ifndef No_leftright
|
2943
|
-
if (leftright) {
|
2944
|
-
/* Use Steele & White method of only
|
2945
|
-
* generating digits needed.
|
2946
|
-
*/
|
2947
|
-
dval(eps) = 0.5/tens[ilim-1] - dval(eps);
|
2948
|
-
for(i = 0;;) {
|
2949
|
-
L = dval(d);
|
2950
|
-
dval(d) -= L;
|
2951
|
-
*s++ = '0' + (int)L;
|
2952
|
-
if (dval(d) < dval(eps))
|
2953
|
-
goto ret1;
|
2954
|
-
if (1. - dval(d) < dval(eps))
|
2955
|
-
goto bump_up;
|
2956
|
-
if (++i >= ilim)
|
2957
|
-
break;
|
2958
|
-
dval(eps) *= 10.;
|
2959
|
-
dval(d) *= 10.;
|
2960
|
-
}
|
2961
|
-
}
|
2962
|
-
else {
|
2963
|
-
#endif
|
2964
|
-
/* Generate ilim digits, then fix them up. */
|
2965
|
-
dval(eps) *= tens[ilim-1];
|
2966
|
-
for(i = 1;; i++, dval(d) *= 10.) {
|
2967
|
-
L = (Long)(dval(d));
|
2968
|
-
if (!(dval(d) -= L))
|
2969
|
-
ilim = i;
|
2970
|
-
*s++ = '0' + (int)L;
|
2971
|
-
if (i == ilim) {
|
2972
|
-
if (dval(d) > 0.5 + dval(eps))
|
2973
|
-
goto bump_up;
|
2974
|
-
else if (dval(d) < 0.5 - dval(eps)) {
|
2975
|
-
while(*--s == '0');
|
2976
|
-
s++;
|
2977
|
-
goto ret1;
|
2978
|
-
}
|
2979
|
-
break;
|
2980
|
-
}
|
2981
|
-
}
|
2982
|
-
#ifndef No_leftright
|
2983
|
-
}
|
2984
|
-
#endif
|
2985
|
-
fast_failed:
|
2986
|
-
s = s0;
|
2987
|
-
dval(d) = dval(d2);
|
2988
|
-
k = k0;
|
2989
|
-
ilim = ilim0;
|
2990
|
-
}
|
2991
|
-
|
2992
|
-
/* Do we have a "small" integer? */
|
2993
|
-
|
2994
|
-
if (be >= 0 && k <= Int_max) {
|
2995
|
-
/* Yes. */
|
2996
|
-
ds = tens[k];
|
2997
|
-
if (ndigits < 0 && ilim <= 0) {
|
2998
|
-
S = mhi = 0;
|
2999
|
-
if (ilim < 0 || dval(d) < 5*ds || ((dval(d) == 5*ds) && !bias_round_up))
|
3000
|
-
goto no_digits;
|
3001
|
-
goto one_digit;
|
3002
|
-
}
|
3003
|
-
|
3004
|
-
/* Limit looping by the number of digits to produce.
|
3005
|
-
* Firefox had a crash bug because some plugins reduce
|
3006
|
-
* the precision of double arithmetic. With reduced
|
3007
|
-
* precision "dval(d) -= L*ds" might be imprecise and
|
3008
|
-
* d might not become zero and the loop might not
|
3009
|
-
* terminate.
|
3010
|
-
*
|
3011
|
-
* See https://bugzilla.mozilla.org/show_bug.cgi?id=358569
|
3012
|
-
*/
|
3013
|
-
for(i = 1; i <= k+1; i++, dval(d) *= 10.) {
|
3014
|
-
L = (Long)(dval(d) / ds);
|
3015
|
-
dval(d) -= L*ds;
|
3016
|
-
#ifdef Check_FLT_ROUNDS
|
3017
|
-
/* If FLT_ROUNDS == 2, L will usually be high by 1 */
|
3018
|
-
if (dval(d) < 0) {
|
3019
|
-
L--;
|
3020
|
-
dval(d) += ds;
|
3021
|
-
}
|
3022
|
-
#endif
|
3023
|
-
*s++ = '0' + (int)L;
|
3024
|
-
if (!dval(d)) {
|
3025
|
-
#ifdef SET_INEXACT
|
3026
|
-
inexact = 0;
|
3027
|
-
#endif
|
3028
|
-
break;
|
3029
|
-
}
|
3030
|
-
if (i == ilim) {
|
3031
|
-
#ifdef Honor_FLT_ROUNDS
|
3032
|
-
if (mode > 1)
|
3033
|
-
switch(rounding) {
|
3034
|
-
case 0: goto ret1;
|
3035
|
-
case 2: goto bump_up;
|
3036
|
-
}
|
3037
|
-
#endif
|
3038
|
-
dval(d) += dval(d);
|
3039
|
-
if (dval(d) > ds || (dval(d) == ds && ((L & 1) || bias_round_up))) {
|
3040
|
-
bump_up:
|
3041
|
-
while(*--s == '9')
|
3042
|
-
if (s == s0) {
|
3043
|
-
k++;
|
3044
|
-
*s = '0';
|
3045
|
-
break;
|
3046
|
-
}
|
3047
|
-
++*s++;
|
3048
|
-
}
|
3049
|
-
break;
|
3050
|
-
}
|
3051
|
-
}
|
3052
|
-
goto ret1;
|
3053
|
-
}
|
3054
|
-
|
3055
|
-
m2 = b2;
|
3056
|
-
m5 = b5;
|
3057
|
-
mhi = mlo = 0;
|
3058
|
-
if (leftright) {
|
3059
|
-
i =
|
3060
|
-
#ifndef Sudden_Underflow
|
3061
|
-
denorm ? be + (Bias + (P-1) - 1 + 1) :
|
3062
|
-
#endif
|
3063
|
-
#ifdef IBM
|
3064
|
-
1 + 4*P - 3 - bbits + ((bbits + be - 1) & 3);
|
3065
|
-
#else
|
3066
|
-
1 + P - bbits;
|
3067
|
-
#endif
|
3068
|
-
b2 += i;
|
3069
|
-
s2 += i;
|
3070
|
-
mhi = i2b(1);
|
3071
|
-
}
|
3072
|
-
if (m2 > 0 && s2 > 0) {
|
3073
|
-
i = m2 < s2 ? m2 : s2;
|
3074
|
-
b2 -= i;
|
3075
|
-
m2 -= i;
|
3076
|
-
s2 -= i;
|
3077
|
-
}
|
3078
|
-
if (b5 > 0) {
|
3079
|
-
if (leftright) {
|
3080
|
-
if (m5 > 0) {
|
3081
|
-
mhi = pow5mult(mhi, m5);
|
3082
|
-
b1 = mult(mhi, b);
|
3083
|
-
Bfree(b);
|
3084
|
-
b = b1;
|
3085
|
-
}
|
3086
|
-
if ((j = b5 - m5))
|
3087
|
-
b = pow5mult(b, j);
|
3088
|
-
}
|
3089
|
-
else
|
3090
|
-
b = pow5mult(b, b5);
|
3091
|
-
}
|
3092
|
-
S = i2b(1);
|
3093
|
-
if (s5 > 0)
|
3094
|
-
S = pow5mult(S, s5);
|
3095
|
-
|
3096
|
-
/* Check for special case that d is a normalized power of 2. */
|
3097
|
-
|
3098
|
-
spec_case = 0;
|
3099
|
-
if ((mode < 2 || leftright)
|
3100
|
-
#ifdef Honor_FLT_ROUNDS
|
3101
|
-
&& rounding == 1
|
3102
|
-
#endif
|
3103
|
-
) {
|
3104
|
-
if (!word1(d) && !(word0(d) & Bndry_mask)
|
3105
|
-
#ifndef Sudden_Underflow
|
3106
|
-
&& word0(d) & (Exp_mask & ~Exp_msk1)
|
3107
|
-
#endif
|
3108
|
-
) {
|
3109
|
-
/* The special case */
|
3110
|
-
b2 += Log2P;
|
3111
|
-
s2 += Log2P;
|
3112
|
-
spec_case = 1;
|
3113
|
-
}
|
3114
|
-
}
|
3115
|
-
|
3116
|
-
/* Arrange for convenient computation of quotients:
|
3117
|
-
* shift left if necessary so divisor has 4 leading 0 bits.
|
3118
|
-
*
|
3119
|
-
* Perhaps we should just compute leading 28 bits of S once
|
3120
|
-
* and for all and pass them and a shift to quorem, so it
|
3121
|
-
* can do shifts and ors to compute the numerator for q.
|
3122
|
-
*/
|
3123
|
-
#ifdef Pack_32
|
3124
|
-
if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f))
|
3125
|
-
i = 32 - i;
|
3126
|
-
#else
|
3127
|
-
if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf))
|
3128
|
-
i = 16 - i;
|
3129
|
-
#endif
|
3130
|
-
if (i > 4) {
|
3131
|
-
i -= 4;
|
3132
|
-
b2 += i;
|
3133
|
-
m2 += i;
|
3134
|
-
s2 += i;
|
3135
|
-
}
|
3136
|
-
else if (i < 4) {
|
3137
|
-
i += 28;
|
3138
|
-
b2 += i;
|
3139
|
-
m2 += i;
|
3140
|
-
s2 += i;
|
3141
|
-
}
|
3142
|
-
if (b2 > 0)
|
3143
|
-
b = lshift(b, b2);
|
3144
|
-
if (s2 > 0)
|
3145
|
-
S = lshift(S, s2);
|
3146
|
-
if (k_check) {
|
3147
|
-
if (cmp(b,S) < 0) {
|
3148
|
-
k--;
|
3149
|
-
b = multadd(b, 10, 0); /* we botched the k estimate */
|
3150
|
-
if (leftright)
|
3151
|
-
mhi = multadd(mhi, 10, 0);
|
3152
|
-
ilim = ilim1;
|
3153
|
-
}
|
3154
|
-
}
|
3155
|
-
if (ilim <= 0 && (mode == 3 || mode == 5)) {
|
3156
|
-
S = multadd(S, 5, 0);
|
3157
|
-
if (ilim < 0 || cmp(b, S) < 0 || ((cmp(b, S) == 0) && !bias_round_up)) {
|
3158
|
-
/* no digits, fcvt style */
|
3159
|
-
no_digits:
|
3160
|
-
k = -1 - ndigits;
|
3161
|
-
goto ret;
|
3162
|
-
}
|
3163
|
-
one_digit:
|
3164
|
-
*s++ = '1';
|
3165
|
-
k++;
|
3166
|
-
goto ret;
|
3167
|
-
}
|
3168
|
-
if (leftright) {
|
3169
|
-
if (m2 > 0)
|
3170
|
-
mhi = lshift(mhi, m2);
|
3171
|
-
|
3172
|
-
/* Compute mlo -- check for special case
|
3173
|
-
* that d is a normalized power of 2.
|
3174
|
-
*/
|
3175
|
-
|
3176
|
-
mlo = mhi;
|
3177
|
-
if (spec_case) {
|
3178
|
-
mhi = Balloc(mhi->k);
|
3179
|
-
Bcopy(mhi, mlo);
|
3180
|
-
mhi = lshift(mhi, Log2P);
|
3181
|
-
}
|
3182
|
-
|
3183
|
-
for(i = 1;;i++) {
|
3184
|
-
dig = quorem(b,S) + '0';
|
3185
|
-
/* Do we yet have the shortest decimal string
|
3186
|
-
* that will round to d?
|
3187
|
-
*/
|
3188
|
-
j = cmp(b, mlo);
|
3189
|
-
delta = diff(S, mhi);
|
3190
|
-
j1 = delta->sign ? 1 : cmp(b, delta);
|
3191
|
-
Bfree(delta);
|
3192
|
-
#ifndef ROUND_BIASED
|
3193
|
-
if (j1 == 0 && mode != 1 && !(word1(d) & 1)
|
3194
|
-
#ifdef Honor_FLT_ROUNDS
|
3195
|
-
&& rounding >= 1
|
3196
|
-
#endif
|
3197
|
-
) {
|
3198
|
-
if (dig == '9')
|
3199
|
-
goto round_9_up;
|
3200
|
-
if (j > 0)
|
3201
|
-
dig++;
|
3202
|
-
#ifdef SET_INEXACT
|
3203
|
-
else if (!b->x[0] && b->wds <= 1)
|
3204
|
-
inexact = 0;
|
3205
|
-
#endif
|
3206
|
-
*s++ = dig;
|
3207
|
-
goto ret;
|
3208
|
-
}
|
3209
|
-
#endif
|
3210
|
-
if (j < 0 || (j == 0 && mode != 1
|
3211
|
-
#ifndef ROUND_BIASED
|
3212
|
-
&& !(word1(d) & 1)
|
3213
|
-
#endif
|
3214
|
-
)) {
|
3215
|
-
if (!b->x[0] && b->wds <= 1) {
|
3216
|
-
#ifdef SET_INEXACT
|
3217
|
-
inexact = 0;
|
3218
|
-
#endif
|
3219
|
-
goto accept_dig;
|
3220
|
-
}
|
3221
|
-
#ifdef Honor_FLT_ROUNDS
|
3222
|
-
if (mode > 1)
|
3223
|
-
switch(rounding) {
|
3224
|
-
case 0: goto accept_dig;
|
3225
|
-
case 2: goto keep_dig;
|
3226
|
-
}
|
3227
|
-
#endif /*Honor_FLT_ROUNDS*/
|
3228
|
-
if (j1 > 0) {
|
3229
|
-
b = lshift(b, 1);
|
3230
|
-
j1 = cmp(b, S);
|
3231
|
-
if ((j1 > 0 || (j1 == 0 && ((dig & 1) || bias_round_up)))
|
3232
|
-
&& dig++ == '9')
|
3233
|
-
goto round_9_up;
|
3234
|
-
}
|
3235
|
-
accept_dig:
|
3236
|
-
*s++ = dig;
|
3237
|
-
goto ret;
|
3238
|
-
}
|
3239
|
-
if (j1 > 0) {
|
3240
|
-
#ifdef Honor_FLT_ROUNDS
|
3241
|
-
if (!rounding)
|
3242
|
-
goto accept_dig;
|
3243
|
-
#endif
|
3244
|
-
if (dig == '9') { /* possible if i == 1 */
|
3245
|
-
round_9_up:
|
3246
|
-
*s++ = '9';
|
3247
|
-
goto roundoff;
|
3248
|
-
}
|
3249
|
-
*s++ = dig + 1;
|
3250
|
-
goto ret;
|
3251
|
-
}
|
3252
|
-
#ifdef Honor_FLT_ROUNDS
|
3253
|
-
keep_dig:
|
3254
|
-
#endif
|
3255
|
-
*s++ = dig;
|
3256
|
-
if (i == ilim)
|
3257
|
-
break;
|
3258
|
-
b = multadd(b, 10, 0);
|
3259
|
-
if (mlo == mhi)
|
3260
|
-
mlo = mhi = multadd(mhi, 10, 0);
|
3261
|
-
else {
|
3262
|
-
mlo = multadd(mlo, 10, 0);
|
3263
|
-
mhi = multadd(mhi, 10, 0);
|
3264
|
-
}
|
3265
|
-
}
|
3266
|
-
}
|
3267
|
-
else
|
3268
|
-
for(i = 1;; i++) {
|
3269
|
-
*s++ = dig = quorem(b,S) + '0';
|
3270
|
-
if (!b->x[0] && b->wds <= 1) {
|
3271
|
-
#ifdef SET_INEXACT
|
3272
|
-
inexact = 0;
|
3273
|
-
#endif
|
3274
|
-
goto ret;
|
3275
|
-
}
|
3276
|
-
if (i >= ilim)
|
3277
|
-
break;
|
3278
|
-
b = multadd(b, 10, 0);
|
3279
|
-
}
|
3280
|
-
|
3281
|
-
/* Round off last digit */
|
3282
|
-
|
3283
|
-
#ifdef Honor_FLT_ROUNDS
|
3284
|
-
switch(rounding) {
|
3285
|
-
case 0: goto trimzeros;
|
3286
|
-
case 2: goto roundoff;
|
3287
|
-
}
|
3288
|
-
#endif
|
3289
|
-
b = lshift(b, 1);
|
3290
|
-
j = cmp(b, S);
|
3291
|
-
if (j > 0 || (j == 0 && ((dig & 1) || bias_round_up))) {
|
3292
|
-
roundoff:
|
3293
|
-
while(*--s == '9')
|
3294
|
-
if (s == s0) {
|
3295
|
-
k++;
|
3296
|
-
*s++ = '1';
|
3297
|
-
goto ret;
|
3298
|
-
}
|
3299
|
-
++*s++;
|
3300
|
-
}
|
3301
|
-
else {
|
3302
|
-
/* trimzeros: (never used) */
|
3303
|
-
while(*--s == '0');
|
3304
|
-
s++;
|
3305
|
-
}
|
3306
|
-
ret:
|
3307
|
-
Bfree(S);
|
3308
|
-
if (mhi) {
|
3309
|
-
if (mlo && mlo != mhi)
|
3310
|
-
Bfree(mlo);
|
3311
|
-
Bfree(mhi);
|
3312
|
-
}
|
3313
|
-
ret1:
|
3314
|
-
#ifdef SET_INEXACT
|
3315
|
-
if (inexact) {
|
3316
|
-
if (!oldinexact) {
|
3317
|
-
word0(d) = Exp_1 + (70 << Exp_shift);
|
3318
|
-
word1(d) = 0;
|
3319
|
-
dval(d) += 1.;
|
3320
|
-
}
|
3321
|
-
}
|
3322
|
-
else if (!oldinexact)
|
3323
|
-
clear_inexact();
|
3324
|
-
#endif
|
3325
|
-
Bfree(b);
|
3326
|
-
*s = 0;
|
3327
|
-
*decpt = k + 1;
|
3328
|
-
if (rve)
|
3329
|
-
*rve = s;
|
3330
|
-
return s0;
|
3331
|
-
}
|
3332
|
-
#ifdef __cplusplus
|
3333
|
-
}
|
3334
|
-
#endif
|