Comments (13)
Ok I can do that for you. That change will probably be in 1.1.1 release.
from bigdecimal.js.
You can always open a pr to any repository as I know. You just need to fork the repository and then create your branch there.
Unfortunately, I have finalized my fix see #25. It includes an optimization too. Using BigInt constructors seemed to degrade performance of abs and compare functions, I solved the issue by caching some BigInts. Of course, I appreciate contributions but I saw your message too late for this one. Sorry :)
from bigdecimal.js.
1.1.1 is released https://www.npmjs.com/package/bigdecimal.js/v/1.1.1
from bigdecimal.js.
I think I found the issue. It has to do with 1n
and numbers like that: https://github.com/srknzl/bigdecimal.js/blob/main/src/bigdecimal.ts#L3638
from bigdecimal.js.
Investigating, thanks for the issue.
from bigdecimal.js.
BigInt literals like 1n are supported in 16.13.0 as you can see from https://node.green/#ES2020-features-BigInt-basic-functionality I can clone and run your example in your library with Node 16.13.
Obviously, this library requires a JS runtime that has BigInt. Also, this library is intended to be used with Node.js. When using react native, runtime is not nodejs anymore.
It looks like react native's runtime (as I understand JavaScriptCore and maybe something else on android) does not have BigInt support yet. Check out:
https://forum.dfinity.org/t/cant-find-variable-bigint-in-expo-react-native/5706
and
Looks like you can import and inject big-integer library as BigInt in your shim.js if BigInt does not exist in your react native runtime. Check out https://github.com/Balanced02/BigIntIssue for an example project.
from bigdecimal.js.
I suggest you to use big.js or other bigdecimal libraries if you need bigdecimal feature in environments where BigInt does not exist. My library's difference from big.js is the usage of BigInt and better performance for most operations due to that. Thank you for your understanding.
from bigdecimal.js.
I used the BigInt shim and it worked perfectly. I tested big ints in Android and it was all good. Sadly, it doesn't polyfill the literal. So I think if your library used BigInt(1)
instead of 1n
, it would work. I could try patching that in your library actually.
from bigdecimal.js.
Woohoo :) Thanks.
from bigdecimal.js.
I'm testing out the patch this morning on my library too. I'll report back shortly.
from bigdecimal.js.
I can confirm it works now. Not using a bigint literal and polyfilling BigInt
with this is the solution.
import BigInt from 'big-integer';
if (typeof global.BigInt === 'undefined') {
global.BigInt = BigInt;
}
from bigdecimal.js.
I have a branch ready to go, if you want. I'd love to contribute to this library :) I think you just need to enable access for me to open a pull request.
from bigdecimal.js.
Wow, that's awesome. It looks like it actually increased the performance a decent amount. Happy it worked it out :) Thanks for your help.
from bigdecimal.js.
Related Issues (9)
- ES Modules HOT 2
- Add markdown link checker to avoid broken links HOT 4
- Fix doc
- Big(1).divideWithMathContext(Big(3), new MC(0, RoundingMode.CEILING)).numberValue() HOT 2
- Extends API to support compareTo aliases (===, >, >=, etc...) HOT 5
- Make `add`, `subtract`, `multiply`, `divide` & `compareTo` handle `any` HOT 2
- Create a bigdecimal-light.js HOT 4
- "Can't find variable: BigInt" error thrown on Safari 13 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bigdecimal.js.