Bignum Tutorial

From Snap! Wiki, made by Snappers for Snappers

Stub Article
This article needs more information, clarification, or completion.
You can help us by expanding this article. There may be more information on its talk page.


The BIGNUMS Library is confusing and kind of hard, here is a tutorial:

Tutorial[edit | edit source]

Blocks[edit | edit source]

The blocks that are included in the BIGNUMS Library are:

USE BIGNUMS <> :: operators - Enables/disables BIGNUMS.

(() ! :: operators) - The factorial function, to make very large numbers, to demo bignums.

([] :: operators) - The identity function: reports its input.

(Scheme number [ v] of () :: operators) - Provides Scheme arithmetic functions not in JavaScript

Using BIGNUMS[edit | edit source]

BIGNUMS can be enabled with the USE BIGNUMS <> :: operators block,

and used with the (() ! :: operators) block.

As a library, BIGNUMS is incompatible with some existing blocks, especially if using exact rational or complex numbers. One common fix is to use (Scheme number [inexact v] of [] :: operators) when using them, but that will cause a loss of precision.

Examples of (() ! :: operators)[edit | edit source]

((100) ! :: operators) (equal to 9.33262154439441e+157 if disabled, [result 1] if enabled)

((200) ! :: operators) (equal to Infinity if disabled)

((500) ! :: operators) (equal to Infinity if disabled)

((1000) ! :: operators) (equal to Infinity if disabled)

Results[edit | edit source]
  1. 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000