GithubHelp home page GithubHelp logo

Comments (2)

wader avatar wader commented on May 26, 2024

I wonder if we should ask the gojq author what he thinks of decimal support. He has already extended from original jq to support arbitrarily precision so maybe he has some ideas. Would be nice to not have too much difference compared to upstream.

btw any idea if big.Rat from standard library would be ok also?

from fq.

matthewdale avatar matthewdale commented on May 26, 2024

Good idea, I opened an issue on gojq requesting support for arbitrary precision non-integer decimal values: itchyny/gojq#216

I believe big.Rat can represent all numbers that shopspring/decimal can represent and seems to support the required arithmetic operations (except modulus, which would probably be accomplished by truncating the big.Rat to a big.Int and using that to calculate modulus). The main difficulty with big.Rat in the context of fq is that to get a decimal-with-radix representation (i.e. "123.4" instead of "1234/10") you use FloatString, which requires you to specify (and keep track of) the required number of digits of precision yourself. It's worth an experiment to validate if it's possible.

from fq.

Related Issues (20)

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.