Top "Floating-accuracy" questions

Concerning the accuracy of operations performed on floating point numbers.

Truncate float numbers with PHP

When a float number needs to be truncated to a certain digit after the floating point, it turns out that …

php floating-point truncate floating-accuracy
What is the standard solution in JavaScript for handling big numbers (BigNum)?

Is there a bignum library for JavaScript or built-in that I can include like <script type="text/javascript" src="…

javascript floating-accuracy bignum
Floating point formatting in printf()

I have an array of floats where data are stored with varying decimal points so some are 123.40000, 123.45000, 123.45600...now if i …

c floating-point floating-accuracy
Why are these numbers not equal?

The following code is obviously wrong. What's the problem? i <- 0.1 i <- i + 0.05 i ## [1] 0.15 if(i==0.15) cat("…

r floating-point floating-accuracy r-faq
How to correctly and standardly compare floats?

Every time I start a new project and when I need to compare some float or double variables I write …

c++ floating-point floating-accuracy double-precision
PHP - Floating Number Precision

$a = '35'; $b = '-34.99'; echo ($a + $b); Results in 0.009999999999998 What is up with that? I wondered why my …

php floating-point precision floating-accuracy
How to get bc to handle numbers in scientific (aka exponential) notation?

bc doesn't like numbers expressed in scientific notation (aka exponential notation). $ echo "3.1e1*2" | bc -l (standard_in) 1: parse error but …

bash numeric floating-accuracy bc
What is a simple example of floating point/rounding error?

I've heard of "error" when using floating point variables. Now I'm trying to solve this puzzle and I think I'm …

c++ floating-accuracy
Floating point equality and tolerances

Comparing two floating point number by something like a_float == b_float is looking for trouble since a_float / 3.0 * 3.0 might …

c++ c floating-point floating-accuracy
PI and accuracy of a floating-point number

A single/double/extended-precision floating-point representation of Pi is accurate up to how many decimal places?

floating-point precision floating-accuracy