NO

Author Topic: Factorial Bug  (Read 15 times)

Offline melsmith

  • Member
  • *
  • Posts: 2
Factorial Bug
« on: Yesterday at 04:47:16 pm »
Hi All:
   This is my first post.

   Environment: C Compiler PellesC64 and running a short Harbour program to test factorial computations.

   When running a Factorial function FACT(21), the result is:

      51,090,942,171,709,430,000

   Other compilers (e.g., Borland BCC 7.4 and MinGW 10.2) show the correct answer should be:

      51,090,942,171,709,440,000


    The PellesC64 results from FACT(1) thru FACT(20) are *correct* and identical to other compilers. However, FACT(21) is *incorrect*.

-Mel Smith

Offline melsmith

  • Member
  • *
  • Posts: 2
Re: Factorial Bug
« Reply #1 on: Yesterday at 08:13:09 pm »
Hi All:

   Simplifying:

   The following multiplication is incorrect:

   21 * 2432902008176640000  *should be* equal to  51090942171709440000

   Instead, Pelles64 produces the result: 51090942171709430000

   MinGW 10.1 and BCC 7.4 produce the correct answer.


-Mel