Is there a way to round double variables to a specified number of significant figures?

Printable View

- 09-18-2013, 09:15 PMZelaineRounding Numbers
Is there a way to round double variables to a specified number of significant figures?

- 09-18-2013, 09:40 PMKevinWorkmanRe: Rounding Numbers
Yes.

What have you tried? - 09-18-2013, 09:45 PMgimbal2Re: Rounding Numbers
Why do you ask? Yes is the answer to the question asked. If another answer was expected, another question should have been asked.

- 09-18-2013, 09:46 PMjim829Re: Rounding Numbers
Do you really want to round them or just display them with limited precision?

Regards,

Jim - 09-18-2013, 11:08 PMZelaineRe: Rounding Numbers
I have tried rounding doubles to integers but that was obviously not satisfactory :P I want to display them with limited precision, for example if I have the number 1 I want to be able to output more significant figures than necessary, like 1.00000, but also to round numbers like 1.75634234 to a specific significant figure, for example to the third significant figure, 1.756. Do you understand what I mean? xD Sorry if it's a bit unclear...

- 09-19-2013, 04:00 AMJunkyRe: Rounding Numbers
DecimalFormat