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 print a double value with full precision using cout?

So I've gotten the answer to my last question (I don't know why I didn't think of that). I was …

c++ floating-point precision iostream cout
How to format a float in javascript?

In JavaScript, when converting from a float to a string, how can I get just 2 digits after the decimal point? …

javascript floating-point
What is the most effective way for float and double comparison?

What would be the most efficient way to compare two double or two float values? Simply doing this is not …

c++ algorithm optimization floating-point
How to convert string into float in JavaScript?

I am trying to parse two values from a datagrid. The fields are numeric, and when they have a comma (…

javascript parsing floating-point
Converting a float to a string without rounding it

I'm making a program that, for reasons not needed to be explained, requires a float to be converted into a …

python string floating-point rounding
Formatting a float to 2 decimal places

I am currently building a sales module for a clients website. So far I have got the sale price to …

c# variables floating-point decimal
Random float number generation

How do I generate random floats in C++? I thought I could take the integer rand and divide it by …

c++ random floating-point
How to deal with floating point number precision in JavaScript?

I have the following dummy test script: This will print the result 0.020000000000000004 while it should just print 0.02 (if you use …

javascript floating-point
How to get a random number between a float range?

randrange(start, stop) only takes integer arguments. So how would I get a random number between two float values?

python random floating-point
What is float in Java?

I wrote this code: float b = 3.6; and I get this: Error:Unresolved compilation problem: Type mismatch: cannot convert from double …

java floating-point