decimal question
-
I want to have the number as ##9.9 only if there is a decimal point but if it's 0 then it should be ##0? at the same time I want to round to upper so it should 57.3 if it's 57.3 but it should be 58 if it's 57.6
-
I want to have the number as ##9.9 only if there is a decimal point but if it's 0 then it should be ##0? at the same time I want to round to upper so it should 57.3 if it's 57.3 but it should be 58 if it's 57.6
That isn't easy, mostly because your requirements conflict: How should 59.9 be printed? Your first requirement says "59.9", but your rounding says it should be 60. Decide exactly what you want to do, and try again! :laugh:
I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.
-
I want to have the number as ##9.9 only if there is a decimal point but if it's 0 then it should be ##0? at the same time I want to round to upper so it should 57.3 if it's 57.3 but it should be 58 if it's 57.6
-
I want to have the number as ##9.9 only if there is a decimal point but if it's 0 then it should be ##0? at the same time I want to round to upper so it should 57.3 if it's 57.3 but it should be 58 if it's 57.6
if your formatting isn't one of the built-in ones, just write a method ("MyToString()") that formats it any way you like; and don't hesitate to use as many statements as you need to get it done. Then use your method everywhere it applies. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).