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

Remove trailing zeros #221

Open
eng-ak opened this issue Sep 19, 2024 · 1 comment
Open

Remove trailing zeros #221

eng-ak opened this issue Sep 19, 2024 · 1 comment

Comments

@eng-ak
Copy link

eng-ak commented Sep 19, 2024

Hi Connor,

I posted this in forallpeople repo but after investigation and using pint as an alternative, the issue is still presist.
I am looking for a way to remove trailing zeros. I think the issue is in the formatter used in handcalcs.py latex_repr function()

def latex_repr(
    ...
    # Procedure for atomic data items
    try:
        if use_scientific_notation:
            rendered_string = f"{item:.{precision}e{preferred_formatter}}"
        else:
            rendered_string = f"{item:.{precision}f{preferred_formatter}}"

if .rstrip("0").rstrip(".") is used on rendered_string trailing zeros will be removed
Is there a way to automatically suppress trailing zeros?

Thank you

@av1dm
Copy link

av1dm commented Sep 26, 2024

Hi Connor,

I posted this in forallpeople repo but after investigation and using pint as an alternative, the issue is still presist. I am looking for a way to remove trailing zeros. I think the issue is in the formatter used in handcalcs.py latex_repr function()

def latex_repr(
    ...
    # Procedure for atomic data items
    try:
        if use_scientific_notation:
            rendered_string = f"{item:.{precision}e{preferred_formatter}}"
        else:
            rendered_string = f"{item:.{precision}f{preferred_formatter}}"

if .rstrip("0").rstrip(".") is used on rendered_string trailing zeros will be removed Is there a way to automatically suppress trailing zeros?

Thank you

#200 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants