[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [kalgebra] [Bug 362507] New: Factorial(13) does not
From:       Sebastian J. via KDE Bugzilla <bugzilla_noreply () kde ! org>
Date:       2016-04-30 16:50:24
Message-ID: bug-362507-17878 () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=362507

            Bug ID: 362507
           Summary: Factorial(13) does not
           Product: kalgebra
           Version: 0.11
          Platform: Mint (Ubuntu based)
               URL: http://abload.de/img/factorial_13_is_wrong7isuq.png
                OS: Linux
            Status: UNCONFIRMED
          Severity: grave
          Priority: NOR
         Component: general
          Assignee: aleixpol@kde.org
          Reporter: gerdroot@gmail.com

This has cost me almost an hour of my precious study time.

The factorial function will give wrong results from exactly 13 on.

I.e. 

factorial (12) = 12*11*10*9*8*7*6*5*4*3*2*1 = 479001600

That is just fine. 

But from 13 on, the result seems to pass a limit or whatver and gives back a
wrong result...

13*12*11*10*9*8*7*6*5*4*3*2*1
=6227020800
(the same what Wolfram Alpha would return for 13! )

but, using the factorial function

factorial(13)
=1932053504

Which is wrong.

Factorial(14) will be wrong as well...





Reproducible: Always

Steps to Reproduce:
1. Start kAlgebra
2. In the Input box type "12*11*10*9*8*7*6*5*4*3*2*1", hit Enter
3. in the input box type "ans*13", hit enter
4. Now input "factorial(12)" in the input box, hit enter
5. Now input "factorial(13)" in the input box, hit enter
6. Compare results. 


Actual Results:  
Factorial function is not the same as equivalent when value is 12!.

Expected Results:  
13!  or "factorial(13)" gives the correct value

Severity: a calculator that does surprisingly give back wrong results when you
dont expect it is worthless.

I had to debug a long equation step by step to find out the part with
factorial(13) will give the wrong result.


Here the kAlgebra script

-------------------- save as factorial.kal and load in kAlgebra for convenience
--------------
1
factorial(1)
2*1
factorial(2)
3*2*1
factorial(3)
4*3*2*1
factorial(4)
5*4*3*2*1
factorial(5)
6*5*4*3*2*1
factorial(6)
7*6*5*4*3*2*1
factorial(7)
8*7*6*5*4*3*2*1
factorial(8)
9*8*7*6*5*4*3*2*1
factorial(9)
10*9*8*7*6*5*4*3*2*1
factorial(10)
11*10*9*8*7*6*5*4*3*2*1
factorial(11)
12*11*10*9*8*7*6*5*4*3*2*1
factorial(12)
13*12*11*10*9*8*7*6*5*4*3*2*1
factorial(13)

-- 
You are receiving this mail because:
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic