pyret-npm 0.0.66 → 0.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -39901,6 +39901,8 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
39901
39901
|
// NB: all of these trig-gy generic functions should now return roughnum rather than float
|
|
39902
39902
|
// (except for an arg of 0, etc)
|
|
39903
39903
|
|
|
39904
|
+
var ln10 = Math.log(10)
|
|
39905
|
+
|
|
39904
39906
|
// log: pyretnum -> pyretnum
|
|
39905
39907
|
var log = function(n, errbacks) {
|
|
39906
39908
|
if ( eqv(n, 1, errbacks) ) {
|
|
@@ -39912,7 +39914,35 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
39912
39914
|
if (typeof(n) === 'number') {
|
|
39913
39915
|
return Roughnum.makeInstance(Math.log(n), errbacks);
|
|
39914
39916
|
}
|
|
39915
|
-
|
|
39917
|
+
var nFix = n.toFixnum();
|
|
39918
|
+
if (typeof(nFix) === 'number' && nFix !== Infinity) {
|
|
39919
|
+
return Roughnum.makeInstance(Math.log(nFix), errbacks);
|
|
39920
|
+
}
|
|
39921
|
+
// at this point, n must be a very large positive number;
|
|
39922
|
+
// n > 1e308, i.e, has at least 308 digits;
|
|
39923
|
+
// we can safely ignore its fractional part;
|
|
39924
|
+
var nStr = n.round(errbacks).toString();
|
|
39925
|
+
var nLen = nStr.length;
|
|
39926
|
+
// we furthermore need only the integer part's first few digits
|
|
39927
|
+
// although we must remember the number of digits ignored;
|
|
39928
|
+
var firstFewLen = 308; // has to be <= 308
|
|
39929
|
+
// say integer N = yyy...yyyxxx...xxx
|
|
39930
|
+
// where the number of x's is nx;
|
|
39931
|
+
// So N ~= yyy...yyy * 10^nx
|
|
39932
|
+
// We'll first find the common (base 10) log of N
|
|
39933
|
+
// log10(N) ~= log10(yyy...yyy * 10^nx)
|
|
39934
|
+
// = log10(yyy...yyy) + nx
|
|
39935
|
+
// Now to convert this to the natural log
|
|
39936
|
+
// ln(N) = log10(N) / log10(e)
|
|
39937
|
+
// = log10(N) * ln(10)
|
|
39938
|
+
// ~= [log10(yyy...yyy) + nx] * ln(10)
|
|
39939
|
+
// = log10(yyy...yyy) * ln(10) + nx * ln(10)
|
|
39940
|
+
// = ln(yyy...yyy) + nx * ln(10)
|
|
39941
|
+
// JS gives us ln(yyy...yyy) and ln(10) so we have a good
|
|
39942
|
+
// approximation for ln(N)
|
|
39943
|
+
var nFirstFew = parseInt(nStr.substring(0, firstFewLen));
|
|
39944
|
+
var nLog = Math.log(nFirstFew) + (nLen - firstFewLen) * ln10;
|
|
39945
|
+
return Roughnum.makeInstance(nLog, errbacks);
|
|
39916
39946
|
};
|
|
39917
39947
|
|
|
39918
39948
|
// tan: pyretnum -> pyretnum
|
|
@@ -41977,8 +42007,13 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
41977
42007
|
function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }
|
|
41978
42008
|
|
|
41979
42009
|
// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
|
|
41980
|
-
function bnpExp(e,z) {
|
|
41981
|
-
if(e
|
|
42010
|
+
function bnpExp(e, z, errbacks) {
|
|
42011
|
+
if (greaterThan(e, 0xffffffff, errbacks)) {
|
|
42012
|
+
errbacks.throwDomainError('expt: exponent ' + e + ' too large');
|
|
42013
|
+
}
|
|
42014
|
+
if (lessThan(e, 1, errbacks)) {
|
|
42015
|
+
return BigInteger.ONE;
|
|
42016
|
+
}
|
|
41982
42017
|
var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
|
|
41983
42018
|
g.copyTo(r);
|
|
41984
42019
|
while(--i >= 0) {
|
|
@@ -41990,10 +42025,10 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
41990
42025
|
}
|
|
41991
42026
|
|
|
41992
42027
|
// (public) this^e % m, 0 <= e < 2^32
|
|
41993
|
-
function bnModPowInt(e,m) {
|
|
42028
|
+
function bnModPowInt(e, m, errbacks) {
|
|
41994
42029
|
var z;
|
|
41995
42030
|
if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
|
|
41996
|
-
return this.bnpExp(e,z);
|
|
42031
|
+
return this.bnpExp(e, z, errbacks);
|
|
41997
42032
|
}
|
|
41998
42033
|
|
|
41999
42034
|
// protected
|
|
@@ -42362,7 +42397,9 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
42362
42397
|
NullExp.prototype.sqrTo = nSqrTo;
|
|
42363
42398
|
|
|
42364
42399
|
// (public) this^e
|
|
42365
|
-
function bnPow(e
|
|
42400
|
+
function bnPow(e, errbacks) {
|
|
42401
|
+
return this.bnpExp(e,new NullExp(), errbacks);
|
|
42402
|
+
}
|
|
42366
42403
|
|
|
42367
42404
|
// (protected) r = lower n words of "this * a", a.t <= n
|
|
42368
42405
|
// "this" should be the larger one if appropriate.
|
|
@@ -42862,48 +42899,48 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
42862
42899
|
|
|
42863
42900
|
// round: -> pyretnum
|
|
42864
42901
|
// Round to the nearest integer.
|
|
42865
|
-
BigInteger.prototype.round = function(
|
|
42902
|
+
BigInteger.prototype.round = function(errbacks) {
|
|
42866
42903
|
return this;
|
|
42867
42904
|
};
|
|
42868
42905
|
|
|
42869
|
-
BigInteger.prototype.roundEven = function(
|
|
42906
|
+
BigInteger.prototype.roundEven = function(errbacks) {
|
|
42870
42907
|
return this;
|
|
42871
42908
|
};
|
|
42872
42909
|
|
|
42873
42910
|
// log: -> pyretnum
|
|
42874
42911
|
// Produce the log.
|
|
42875
|
-
BigInteger.prototype.log = function(
|
|
42912
|
+
BigInteger.prototype.log = function(errbacks) {
|
|
42876
42913
|
return log(this.toFixnum(), errbacks);
|
|
42877
42914
|
};
|
|
42878
42915
|
|
|
42879
42916
|
// tan: -> pyretnum
|
|
42880
42917
|
// Produce the tan.
|
|
42881
|
-
BigInteger.prototype.tan = function(
|
|
42918
|
+
BigInteger.prototype.tan = function(errbacks) {
|
|
42882
42919
|
return tan(this.toFixnum(), errbacks);
|
|
42883
42920
|
};
|
|
42884
42921
|
|
|
42885
42922
|
// atan: -> pyretnum
|
|
42886
42923
|
// Produce the arc tangent.
|
|
42887
|
-
BigInteger.prototype.atan = function(
|
|
42924
|
+
BigInteger.prototype.atan = function(errbacks) {
|
|
42888
42925
|
return atan(this.toFixnum(), errbacks);
|
|
42889
42926
|
};
|
|
42890
42927
|
|
|
42891
42928
|
// cos: -> pyretnum
|
|
42892
42929
|
// Produce the cosine.
|
|
42893
|
-
BigInteger.prototype.cos = function(
|
|
42930
|
+
BigInteger.prototype.cos = function(errbacks) {
|
|
42894
42931
|
return cos(this.toFixnum(), errbacks);
|
|
42895
42932
|
};
|
|
42896
42933
|
|
|
42897
42934
|
// sin: -> pyretnum
|
|
42898
42935
|
// Produce the sine.
|
|
42899
|
-
BigInteger.prototype.sin = function(
|
|
42936
|
+
BigInteger.prototype.sin = function(errbacks) {
|
|
42900
42937
|
return sin(this.toFixnum(), errbacks);
|
|
42901
42938
|
};
|
|
42902
42939
|
|
|
42903
42940
|
// expt: pyretnum -> pyretnum
|
|
42904
42941
|
// Produce the power to the input.
|
|
42905
42942
|
BigInteger.prototype.expt = function(n, errbacks) {
|
|
42906
|
-
return bnPow.call(this, n);
|
|
42943
|
+
return bnPow.call(this, n, errbacks);
|
|
42907
42944
|
};
|
|
42908
42945
|
|
|
42909
42946
|
// exp: -> pyretnum
|
|
@@ -42917,13 +42954,13 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
42917
42954
|
|
|
42918
42955
|
// acos: -> pyretnum
|
|
42919
42956
|
// Produce the arc cosine.
|
|
42920
|
-
BigInteger.prototype.acos = function(
|
|
42957
|
+
BigInteger.prototype.acos = function(errbacks) {
|
|
42921
42958
|
return acos(this.toFixnum(), errbacks);
|
|
42922
42959
|
};
|
|
42923
42960
|
|
|
42924
42961
|
// asin: -> pyretnum
|
|
42925
42962
|
// Produce the arc sine.
|
|
42926
|
-
BigInteger.prototype.asin = function(
|
|
42963
|
+
BigInteger.prototype.asin = function(errbacks) {
|
|
42927
42964
|
return asin(this.toFixnum(), errbacks);
|
|
42928
42965
|
};
|
|
42929
42966
|
|
|
@@ -813,6 +813,8 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
813
813
|
// NB: all of these trig-gy generic functions should now return roughnum rather than float
|
|
814
814
|
// (except for an arg of 0, etc)
|
|
815
815
|
|
|
816
|
+
var ln10 = Math.log(10)
|
|
817
|
+
|
|
816
818
|
// log: pyretnum -> pyretnum
|
|
817
819
|
var log = function(n, errbacks) {
|
|
818
820
|
if ( eqv(n, 1, errbacks) ) {
|
|
@@ -824,7 +826,35 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
824
826
|
if (typeof(n) === 'number') {
|
|
825
827
|
return Roughnum.makeInstance(Math.log(n), errbacks);
|
|
826
828
|
}
|
|
827
|
-
|
|
829
|
+
var nFix = n.toFixnum();
|
|
830
|
+
if (typeof(nFix) === 'number' && nFix !== Infinity) {
|
|
831
|
+
return Roughnum.makeInstance(Math.log(nFix), errbacks);
|
|
832
|
+
}
|
|
833
|
+
// at this point, n must be a very large positive number;
|
|
834
|
+
// n > 1e308, i.e, has at least 308 digits;
|
|
835
|
+
// we can safely ignore its fractional part;
|
|
836
|
+
var nStr = n.round(errbacks).toString();
|
|
837
|
+
var nLen = nStr.length;
|
|
838
|
+
// we furthermore need only the integer part's first few digits
|
|
839
|
+
// although we must remember the number of digits ignored;
|
|
840
|
+
var firstFewLen = 308; // has to be <= 308
|
|
841
|
+
// say integer N = yyy...yyyxxx...xxx
|
|
842
|
+
// where the number of x's is nx;
|
|
843
|
+
// So N ~= yyy...yyy * 10^nx
|
|
844
|
+
// We'll first find the common (base 10) log of N
|
|
845
|
+
// log10(N) ~= log10(yyy...yyy * 10^nx)
|
|
846
|
+
// = log10(yyy...yyy) + nx
|
|
847
|
+
// Now to convert this to the natural log
|
|
848
|
+
// ln(N) = log10(N) / log10(e)
|
|
849
|
+
// = log10(N) * ln(10)
|
|
850
|
+
// ~= [log10(yyy...yyy) + nx] * ln(10)
|
|
851
|
+
// = log10(yyy...yyy) * ln(10) + nx * ln(10)
|
|
852
|
+
// = ln(yyy...yyy) + nx * ln(10)
|
|
853
|
+
// JS gives us ln(yyy...yyy) and ln(10) so we have a good
|
|
854
|
+
// approximation for ln(N)
|
|
855
|
+
var nFirstFew = parseInt(nStr.substring(0, firstFewLen));
|
|
856
|
+
var nLog = Math.log(nFirstFew) + (nLen - firstFewLen) * ln10;
|
|
857
|
+
return Roughnum.makeInstance(nLog, errbacks);
|
|
828
858
|
};
|
|
829
859
|
|
|
830
860
|
// tan: pyretnum -> pyretnum
|
|
@@ -2889,8 +2919,13 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
2889
2919
|
function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }
|
|
2890
2920
|
|
|
2891
2921
|
// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
|
|
2892
|
-
function bnpExp(e,z) {
|
|
2893
|
-
if(e
|
|
2922
|
+
function bnpExp(e, z, errbacks) {
|
|
2923
|
+
if (greaterThan(e, 0xffffffff, errbacks)) {
|
|
2924
|
+
errbacks.throwDomainError('expt: exponent ' + e + ' too large');
|
|
2925
|
+
}
|
|
2926
|
+
if (lessThan(e, 1, errbacks)) {
|
|
2927
|
+
return BigInteger.ONE;
|
|
2928
|
+
}
|
|
2894
2929
|
var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
|
|
2895
2930
|
g.copyTo(r);
|
|
2896
2931
|
while(--i >= 0) {
|
|
@@ -2902,10 +2937,10 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
2902
2937
|
}
|
|
2903
2938
|
|
|
2904
2939
|
// (public) this^e % m, 0 <= e < 2^32
|
|
2905
|
-
function bnModPowInt(e,m) {
|
|
2940
|
+
function bnModPowInt(e, m, errbacks) {
|
|
2906
2941
|
var z;
|
|
2907
2942
|
if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
|
|
2908
|
-
return this.bnpExp(e,z);
|
|
2943
|
+
return this.bnpExp(e, z, errbacks);
|
|
2909
2944
|
}
|
|
2910
2945
|
|
|
2911
2946
|
// protected
|
|
@@ -3274,7 +3309,9 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
3274
3309
|
NullExp.prototype.sqrTo = nSqrTo;
|
|
3275
3310
|
|
|
3276
3311
|
// (public) this^e
|
|
3277
|
-
function bnPow(e
|
|
3312
|
+
function bnPow(e, errbacks) {
|
|
3313
|
+
return this.bnpExp(e,new NullExp(), errbacks);
|
|
3314
|
+
}
|
|
3278
3315
|
|
|
3279
3316
|
// (protected) r = lower n words of "this * a", a.t <= n
|
|
3280
3317
|
// "this" should be the larger one if appropriate.
|
|
@@ -3774,48 +3811,48 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
3774
3811
|
|
|
3775
3812
|
// round: -> pyretnum
|
|
3776
3813
|
// Round to the nearest integer.
|
|
3777
|
-
BigInteger.prototype.round = function(
|
|
3814
|
+
BigInteger.prototype.round = function(errbacks) {
|
|
3778
3815
|
return this;
|
|
3779
3816
|
};
|
|
3780
3817
|
|
|
3781
|
-
BigInteger.prototype.roundEven = function(
|
|
3818
|
+
BigInteger.prototype.roundEven = function(errbacks) {
|
|
3782
3819
|
return this;
|
|
3783
3820
|
};
|
|
3784
3821
|
|
|
3785
3822
|
// log: -> pyretnum
|
|
3786
3823
|
// Produce the log.
|
|
3787
|
-
BigInteger.prototype.log = function(
|
|
3824
|
+
BigInteger.prototype.log = function(errbacks) {
|
|
3788
3825
|
return log(this.toFixnum(), errbacks);
|
|
3789
3826
|
};
|
|
3790
3827
|
|
|
3791
3828
|
// tan: -> pyretnum
|
|
3792
3829
|
// Produce the tan.
|
|
3793
|
-
BigInteger.prototype.tan = function(
|
|
3830
|
+
BigInteger.prototype.tan = function(errbacks) {
|
|
3794
3831
|
return tan(this.toFixnum(), errbacks);
|
|
3795
3832
|
};
|
|
3796
3833
|
|
|
3797
3834
|
// atan: -> pyretnum
|
|
3798
3835
|
// Produce the arc tangent.
|
|
3799
|
-
BigInteger.prototype.atan = function(
|
|
3836
|
+
BigInteger.prototype.atan = function(errbacks) {
|
|
3800
3837
|
return atan(this.toFixnum(), errbacks);
|
|
3801
3838
|
};
|
|
3802
3839
|
|
|
3803
3840
|
// cos: -> pyretnum
|
|
3804
3841
|
// Produce the cosine.
|
|
3805
|
-
BigInteger.prototype.cos = function(
|
|
3842
|
+
BigInteger.prototype.cos = function(errbacks) {
|
|
3806
3843
|
return cos(this.toFixnum(), errbacks);
|
|
3807
3844
|
};
|
|
3808
3845
|
|
|
3809
3846
|
// sin: -> pyretnum
|
|
3810
3847
|
// Produce the sine.
|
|
3811
|
-
BigInteger.prototype.sin = function(
|
|
3848
|
+
BigInteger.prototype.sin = function(errbacks) {
|
|
3812
3849
|
return sin(this.toFixnum(), errbacks);
|
|
3813
3850
|
};
|
|
3814
3851
|
|
|
3815
3852
|
// expt: pyretnum -> pyretnum
|
|
3816
3853
|
// Produce the power to the input.
|
|
3817
3854
|
BigInteger.prototype.expt = function(n, errbacks) {
|
|
3818
|
-
return bnPow.call(this, n);
|
|
3855
|
+
return bnPow.call(this, n, errbacks);
|
|
3819
3856
|
};
|
|
3820
3857
|
|
|
3821
3858
|
// exp: -> pyretnum
|
|
@@ -3829,13 +3866,13 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
3829
3866
|
|
|
3830
3867
|
// acos: -> pyretnum
|
|
3831
3868
|
// Produce the arc cosine.
|
|
3832
|
-
BigInteger.prototype.acos = function(
|
|
3869
|
+
BigInteger.prototype.acos = function(errbacks) {
|
|
3833
3870
|
return acos(this.toFixnum(), errbacks);
|
|
3834
3871
|
};
|
|
3835
3872
|
|
|
3836
3873
|
// asin: -> pyretnum
|
|
3837
3874
|
// Produce the arc sine.
|
|
3838
|
-
BigInteger.prototype.asin = function(
|
|
3875
|
+
BigInteger.prototype.asin = function(errbacks) {
|
|
3839
3876
|
return asin(this.toFixnum(), errbacks);
|
|
3840
3877
|
};
|
|
3841
3878
|
|
|
@@ -39867,6 +39867,8 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
39867
39867
|
// NB: all of these trig-gy generic functions should now return roughnum rather than float
|
|
39868
39868
|
// (except for an arg of 0, etc)
|
|
39869
39869
|
|
|
39870
|
+
var ln10 = Math.log(10)
|
|
39871
|
+
|
|
39870
39872
|
// log: pyretnum -> pyretnum
|
|
39871
39873
|
var log = function(n, errbacks) {
|
|
39872
39874
|
if ( eqv(n, 1, errbacks) ) {
|
|
@@ -39878,7 +39880,35 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
39878
39880
|
if (typeof(n) === 'number') {
|
|
39879
39881
|
return Roughnum.makeInstance(Math.log(n), errbacks);
|
|
39880
39882
|
}
|
|
39881
|
-
|
|
39883
|
+
var nFix = n.toFixnum();
|
|
39884
|
+
if (typeof(nFix) === 'number' && nFix !== Infinity) {
|
|
39885
|
+
return Roughnum.makeInstance(Math.log(nFix), errbacks);
|
|
39886
|
+
}
|
|
39887
|
+
// at this point, n must be a very large positive number;
|
|
39888
|
+
// n > 1e308, i.e, has at least 308 digits;
|
|
39889
|
+
// we can safely ignore its fractional part;
|
|
39890
|
+
var nStr = n.round(errbacks).toString();
|
|
39891
|
+
var nLen = nStr.length;
|
|
39892
|
+
// we furthermore need only the integer part's first few digits
|
|
39893
|
+
// although we must remember the number of digits ignored;
|
|
39894
|
+
var firstFewLen = 308; // has to be <= 308
|
|
39895
|
+
// say integer N = yyy...yyyxxx...xxx
|
|
39896
|
+
// where the number of x's is nx;
|
|
39897
|
+
// So N ~= yyy...yyy * 10^nx
|
|
39898
|
+
// We'll first find the common (base 10) log of N
|
|
39899
|
+
// log10(N) ~= log10(yyy...yyy * 10^nx)
|
|
39900
|
+
// = log10(yyy...yyy) + nx
|
|
39901
|
+
// Now to convert this to the natural log
|
|
39902
|
+
// ln(N) = log10(N) / log10(e)
|
|
39903
|
+
// = log10(N) * ln(10)
|
|
39904
|
+
// ~= [log10(yyy...yyy) + nx] * ln(10)
|
|
39905
|
+
// = log10(yyy...yyy) * ln(10) + nx * ln(10)
|
|
39906
|
+
// = ln(yyy...yyy) + nx * ln(10)
|
|
39907
|
+
// JS gives us ln(yyy...yyy) and ln(10) so we have a good
|
|
39908
|
+
// approximation for ln(N)
|
|
39909
|
+
var nFirstFew = parseInt(nStr.substring(0, firstFewLen));
|
|
39910
|
+
var nLog = Math.log(nFirstFew) + (nLen - firstFewLen) * ln10;
|
|
39911
|
+
return Roughnum.makeInstance(nLog, errbacks);
|
|
39882
39912
|
};
|
|
39883
39913
|
|
|
39884
39914
|
// tan: pyretnum -> pyretnum
|
|
@@ -41943,8 +41973,13 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
41943
41973
|
function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }
|
|
41944
41974
|
|
|
41945
41975
|
// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
|
|
41946
|
-
function bnpExp(e,z) {
|
|
41947
|
-
if(e
|
|
41976
|
+
function bnpExp(e, z, errbacks) {
|
|
41977
|
+
if (greaterThan(e, 0xffffffff, errbacks)) {
|
|
41978
|
+
errbacks.throwDomainError('expt: exponent ' + e + ' too large');
|
|
41979
|
+
}
|
|
41980
|
+
if (lessThan(e, 1, errbacks)) {
|
|
41981
|
+
return BigInteger.ONE;
|
|
41982
|
+
}
|
|
41948
41983
|
var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
|
|
41949
41984
|
g.copyTo(r);
|
|
41950
41985
|
while(--i >= 0) {
|
|
@@ -41956,10 +41991,10 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
41956
41991
|
}
|
|
41957
41992
|
|
|
41958
41993
|
// (public) this^e % m, 0 <= e < 2^32
|
|
41959
|
-
function bnModPowInt(e,m) {
|
|
41994
|
+
function bnModPowInt(e, m, errbacks) {
|
|
41960
41995
|
var z;
|
|
41961
41996
|
if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
|
|
41962
|
-
return this.bnpExp(e,z);
|
|
41997
|
+
return this.bnpExp(e, z, errbacks);
|
|
41963
41998
|
}
|
|
41964
41999
|
|
|
41965
42000
|
// protected
|
|
@@ -42328,7 +42363,9 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
42328
42363
|
NullExp.prototype.sqrTo = nSqrTo;
|
|
42329
42364
|
|
|
42330
42365
|
// (public) this^e
|
|
42331
|
-
function bnPow(e
|
|
42366
|
+
function bnPow(e, errbacks) {
|
|
42367
|
+
return this.bnpExp(e,new NullExp(), errbacks);
|
|
42368
|
+
}
|
|
42332
42369
|
|
|
42333
42370
|
// (protected) r = lower n words of "this * a", a.t <= n
|
|
42334
42371
|
// "this" should be the larger one if appropriate.
|
|
@@ -42828,48 +42865,48 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
42828
42865
|
|
|
42829
42866
|
// round: -> pyretnum
|
|
42830
42867
|
// Round to the nearest integer.
|
|
42831
|
-
BigInteger.prototype.round = function(
|
|
42868
|
+
BigInteger.prototype.round = function(errbacks) {
|
|
42832
42869
|
return this;
|
|
42833
42870
|
};
|
|
42834
42871
|
|
|
42835
|
-
BigInteger.prototype.roundEven = function(
|
|
42872
|
+
BigInteger.prototype.roundEven = function(errbacks) {
|
|
42836
42873
|
return this;
|
|
42837
42874
|
};
|
|
42838
42875
|
|
|
42839
42876
|
// log: -> pyretnum
|
|
42840
42877
|
// Produce the log.
|
|
42841
|
-
BigInteger.prototype.log = function(
|
|
42878
|
+
BigInteger.prototype.log = function(errbacks) {
|
|
42842
42879
|
return log(this.toFixnum(), errbacks);
|
|
42843
42880
|
};
|
|
42844
42881
|
|
|
42845
42882
|
// tan: -> pyretnum
|
|
42846
42883
|
// Produce the tan.
|
|
42847
|
-
BigInteger.prototype.tan = function(
|
|
42884
|
+
BigInteger.prototype.tan = function(errbacks) {
|
|
42848
42885
|
return tan(this.toFixnum(), errbacks);
|
|
42849
42886
|
};
|
|
42850
42887
|
|
|
42851
42888
|
// atan: -> pyretnum
|
|
42852
42889
|
// Produce the arc tangent.
|
|
42853
|
-
BigInteger.prototype.atan = function(
|
|
42890
|
+
BigInteger.prototype.atan = function(errbacks) {
|
|
42854
42891
|
return atan(this.toFixnum(), errbacks);
|
|
42855
42892
|
};
|
|
42856
42893
|
|
|
42857
42894
|
// cos: -> pyretnum
|
|
42858
42895
|
// Produce the cosine.
|
|
42859
|
-
BigInteger.prototype.cos = function(
|
|
42896
|
+
BigInteger.prototype.cos = function(errbacks) {
|
|
42860
42897
|
return cos(this.toFixnum(), errbacks);
|
|
42861
42898
|
};
|
|
42862
42899
|
|
|
42863
42900
|
// sin: -> pyretnum
|
|
42864
42901
|
// Produce the sine.
|
|
42865
|
-
BigInteger.prototype.sin = function(
|
|
42902
|
+
BigInteger.prototype.sin = function(errbacks) {
|
|
42866
42903
|
return sin(this.toFixnum(), errbacks);
|
|
42867
42904
|
};
|
|
42868
42905
|
|
|
42869
42906
|
// expt: pyretnum -> pyretnum
|
|
42870
42907
|
// Produce the power to the input.
|
|
42871
42908
|
BigInteger.prototype.expt = function(n, errbacks) {
|
|
42872
|
-
return bnPow.call(this, n);
|
|
42909
|
+
return bnPow.call(this, n, errbacks);
|
|
42873
42910
|
};
|
|
42874
42911
|
|
|
42875
42912
|
// exp: -> pyretnum
|
|
@@ -42883,13 +42920,13 @@ define("pyret-base/js/js-numbers", function() {
|
|
|
42883
42920
|
|
|
42884
42921
|
// acos: -> pyretnum
|
|
42885
42922
|
// Produce the arc cosine.
|
|
42886
|
-
BigInteger.prototype.acos = function(
|
|
42923
|
+
BigInteger.prototype.acos = function(errbacks) {
|
|
42887
42924
|
return acos(this.toFixnum(), errbacks);
|
|
42888
42925
|
};
|
|
42889
42926
|
|
|
42890
42927
|
// asin: -> pyretnum
|
|
42891
42928
|
// Produce the arc sine.
|
|
42892
|
-
BigInteger.prototype.asin = function(
|
|
42929
|
+
BigInteger.prototype.asin = function(errbacks) {
|
|
42893
42930
|
return asin(this.toFixnum(), errbacks);
|
|
42894
42931
|
};
|
|
42895
42932
|
|