Top "Floating-accuracy" questions

Concerning the accuracy of operations performed on floating point numbers.

How to safely floor or ceil a CGFloat to int?

I often need to floor or ceil a CGFloat to an int, for calculation of an array index. The problem …

ios math floating-point floating-accuracy floating-point-precision
Large numbers erroneously rounded in JavaScript

See this code: When I see my console in Firefox 3.5, the value of jsonParsed is the number rounded: Object id=714341252076979100 …

javascript floating-point floating-accuracy ieee-754
Integer exponentiation in OCaml

Is there a function for integer exponentiation in OCaml? ** is only for floats. Although it seems to be mostly accurate, …

integer ocaml floating-accuracy exponentiation
negative zero in python

I encountered negative zero in output from python; it's created for example as follows: k = 0.0 print(-k) The output will …

python floating-point floating-accuracy zero
Manipulating and comparing floating points in java

In Java the floating point arithmetic is not represented precisely. For example this java code: float a = 1.2; float b= 3.0; float …

java floating-point floating-accuracy
How do I set the floating point precision in Perl?

Is there a way to set a Perl script's floating point precision (to 3 digits), without having to change it specifically …

perl floating-point floating-accuracy
Getting the decimal part of a double in Swift

I'm trying to separate the decimal and integer parts of a double in swift. I've tried a number of approaches …

swift math floating-accuracy
Java sum of all double does not return expected result

Possible Duplicate: Moving decimal places over in a double Why is the following sum of numbers not equal to 0.4622? but 0.46219999999999994 …

java sum double floating-accuracy decimalformat
Rounding Errors?

In my course, I am told: Continuous values are represented approximately in memory, and therefore computing with floats involves rounding …

java memory floating-accuracy
How to Java String.format with a variable precision?

I'd like to vary the precision of a double representation in a string I'm formatting based on user input. Right …

java string rounding precision floating-accuracy