#1656: Bignum exponentiation yields wrong results
--------------------------------------+-------------------------------------
    Reporter:  [EMAIL PROTECTED]  |        Owner:         
        Type:  bug                    |       Status:  new    
    Priority:  normal                 |    Milestone:  6.8    
   Component:  Compiler               |      Version:  6.6    
    Severity:  major                  |   Resolution:         
    Keywords:                         |   Difficulty:  Unknown
          Os:  Linux                  |     Testcase:         
Architecture:  x86_64 (amd64)         |  
--------------------------------------+-------------------------------------
Comment (by [EMAIL PROTECTED]):

 This time, I got the same result as with C+gmp, but used a different
 program:

 {{{
 power acc  _  0           = acc
 power acc  x  n  | odd n  = power (x * acc) (x * x) ((n - 1) `div` 2)
                  | even n = power  acc      (x * x)  (n      `div` 2)

 main = let (^^^) = power 1 in do
        writeFile "myresult" . show $ 9 ^^^ (9 ^^^ 9)

 }}}

 Note: this time I used writeFile directly instead of print and redirecting
 the output, and I am using an exponentiation algorithm different from the
 one in the base library. Although I don't see why that would lead to
 different results. (I haven't looked at the base one very much)

 I'll try once again with writeFile and the builtin ^, to see whether print
 and redirection messed with my number.

-- 
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