Giter Site home page Giter Site logo

ttulka / as-big Goto Github PK

View Code? Open in Web Editor NEW
37.0 3.0 1.0 705 KB

AssemblyScript library for arbitrary-precision decimal arithmetic

License: MIT License

TypeScript 3.84% JavaScript 96.16%
assemblyscript math decimal float big numer bigdecimal bigfloat bignumber precision

as-big's Issues

Is it ready to production?

Hi. Great work @ttulka!

Until we have a native decimal type in JS it seems as-big is the best option I found to our financial (in production) applications.

So we'd like to know in what scenarios as-big has been used and if it has been used in production env.

Thanks!

Is it possible to run directly in javascript?

I'm new to webassembly and I have a question about using the lib.

I read your journey of learning webassembly, but I have a question about the possibility of calling the lib after compiled in javascript

inside index.ts:

import { basics0, basics1, basics2, basics3 } from './basics';
import Big from 'as-big/Big';

export { 
    basics0, basics1, basics2, basics3, 
    Big
};

inside index.js

const fs = require("fs");
const loader = require("@assemblyscript/loader");
const wasm = loader.instantiateSync(fs.readFileSync(__dirname + "/build/optimized.wasm"), {});
module.exports = wasm.exports;

const { __getString } = wasm.exports;

console.log('ONE #0:', wasm.exports.Big.ONE);

Every function calling as-big must be inside assembly folder and compiled?

Thanks a lot

different value in toString on big decimal numbers

I am implementing some math algorithms in assembly script to use as module in node JS.

In some cases, when I try to parse Big to number() o just use the method toF64, it return the fallowing message.
image
and when I try to make an conversion to String the method return an completely different number, like 39264 , what I had no idea the reason.

I also try do debug line to line in visual studio code do catch the error, but I had no success to configure the debugger for it, can you exemplify how to?

`cmp` is used before being assigned assembly script >= 0.25.0

Starting with assembly script 0.25.0, the build fails with the following error:

ERROR TS2454: Variable 'cmp' is used before being assigned.
     :
 676 │ qc[qi++] = cmp ? n : ++n;
     │            ~~~
     └─ in ~lib/as-big/assembly/Big.ts(676,24)

ERROR TS2454: Variable 'cmp' is used before being assigned.
     :
 679 │ if (unchecked(r[0]) && cmp) r[rl] = a.length > ai ? unchecked(a[ai]) : 0;
     │                        ~~~
     └─ in ~lib/as-big/assembly/Big.ts(679,36)

FAILURE 2 compile error(s)

It builds correctly with assembly script 0.24.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.