Top "Rounding" questions

Rounding a numerical value means replacing it by another value that is approximately equal but has a shorter, simpler, or more explicit representation.

How to check whether input value is integer or float?

How to check whether input value is integer or float? Suppose 312/100=3.12 Here i need check whether 3.12 is a float value …

java floating-point int rounding
How can I round a number in JavaScript? .toFixed() returns a string?

Am I missing something here? var someNumber = 123.456; someNumber = someNumber.toFixed(2); alert(typeof(someNumber)); //alerts string Why does .toFixed() return a …

javascript types rounding
How do I round a float upwards to the nearest int in C#?

In C#, how do I round a float upwards to the nearest int? I see Math.Ceiling and Math.Round, …

c# .net rounding
How to round the minute of a datetime object

I have a datetime object produced using strptime(). >>> tm datetime.datetime(2010, 6, 10, 3, 56, 23) What I need to do is …

python datetime rounding
How to pad a string with leading zeros in Python 3

I'm trying to make length = 001 in Python 3 but whenever I try to print it out it truncates the value without …

python python-3.x math rounding
Truncate/round whole number in JavaScript?

For a script I'm writing, I need display a number that has been rounded, but not the decimal or anything …

javascript decimal rounding
How to round up a number to nearest 10?

How can we round off a number to the nearest 10 in php? Say I have 23, what code would I use …

php rounding
Python - round up to the nearest ten

If I get the number 46 and I want to round up to the nearest ten. How do can I do …

python rounding
How to make rounded percentages add up to 100%

Consider the four percentages below, represented as float numbers: 13.626332% 47.989636% 9.596008% 28.788024% ----------- 100.000000% I need to represent these percentages as whole numbers. If …

algorithm math rounding percentage
Rounding numbers in Objective-C

I'm trying to do some number rounding and conversion to a string to enhance the output in an Objective-C program. …

objective-c cocoa macos formatting rounding