#1656: Bignum exponentiation yields wrong results
------------------------------------+---------------------------------------
  Reporter:  [EMAIL PROTECTED]  |          Owner:                
      Type:  bug                    |         Status:  new           
  Priority:  normal                 |      Milestone:                
 Component:  Compiler               |        Version:  6.6           
  Severity:  major                  |       Keywords:                
Difficulty:  Unknown                |             Os:  Linux         
  Testcase:                         |   Architecture:  x86_64 (amd64)
------------------------------------+---------------------------------------
I've used the following GHC program:

 main = print $ 9^9^9

 The result was right in the number of digits (approx. 350 millions) but
 the last to digits are 94. By quick modular exponentiation, one finds out
 that 9^9^9 mod 100 = 89. So the number is obviously wrong. Looking
 further, at least the last 100 digits are wrong.

 I have redone the calculation with demo/calc/calc.c included in the
 distribution of the GNU gmp library. This yields a different number, that
 could be correct ( 89, but I don't know if it is otherwise correct)

 In both cases, the same libgmp3 shared object was used. But the GHC
 version constantly used 8 GiB of memory and four hours just for outputting
 the value in base 10, while the calculation of the value had been finished
 in about 5 minutes. demo/calc/calc.c used about 30 minutes for the whole
 job.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1656>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to