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.

round() doesn't seem to be rounding properly

The documentation for the round() function states that you pass it a number, and the positions past the decimal to …

python floating-point rounding
Python JSON serialize a Decimal object

I have a Decimal('3.9') as part of an object, and wish to encode this to a JSON string …

python json floating-point decimal
How to extract the decimal part from a floating point number in C?

How can we extract the decimal part of a floating point number and store the decimal part and the integer …

c floating-point decimal numbers
How to handle floats and decimal separators with html5 input type number

Im building web app which is mainly for mobile browsers. Im using input fields with number type, so (most) mobile …

javascript jquery mobile floating-point html-input
How to extract a floating number from a string

I have a number of strings similar to Current Level: 13.4 db. and I would like to extract just the floating …

python regex floating-point data-extraction
How to convert string to float?

#include<stdio.h> #include<string.h> int main() { char s[100] ="4.0800" ; printf("float value : %4.8f\n" ,(float) …

c floating-point type-conversion atof strtod
Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)?

I am doing some numerical optimization on a scientific application. One thing I noticed is that GCC will optimize the …

gcc assembly floating-point compiler-optimization fast-math
Retain precision with double in Java

public class doublePrecision { public static void main(String[] args) { double total = 0; total += 5.6; total += 5.8; System.out.println(total); } } The above code …

java floating-point double precision
Division of integers in Java

This is a basic question but I can't find an answer. I've looked into floating point arithmetic and a few …

java math floating-point long-integer println
What MySQL data type should be used for Latitude/Longitude with 8 decimal places?

I'm working with map data, and the Latitude/Longitude extends to 8 decimal places. For example: Latitude 40.71727401 Longitude -74.00898606 I saw …

mysql types floating-point