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 many significant digits do floats and doubles have in java?

Does a float have 32 binary digits and a double have 64 binary digits? The documentation was too hard to make sense …

java floating-point
Python: Converting string into decimal number

I have a python list with strings in this format: A1 = [' "29.0" ',' "65.2" ',' "75.2" '] How do I …

python string floating-point decimal
Meaning of delta or epsilon argument of assertEquals for double values

I have a question about JUnit assertEquals to test double values. Reading the API doc I can see: @Deprecated public …

java junit floating-point
Truncate (not round off) decimal numbers in javascript

I am trying to truncate decimal numbers to decimal places. Something like this: 5.467 -> 5.46 985.943 -> 985.94 toFixed(2) does just …

javascript floating-point floating-accuracy
Using floats with sprintf() in embedded C

Guys, I want to know if float variables can be used in sprintf() function. Like, if we write: sprintf(str,"…

c embedded floating-point printf
Converting a double to an int in Javascript without rounding

In C# the following code returns 2: double d = 2.9; int i = (int)d; Debug.WriteLine(i); In Javascript, however, the only …

javascript casting floating-point int
Why does changing 0.1f to 0 slow down performance by 10x?

Why does this bit of code, const float x[16] = { 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6}; const float z[16] = {1.123, 1.234, 1.345, 156.467, 1.578, 1.689, 1.790, 1.812, 1.923, 2.034, 2.145, 2.256, 2.367, 2.478, 2.589, 2.690}; float y[16]; for (int i = 0; i < 16; i++) { …

c++ performance visual-studio-2010 compilation floating-point
How to check that a string is parseable to a double?

Is there a native way (preferably without implementing your own method) to check that a string is parseable with Double.…

java string parsing floating-point
Converting a number with comma as decimal point to float

I have a list of prices with a comma for a decimal point and a dot as the thousand separator. …

php parsing floating-point
Float vs Decimal in ActiveRecord

Sometimes, Activerecord data types confuse me. Err, often. One of my eternal questions is, for a given case, Should I …

ruby-on-rails types floating-point decimal rails-activerecord