Open github-actions[bot] opened 11 months ago
[Numbers\prime?] not working for Web builds
https://github.com/arturo-lang/arturo/blob/411617a1906063cf0adfd3ac06804dc4b29403a0/src/library/Numbers.nim#L1458
processTrigonometric(tanh) #---------------------------- # Predicates #---------------------------- builtin "even?", alias = unaliased, op = opNop, rule = PrefixPrecedence, description = "check if given number is even", args = { "number" : {Integer} }, attrs = NoAttrs, returns = {Logical}, example = """ even? 4 ; => true even? 3 ; => false .......... print select 1..10 => even? ; 2 4 6 8 10 """: #======================================================= push(newLogical(x % I2 == I0)) builtin "infinite?", alias = unaliased, op = opNop, rule = PrefixPrecedence, description = "check whether given value is an infinite one", args = { "value" : {Any} }, attrs = NoAttrs, returns = {Logical}, example = """ infinite? 4 ; false infinite? infinite ; true infinite? ∞ ; true .......... a: infinite infinite? a ; true b: 0 infinite? b ; false """: #======================================================= if xKind == Floating and (x.f == Inf or x.f == NegInf): push(VTRUE) else: push(VFALSE) builtin "negative?", alias = unaliased, op = opNop, rule = PrefixPrecedence, description = "check if given number is negative", args = { "number" : {Integer,Floating,Complex,Rational} }, attrs = NoAttrs, returns = {Logical}, example = """ negative? 5 ; => false negative? 6-7 ; => true """: #======================================================= if xKind==Integer: if x.iKind==BigInteger: when defined(WEB): push(newLogical(x.bi < big(0))) elif not defined(NOGMP): push(newLogical(negative(x.bi))) else: push(newLogical(x < I0)) elif xKind==Floating: push(newLogical(x.f < 0.0)) elif xKind==Rational: push(newLogical(isNegative(x.rat))) elif xKind==Complex: push(newLogical(x.z.re < 0.0 or (x.z.re == 0.0 and x.z.im < 0.0))) builtin "odd?", alias = unaliased, op = opNop, rule = PrefixPrecedence, description = "check if given number is odd", args = { "number" : {Integer} }, attrs = NoAttrs, returns = {Logical}, example = """ odd? 4 ; => false odd? 3 ; => true .......... print select 1..10 => odd? ; 1 3 5 7 9 """: #======================================================= push(newLogical(x % I2 == I1)) builtin "positive?", alias = unaliased, op = opNop, rule = PrefixPrecedence, description = "check if given number is positive", args = { "number" : {Integer,Floating,Complex,Rational} }, attrs = NoAttrs, returns = {Logical}, example = """ positive? 5 ; => true positive? 6-7 ; => false """: #======================================================= if xKind==Integer: if x.iKind==BigInteger: when defined(WEB): push(newLogical(x.bi > big(0))) elif not defined(NOGMP): push(newLogical(positive(x.bi))) else: push(newLogical(x > I0)) elif xKind==Floating: push(newLogical(x.f > 0.0)) elif xKind==Rational: push(newLogical(isPositive(x.rat))) elif xKind==Complex: push(newLogical(x.z.re > 0.0 or (x.z.re == 0.0 and x.z.im > 0.0))) builtin "prime?", alias = unaliased, op = opNop, rule = PrefixPrecedence, description = "check if given integer is prime", args = { "number" : {Integer} }, attrs = NoAttrs, returns = {Logical}, example = """ prime? 2 ; => true prime? 6 ; => false prime? 11 ; => true .......... ; let's check the 14th Mersenne: ; 53113799281676709868958820655246862732959311772703192319944413 ; 82004035598608522427391625022652292856688893294862465010153465 ; 79337652707239409519978766587351943831270835393219031728127 prime? (2^607)-1 ; => true """: #======================================================= if x.iKind==NormalInteger: push(newLogical(isPrime(x.i.uint64))) else: # TODO(Numbers\prime?) not working for Web builds # labels: web,enhancement when not defined(NOGMP): push(newLogical(probablyPrime(x.bi,25)>0)) #---------------------------- # Constants #---------------------------- constant "epsilon", alias = unaliased, description = "the constant e, Euler's number": newFloating(E) constant "infinite", alias = infinite, description = "the IEEE floating point value of positive infinity": newFloating(Inf) constant "pi", alias = unaliased, description = "the number pi, mathematical constant": newFloating(PI) constant "tau", alias = unaliased, description = "the number tau, mathematical constant": newFloating(TAU) #======================================= # Add Library #======================================= Libraries.add(defineLibrary) ndex 28ff909a22..8fae7b5546 100644 ++ b/src/library/Paths.nim
94e75df81a96b0f98b4f02a80051da964ea36634
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
[Numbers\prime?] not working for Web builds
https://github.com/arturo-lang/arturo/blob/411617a1906063cf0adfd3ac06804dc4b29403a0/src/library/Numbers.nim#L1458
94e75df81a96b0f98b4f02a80051da964ea36634