How to do exponentiation in clojure?

前端 未结 13 1806
执笔经年
执笔经年 2021-01-30 12:32

How can I do exponentiation in clojure? For now I\'m only needing integer exponentiation, but the question goes for fractions too.

13条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-30 12:59

    user=> (.pow (BigInteger. "2") 10)
    1024
    user=> (.pow (BigInteger. "2") 100)
    1267650600228229401496703205376
    

提交回复
热议问题