Top "Floating-point" questions

Floating point numbers are approximations of real numbers that can represent larger ranges than integers but use the same amount of memory, at the cost of lower precision.

How do I parse a string to a float or int?

In Python, how can I parse a numeric string like "545.2222" to its corresponding float value, 545.2222? Or parse the string "31" to …

python parsing floating-point type-conversion integer
Limiting floats to two decimal points

I want a to be rounded to 13.95. >>> a 13.949999999999999 >>> round(a, 2) 13.949999999999999 The round function does …

python floating-point rounding precision
How do I check if a string is a number (float)?

What is the best possible way to check if a string can be represented as a number in Python? The …

python casting floating-point type-conversion
Format number to always show 2 decimal places

I would like to format my numbers to always display 2 decimal places, rounding where applicable. Examples: number display ------ ------- 1 1.00 1.341 1.34 1.345 1.35 …

javascript floating-point number-formatting
Correct format specifier for double in printf

What is the correct format specifier for double in printf? Is it %f or is it %lf? I believe it's %…

c floating-point printf double format-specifiers
What is the difference between float and double?

I've read about the difference between double precision and single precision. However, in most cases, float and double seem to …

c++ c floating-point precision
Difference between decimal, float and double in .NET?

What is the difference between decimal, float and double in .NET? When would someone use one of these?

.net floating-point double decimal
How do you round UP a number in Python?

This problem is killing me. How does one roundup a number UP in Python? I tried round(number) but it …

python floating-point integer rounding python-2.x
ValueError: could not convert string to float: id

I'm running the following python script: #!/usr/bin/python import os,sys from scipy import stats import numpy as np …

python string floating-point
How to use a decimal range() step value?

Is there a way to step between 0 and 1 by 0.1? I thought I could do it like the following, but it …

python floating-point range