You are Here: Home >< Maths

# What is the term to use which says print decimal places only if not zero

Announcements Posted on
Four hours left to win £100 of Amazon vouchers!! Don't miss out! Take our short survey to enter 24-10-2016
1. I have a programming problem where I need to print decimal digits if they are non-zero.

This after adding two numbers. Eg if the sum is 5 + 4 then only print 9.

If the sum is 5.7 + 4, then print 9.7

And if the sim is 7.1 + 3.222 then print 10.3222

Excel actually does this.

Is there a mathematical term to describe this truncating or process of displaying decimal digits?
2. (Original post by acomber)
I have a programming problem where I need to print decimal digits if they are non-zero.

This after adding two numbers. Eg if the sum is 5 + 4 then only print 9.

If the sum is 5.7 + 4, then print 9.7

And if the sim is 7.1 + 3.222 then print 10.3222

Excel actually does this.

Is there a mathematical term to describe this truncating or process of displaying decimal digits?
Suppress trailing decimal zeroes?

Best guess. It will be a computing term, rather than mathematical, per se, but I'm not aware of any standard.
3. I wondered if there was a term. In printf in C the %g format specifier does this.
4. (Original post by acomber)
I wondered if there was a term. In printf in C the %g format specifier does this.
"trailing zero(e)s" seems to be the general term. Some languages don't seem to have anything, and require code to perform this task - from a quick Google.

One should note that 1.00 implies a greater degree of accuracy than just 1.

## Register

Thanks for posting! You just need to create an account in order to submit the post
1. this can't be left blank
2. this can't be left blank
3. this can't be left blank

6 characters or longer with both numbers and letters is safer

4. this can't be left empty
1. Oops, you need to agree to our Ts&Cs to register

Updated: April 18, 2016
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Today on TSR

### Who is getting a uni offer this half term?

Find out which unis are hot off the mark here

Poll
Useful resources

### Maths Forum posting guidelines

Not sure where to post? Read here first

### How to use LaTex

Writing equations the easy way

### Study habits of A* students

Top tips from students who have already aced their exams