04-20-2023, 07:44 PM
That formula in the first post - that's exactly the reason to hate formulas. Basically, it's like trying to write something simple horribly in maximum complicated form.
@BPlus - I haven't dealt with factorials so far - and I was thinking - why are you solving it in the form of strings. Then wrote it my way and understood. For the first time in my life, have exhausted the limit for the largest data type in QB64 - FLOAT. Yeah, so - you already know. That's why you're doing it right!
My function for calculating factorial is simple:
but factorial 500 is over limit for this function. Result number is tooooo high.
@BPlus - I haven't dealt with factorials so far - and I was thinking - why are you solving it in the form of strings. Then wrote it my way and understood. For the first time in my life, have exhausted the limit for the largest data type in QB64 - FLOAT. Yeah, so - you already know. That's why you're doing it right!
My function for calculating factorial is simple:
Code: (Select All)
Function CalcFac## (value##)
Do Until i## = value## - 1##
If c## = 0 Then a## = 1## Else a## = c##
b## = i## + 1##
c## = a## * b##
i## = i## + 1##
Loop
CalcFac## = c## * value##
End Function
but factorial 500 is over limit for this function. Result number is tooooo high.