में से निपटने (मैं मुख्य रूप से swi-prolog और yap के माध्यम से ही जीएमपी-पुस्तकालय का एक अप्रत्यक्ष प्रयोक्ता हूँ। लेकिन मैं इस समस्या को ठीक करने में बहुत ज्यादा दिलचस्पी है।)ओवरफ्लो जीएमपी पॉव
जब हास्यास्पद मान अधिक exponentiations प्रदर्शन, होस्ट-सिस्टम या जीएमपी अब ओवरफ्लो को उचित तरीके से संभालने में सक्षम नहीं हैं। मैंने उपरोक्त सिस्टम के डेवलपर्स से बात की है, लेकिन उन्हें इसके लिए एक आसान फिक्स नहीं दिख रहा है।
क्या यह समस्या अन्य जीएमपी सिस्टम/उपयोगकर्ताओं को ज्ञात है? आप इस तरह के अतिप्रवाह कैसे संभालते हैं?
के रूप में एक मानसिक स्वास्थ्य की जांच पहले 7^7^7 जो होना चाहिए के लिए मूल्य का परीक्षण: 375,982 ... 32343
32-बिट सिस्टम पर, उदाहरण के लिए क्वेरी ?- X is 13^1150000000.
पैदावार इस तरह के एक अतिप्रवाह। यहां बताया गया है YAP देता है:
GNU gdb (GDB) 7.0-ubuntu Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu". For bug reporting instructions, please see: ... Reading symbols from /opt/gupu/src/yap-6.3/narch-gupu2/yap...done. (gdb) run -f Starting program: /opt/gupu/src/yap-6.3/narch-gupu2/yap -f YAP 6.3.2 (i686-linux): Sun Nov 11 04:19:37 CET 2012 ?- X is 13^1150000000. Program received signal SIGSEGV, Segmentation fault. 0x001638d8 in ??() from /usr/lib/libgmp.so.3 (gdb) bt #0 0x001638d8 in ??() from /usr/lib/libgmp.so.3 #1 0x00164470 in __gmpn_mul_fft() from /usr/lib/libgmp.so.3 #2 0x001646c2 in __gmpn_mul_fft_full() from /usr/lib/libgmp.so.3 #3 0x00165f28 in __gmpn_sqr_n() from /usr/lib/libgmp.so.3 #4 0x0014b58b in __gmpz_n_pow_ui() from /usr/lib/libgmp.so.3 #5 0x0014c4a1 in __gmpz_pow_ui() from /usr/lib/libgmp.so.3 #6 0x080c4a1d in Yap_gmp_exp_int_int (i1=13, i2=1150000000) at ../C/gmp_support.c:939 #7 0x0815f9df in p_exp (t1=, t2=3082051592) at ../C/arith2.c:609 #8 0x080b1f19 in Eval (t=0) at ../C/eval.c:147 #9 0x080b2251 in p_is() at ../C/eval.c:186 #10 0x0806b56a in Yap_absmi (inp=0) at ../C/absmi.c:6912 #11 0x080b3655 in exec_absmi (top=) at ../C/exec.c:1002 #12 0x080b3b1f in do_goal (t=, CodeAdr=, arity=, pt=0x0, top=1) at ../C/exec.c:1068 #13 0x080b3d1d in Yap_RunTopGoal (t=135918154) at ../C/exec.c:1291 #14 0x08061a6f in YAP_RunGoalOnce (t=135918154) at ../C/c_interface.c:2511 #15 0x0805c2f5 in do_top_goal (argc=2, argv=0xbffff4c4) at ../console/yap.c:84 #16 exec_top_level (argc=2, argv=0xbffff4c4) at ../console/yap.c:131 #17 main (argc=2, argv=0xbffff4c4) at ../console/yap.c:172 (gdb)
संपादित करें: यह भी 64-बिट सिस्टम के लिए सच है; इसलिए जैसे:
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 6.3.5)
Copyright (c) 1990-2012 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.
For help, use ?- help(Topic). or ?- apropos(Word).
?- X is 3445^2^62.
gmp: overflow in mpz type
Abort
हालांकि
,
?- X is 2^2^63.
ERROR: Out of global stack
?- X is 2^2^62.
gmp: overflow in mpz type
Abort
और नीचे से:
?- X is 2^2^36.
ERROR: Out of global stack
?- X is 2^2^37.
gmp: overflow in mpz type
Abort
तो, अगर संख्या काफी बड़ी है, त्रुटि SWI से पता चला है - और इस तरह हो सकता है एसडब्ल्यूआई द्वारा नियंत्रित (त्रुटि: संदेश एसडब्ल्यूआई द्वारा है)।
हाल के संस्करणों में यह संदेश और बंदरगाहों को प्रिंट करता है। इस तरह से ओवरफ्लो को एप्लिकेशन द्वारा नियंत्रित नहीं किया जा सकता है। इस मामले में एसडब्ल्यूआई-प्रोलॉग – false
क्या आपने एसडब्ल्यूआई-प्रोलॉग के 64-बिट संस्करण की कोशिश की है? –
यूप - ऊपर देखें, 6.3.5 सिर्फ एक घंटे से भी कम समय के लिए बाहर है ... – false