|
|
Subscribe / Log in / New account

Concurrency in Julia

Concurrency in Julia

Posted Nov 12, 2021 4:34 UTC (Fri) by droundy (subscriber, #4559)
In reply to: Concurrency in Julia by mathstuf
Parent article: Concurrency in Julia

My brain somehow converted it to a factorial program. Not sure how that happened.


to post comments

Concurrency in Julia

Posted Nov 12, 2021 6:29 UTC (Fri) by rsidd (subscriber, #2582) [Link]

Even for factorial, the parameter type can be anything, the function body can convert it to bigint if needed.
julia> function factorial(n::Integer)
           return prod(1:convert(BigInt,n))
       end
factorial (generic function with 1 method)

julia> factorial(convert(Int32,100))
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds