numbat icon indicating copy to clipboard operation
numbat copied to clipboard

[BUG] Large Factorials Seem Weird

Open IsaacTheKind opened this issue 9 months ago • 2 comments

Had an assignment that required generation of huge factorials. Was using Numbat to check output. Couldn't understand why my code was wrong, eventually questioned Numbat and checked some large factorial lists and some other tools like SpeedCrunch. I can for ex generate 49! in SpeedCrunch:

49!
= 608281864034267560872252163321295376887552831379210240000000000

Then if I copy paste that into Numbat like so:

>>> 49! == 608281864034267560872252163321295376887552831379210240000000000

  (49!) == 6.08282e+62

    = false    [Bool]

Sorry the writeup isn't more detailed. I have too much on my plate but I figured I should at least post something. If I'm just confused please let me know, but it looks to me like SpeedCrunch generates large factorials correctly (they correspond to what I see in other calculators/factorial lists I can find online) yet if I check those results for equality with large factorials in Numbat it returns False. Seems like Numbat is the issue as it's out of correspondence with other calculators and lists.

IsaacTheKind avatar Mar 27 '25 18:03 IsaacTheKind

It is likely due to the underlying number representation. See #682 for another example and a bit of explanation. Also see #4 for some a history of considered alternatives.

I’m afraid there isn't much to do to fix it right now but thank you for making time to report it.

Goju-Ryu avatar Mar 27 '25 20:03 Goju-Ryu

To add a bit of detail to the report and give an explanation of the problem, I used assert_eq to provide some details:

Image

Goju-Ryu avatar Mar 27 '25 20:03 Goju-Ryu

Let's close this in favor of #4.

sharkdp avatar Jun 06 '25 18:06 sharkdp