Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trimTrailingZeros and negative numbers #12

Closed
danilort opened this issue Dec 25, 2021 · 2 comments
Closed

trimTrailingZeros and negative numbers #12

danilort opened this issue Dec 25, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@danilort
Copy link

Qalc 0.1.8
(I love this extension)

Using these settings:

"qalc.output.trimTrailingZeros": true
"qalc.output.precision": 4

The negative numbers ignore the option trimTrailingZeros:

immagine

Thank's for your job!

@danilort
Copy link
Author

I suggest to modify the file out/formatter.js:

if (formatterSettings.trimTrailingZeros) {
    // Make sure there is a decimal value
    if (/^\d+\.\d+$/.test(output)) {
        output = output.replace(/0+$/, '');
    }
    .............

to allow the "-" character:

if (/^-?\d+\.\d+$/.test(output))  {

@nortakales nortakales added the bug Something isn't working label Feb 17, 2022
@nortakales
Copy link
Owner

Fixed in Qalc 0.1.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants