Recent Changes - Search:

Oktatás

* Programozás 2
  + feladatsor
  + C feladatsor
  + Python feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

* levelezősök
  + Adator. prog.
  + feladatsor
  + quick link

teaching assets


Félévek

* 2024/25/1
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Scala


[ edit | logout ]
[ sandbox | passwd ]

Nim /

20180617k

raising to a power

How much is 28?

import math

echo 2 ^ 8

Output:

256

If the resulting value is too big (e.g. 21024), then you get an OverflowError exception.


However, using a 3rd-party module called "bigints", you can work with huge numbers.

import bigints    # nimble install bigints

let big = bigints.pow(2, 1024)
echo big

Output:

17976931348623159077293051907890247336179769789423065727343008115773267580550
09631327084773224075360211201138798713933576587897688144166224928474306394741
24377767893424865485276302219601246094119453082952085005768838150682342462881
473913110540827237163350510684586298239947245938479716304835356329624224137216

(It's one line actually, but wrapped for easier reading).

Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2018 October 23, 20:13