Code Monkey home page Code Monkey logo

mathexprcalculatorjava's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m @MarcellPerger1
  • ๐Ÿ‘€ Iโ€™m interested in programming, maths and chess โ™Ÿ
  • ๐ŸŒฑ Iโ€™m currently learning Java
  • ๐Ÿ’ž๏ธ Iโ€™m looking to collaborate on ...
  • ๐Ÿ“ซ How to reach me: [email protected]
  • StackOverflow: MarcellPerger

mathexprcalculatorjava's People

Contributors

marcellperger1 avatar

Watchers

 avatar

mathexprcalculatorjava's Issues

[parser] Add support for the minus (`-`) prefix operator

Add support for - as a prefix operator (e.g. -(1+2)). There is currently support for it but only as a part of a literal.
So currently this is allowed:

-1 + 2
2--1
4*-2*(-1/-2)

And this is not:

-(1+1)
--2*2

And this is interpreted incorrectly:

-1**2  # Gives 1.0 ((-1)**2), should give -1.0 (-(1**2))

So we need to:

  • Add code for the prefix operator - (** < precedence < */)
  • TODO: need to add some special cases to ensure that 2**-1 and 2**-3**-2. Python does this using:
    prefixop = '-' power | '+' power | ...
    power = primary '**' prefixop
    primary = ... | '(' ... ')' | ...
    

Add a CLI

Add a CLI something like this:

$ mathexpr '2. + 2.3 * 1.8 ** 2 / .9'
20.28

with extra options like rounding (-R?), interactive (-i)

Add an interactive mode/shell

Add an interactive mode/shell like this:

>? 2. + 2.3 * 1.8 ** 2 / .9
10.28

Maybe round the result to 12 sf to avoid FP issues.

[test] [coverage] Upload coverage output to github pages

Upload coverage output to github pages to make it easier to view where the missed lines are.
The output directory for JaCoCo coverage is target/site/jacoco.

Potential problems:

  • How to keep different PRs separate?
  • Use a workflow or a gh-pages branch?

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.