turtlestitch/libraries/bignumbers.xml

1 wiersz
2.9 KiB
XML

<blocks app="Snap! 7, https://snap.berkeley.edu" version="2"><block-definition s="USE BIGNUMS %&apos;bool&apos;" type="command" category="operators"><comment w="303.3333333333333" collapsed="false">call with True to turn on the entire Scheme numeric tower, including infinite-precision integers, exact rationals, and complex numbers; call with False to restore native JavaScript arithmetic.</comment><header></header><code></code><translations>pt:altera utilização de aritmética do Scheme para _&#xD;ca:sistema numèric d&apos;Scheme _&#xD;</translations><inputs><input type="%b"></input></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/biginteger.js</l></list></block><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/schemeNumber.js</l></list></block><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/bignums.js</l></list></block><block s="doApplyExtension"><l>big_switch(bool)</l><list><block var="bool"/></list></block></script></block-definition><block-definition s="%&apos;n&apos; !" type="reporter" category="operators"><comment x="0" y="0" w="190.66666666666666" collapsed="false">The factorial function, to make very large numbers, to demo bignums.</comment><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doReport"><block s="reportIfElse"><block s="reportEquals"><block var="n"/><l>0</l></block><l>1</l><block s="reportProduct"><block var="n"/><custom-block s="%n !"><block s="reportDifference"><block var="n"/><l>1</l></block></custom-block></block></block></block></script></block-definition><block-definition s="%&apos;x&apos;" type="reporter" category="operators"><comment x="0" y="0" w="234.66666666666666" collapsed="false">The identity function: reports its input.&#xD;It&apos;s useful to get things like 3/4 or 5-2i into&#xD;numeric input slots.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doReport"><block var="x"/></block></script></block-definition><block-definition s="Scheme number %&apos;function&apos; of %&apos;number&apos;" type="reporter" category="operators"><comment w="300" collapsed="true">Provides Scheme arithmetic functions not in JavaScript</comment><header></header><code></code><translations>pt:_ de _&#xD;ca:Scheme _ de _&#xD;</translations><inputs><input type="%s" readonly="true"><options>number?&#xD;complex?&#xD;real?&#xD;rational?&#xD;integer?&#xD;exact?&#xD;inexact?&#xD;exact&#xD;inexact&#xD;finite?&#xD;infinite?&#xD;nan?&#xD;numerator&#xD;denominator&#xD;real-part&#xD;imag-part&#xD;magnitude&#xD;angle</options></input><input type="%s"></input></inputs><script><block s="doReport"><block s="reportApplyExtension"><l>big_scheme(fn, num)</l><list><block var="function"/><block var="number"/></list></block></block></script></block-definition></blocks>