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 restrict a float value to only two places after the decimal point in C?

How can I round a float value (such as 37.777779) to two decimal places (37.78) in C?

c floating-point decimal
Is there a float input type in HTML5?

According to html5.org, the "number" input type's "value attribute, if specified and not empty, must have a value that …

html input floating-point
How can I force division to be floating point? Division keeps rounding down to 0?

I have two integer values a and b, but I need their ratio in floating point. I know that a &…

python floating-point integer division python-2.x
How to convert float to int with Java

I used the following line to convert float to int, but it's not as accurate as I'd like: float a=8.61…

java floating-point int
How to parse float with two decimal places in javascript?

I have the following code. I would like to have it such that if price_result equals an integer, let's …

javascript floating-point
How to nicely format floating numbers to String without unnecessary decimal 0?

An 64-bit double can represent integer +/- 253 exactly Given this fact I choose to use a double type as a …

java string floating-point format double
Convert floats to ints in Pandas?

I've been working with data imported from a CSV. Pandas changed some columns to float, so now the numbers in …

python pandas floating-point integer dataset
Converting String To Float in C#

I am converting a string like "41.00027357629127", and I am using; Convert.ToSingle("41.00027357629127"); or float.Parse("41.00027357629127"); These methods return 4.10002732E+15. When …

c# .net string floating-point type-conversion
C: printf a float value

I want to print a float value which has 2 integer digits and 6 decimal digits after the comma. If I just …

c floating-point
'float' vs. 'double' precision

The code float x = 3.141592653589793238; double z = 3.141592653589793238; printf("x=%f\n", x); printf("z=%f\n", z); printf("x=%20.18f\n", …

c floating-point