Git Product home page Git Product logo

Comments (3)

stokito avatar stokito commented on June 28, 2024 3

Nice idea. Lets think more. I have this thought that might be useful to get right decision:

  • With B personally I have first association like "Boolean" of "Binary" and even BTC (BitCoin) since I working a lot with financial systems.
  • 0b - is already used in Groovy as binary literal
  • Is anything special with symbol usage? I mean does already used somewhere in context of big numbers?
  • I even don't like Big class names BigDecimal and BigInteger. I think it's wrong to call something "big" or "short". For me correct name is something like Real as used in mathematics notation. But it's not real "Real" since only 10 based number which is bad for precision.
  • Yes, you right that G literal is something strange counter intuitive and yes it has strict association with unit prefixes "giga".
  • So, why authors of Groovy chose G instead of B? I found their discussion and in short "There is a potential conflict with Hexidecimal literals and the numeric suffixes B". So for some reason they decided to use G (probably because biG). Also it was proposed to use M prefix as in C# but was rejected since "doesn't seem intuitive for BigInteger".
  • Also .NET languages use M prefix for decimal which mean like "Money". Actually decimal is fixed size 128 bit so not exactly the same as BigDecimal.
  • Also Stephen Colebourne known as author of JavaTime proposed to use N prefix. In comments also was proposed T as "Ten based number".

So it becomes hard to choice literal. But actually should we? Literals are needed to make your life easier when you write a code. But in your plugin you need to show the code. So I would like to propose you just to show BidDecimal and BigInteger as usual number:

new BigDecimal("1.0005").add(new BigDecimal(42.42))

is shown as:

1.0005 + 42.42

What do you think about this?

from advancedexpressionfolding.

petteyg avatar petteyg commented on June 28, 2024

While I usually dislike inventing new syntax when a working one already exists, G makes me think "giga", not "big". I'd rather see \u1e04, capital B with dot below (think B decimal).

from advancedexpressionfolding.

cheptsov avatar cheptsov commented on June 28, 2024

The latest EAP build supports basic things like

new BigDecimal("1.0005").add(new BigDecimal(42.42))

More complicated case are to be supported later:

new BigDecimal("1.0005").add(new BigDecimal(42.42)).multiply(new BigDecimal(1.0))

from advancedexpressionfolding.

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.