Gang Of Coders
Home
About Us
Contact Us
All Floating Point Solutions on Gang of Coders
Total of 276 Floating Point Solutions
Is floating point math broken?
Math
Language Agnostic
Floating Point
Floating Accuracy
How do I parse a string to a float or int?
Python
Parsing
Floating Point
Type Conversion
Integer
Difference between decimal, float and double in .NET?
.Net
Floating Point
Double
Decimal
Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)?
Gcc
Assembly
Floating Point
Compiler Optimization
Fast Math
Limiting floats to two decimal points
Python
Floating Point
Rounding
Precision
How do I check if a string is a number (float)?
Python
Casting
Floating Point
Type Conversion
Why does changing 0.1f to 0 slow down performance by 10x?
C++
Performance
Visual Studio-2010
Compilation
Floating Point
Why not use Double or Float to represent currency?
Floating Point
Currency
Format number to always show 2 decimal places
Javascript
Floating Point
Number Formatting
Is there a float input type in HTML5?
Html
Input
Floating Point
How to use a decimal range() step value?
Python
Floating Point
Range
How can I force division to be floating point? Division keeps rounding down to 0?
Python
Floating Point
Integer
Division
Python 2.x
How to convert a Decimal to a Double in C#?
C#
Floating Point
Type Conversion
Double
Decimal
How to deal with floating point number precision in JavaScript?
Javascript
Floating Point
How do you round UP a number?
Python
Floating Point
Integer
Rounding
What is the most effective way for float and double comparison?
C++
Algorithm
Optimization
Floating Point
How to get a random number between a float range?
Python
Random
Floating Point
Why does Math.round(0.49999999999999994) return 1?
Java
Floating Point
Double
Rounding
How to nicely format floating numbers to string without unnecessary decimal 0's
Java
String
Floating Point
Format
Double
Correct format specifier for double in printf
C
Floating Point
Printf
Double
Format Specifiers
What is the difference between float and double?
C++
C
Floating Point
Precision
Ieee 754
How to parse float with two decimal places in javascript?
Javascript
Floating Point
How to format a float in javascript?
Javascript
Floating Point
What is the best way to compare floats for almost-equality in Python?
Python
Floating Point
JavaScript displaying a float to 2 decimal places
Javascript
Floating Point
Precision
How dangerous is it to compare floating point values?
Objective C
Ios
C
Floating Point
Floating Accuracy
How do I print a double value with full precision using cout?
C++
Floating Point
Precision
Iostream
Cout
How to convert float to int with Java
Java
Floating Point
Int
Double vs. BigDecimal?
Java
Floating Point
Double
Bigdecimal
What is the rationale for all comparisons returning false for IEEE754 NaN values?
Floating Point
Comparison
Nan
Ieee 754
Iec10967
Convert floats to ints in Pandas?
Python
Pandas
Floating Point
Integer
Dataset
Get decimal portion of a number with JavaScript
Javascript
Floating Point
Numbers
Decimal
Rounding
What does the constant 0.0039215689 represent?
C
Floating Point
Constants
Magic Numbers
Float vs Decimal in ActiveRecord
Ruby on-Rails
Types
Floating Point
Decimal
Rails Activerecord
What MySQL data type should be used for Latitude/Longitude with 8 decimal places?
Mysql
Types
Floating Point
Why does changing the sum order returns a different result?
Java
Javascript
Floating Point
Python JSON serialize a Decimal object
Python
Json
Floating Point
Decimal
Random float number generation
C++
Random
Floating Point
Why can't decimal numbers be represented exactly in binary?
Math
Floating Point
Why does NaN - NaN == 0.0 with the Intel C++ Compiler?
C++
C
Floating Point
Ieee 754
Icc
Make a float only show two decimal places
Objective C
Formatting
Floating Point
How to convert string into float in JavaScript?
Javascript
Parsing
Floating Point
How do I use floating-point arithmetic in bash?
Bash
Floating Point
Arithmetic Expressions
Why is division in Ruby returning an integer instead of decimal value?
Ruby
Math
Floating Point
Division
Integer Division
Why are these numbers not equal?
R
Floating Point
Floating Accuracy
R Faq
Why are some float < integer comparisons four times slower than others?
Python
Performance
Floating Point
Cpython
Python Internals
When should I use double instead of decimal?
C#
Types
Floating Point
Double
Decimal
When should I use the "strictfp" keyword in java?
Java
Floating Point
Strictfp
biggest integer that can be stored in a double
Types
Floating Point
Double
Ieee 754
Add floating point value to android resources/values
Android
Resources
Floating Point
How to check if a float value is a whole number
Python
Floating Point
Formatting a float to 2 decimal places
C#
Variables
Floating Point
Decimal
round() for float in C++
C++
Floating Point
Rounding
Can anyone explain this strange behavior with signed floats in C#?
C#
.Net
Floating Point
Float and double datatype in Java
Java
Floating Point
Double
Ieee 754
How do I restrict a float value to only two places after the decimal point in C?
C
Floating Point
Decimal
Why does Python's hash of infinity have the digits of π?
Python
Math
Hash
Floating Point
Pi
Why are floating point numbers inaccurate?
Floating Point
Language Agnostic
Precision
Formatting floats without trailing zeros
Python
Formatting
Floating Point
Pretty Print
Format / Suppress Scientific Notation from Pandas Aggregation Results
Python
Pandas
Floating Point
Scientific Notation
Number Formatting
Format Float to n decimal places
Java
Android
Floating Point
Numbers
Format
Using bitwise OR 0 to floor a number
Javascript
Floating Point
Bit Manipulation
Compare double to zero using epsilon
C++
Floating Point
Double
Meaning of delta or epsilon argument of assertEquals for double values
Java
Junit
Floating Point
How can I compare two floating point numbers in Bash?
Bash
Floating Point
Comparison
Numbers
How to suppress scientific notation when printing float values?
Python
Floating Point
Which is the first integer that an IEEE 754 float is incapable of representing exactly?
Types
Floating Point
Ieee 754
How to display a float with two decimal places?
Python
String
Floating Point
What does gcc's ffast-math actually do?
Performance
Math
Gcc
Floating Point
Fast Math
What's the difference between a single precision and double precision floating point operation?
Floating Point
Precision
Processor
Operations
How do you round a floating point number in Perl?
Perl
Floating Point
Rounding
Why is Double.MIN_VALUE in not negative
Java
Numbers
Floating Point
Compare floats in php
Php
Floating Point
Retain precision with double in Java
Java
Floating Point
Double
Precision
Convert floating point number to a certain precision, and then copy to string
Python
String
Floating Point
A fast method to round a double to a 32-bit int explained
C++
C
Performance
Floating Point
If I copy a float to another variable, will they be equal?
C++
Floating Point
How to get numbers after decimal point?
Python
Floating Point
Decimal
Why does the floating-point value of 4*0.1 look nice in Python 3 but 3*0.1 doesn't?
Python
Floating Point
Rounding
Floating Accuracy
Ieee 754
Why does Double.NaN==Double.NaN return false?
Java
Floating Point
Nan
Scjp
Ocpjp
Is floating-point math consistent in C#? Can it be?
C#
.Net
Floating Point
Precision
Ieee 754
'float' vs. 'double' precision
C
Floating Point
Why does adding 0.1 multiple times remain lossless?
Java
Floating Point
Double
Precision
Why is NaN not equal to NaN?
Floating Point
Language Agnostic
Nan
Ieee 754
Why doesn't C have unsigned floats?
C
Types
Floating Point
Format
Unsigned
How to handle floats and decimal separators with html5 input type number
Javascript
Jquery
Mobile
Floating Point
Html Input
Round a floating-point number down to the nearest integer?
Python
Floating Point
Integer
Rounding
PHP String to Float
Php
String
Casting
Floating Point
How to truncate float values?
Python
Floating Point
Cast to int vs floor
C++
C
Floating Point
C++: How to round a double to an int?
C++
Floating Point
Rounding
Printf width specifier to maintain precision of floating-point value
C
Floating Point
Printf
C99
Floating Point-Precision
round() doesn't seem to be rounding properly
Python
Floating Point
Rounding
How to extract a floating number from a string
Python
Regex
Floating Point
Data Extraction
Why can't I use float value as a template parameter?
C++
Templates
Generics
Floating Point
What is the difference between quiet NaN and signaling NaN?
Floating Point
Nan
Ieee 754
Is it possible to get 0 by subtracting two unequal floating point numbers?
Floating Point
Double
Floating Accuracy
Ieee 754
C# Float expression: strange behavior when casting the result float to int
C#
Casting
Floating Point
Int
Expression
Why does Clang optimize away x * 1.0 but NOT x + 0.0?
C++
C
Optimization
Floating Point
Clang
John Carmack's Unusual Fast Inverse Square Root (Quake III)
Algorithm
Floating Point
Square Root
Converting String To Float in C#
C#
.Net
String
Floating Point
Type Conversion
Format floats with standard json module
Python
Json
Formatting
Floating Point
Floating point vs integer calculations on modern hardware
C++
X86
Floating Point
X86 64
Dealing with float precision in Javascript
Javascript
Floating Point
Double
Floating Accuracy
Numerical Methods
Convert float to double without losing precision
Java
Floating Point
Double
Truncate (not round off) decimal numbers in javascript
Javascript
Floating Point
Floating Accuracy
What is float in Java?
Java
Floating Point
Swift - How to remove a decimal from a float if the decimal is equal to 0?
Ios
Swift
Floating Point
Easy pretty printing of floats?
Python
Printing
Formatting
Floating Point
Convert String to Float in Swift
String
Floating Point
Swift
String Parsing
Why is SSE scalar sqrt(x) slower than rsqrt(x) * x?
Performance
Assembly
Floating Point
X86
Sse
What's the difference between hard and soft floating point numbers?
C
Linux
Floating Point
Arm
Libc
In which order should floats be added to get the most precise result?
C++
Floating Point
Precision
Is it possible to write Quake's fast InvSqrt() function in Rust?
Rust
Floating Point
Sqrt
Type Punning
Fixed-size floating point types
C++
C
Boost
Floating Point
How to perform division in Go
Math
Go
Floating Point
Integer Division
Is it safe to check floating point values for equality to 0?
C#
.Net
Floating Point
Precision
Zero
"f" after number
Objective C
Floating Point
Convert float to string with precision & number of decimal digits specified?
C++
String
Floating Point
How should I do floating point comparison?
Language Agnostic
Comparison
Floating Point
Division of integers in Java
Java
Math
Floating Point
Long Integer
Println
What is a subnormal floating point number?
C++
C++11
Floating Point
Ieee 754
How to properly round-up half float numbers?
Python
Python 3.x
Floating Point
Rounding
Precision
Do any JVM's JIT compilers generate code that uses vectorized floating point instructions?
Java
Floating Point
Jit
Sse
Vectorization
Should I use double or float?
C++
Types
Floating Point
Double Precision
How many double numbers are there between 0.0 and 1.0?
Random
Floating Point
Double
Precision
JavaScript: Round to a number of decimal places, but strip extra zeros
Javascript
Math
Floating Point
Rounding
0.1 float is greater than 0.1 double. I expected it to be false
C++
C
Floating Point
Double
Rounding
C++ warning: division of double by zero
C++
Gcc
Floating Point
Divide by-Zero
Floating point division vs floating point multiplication
C++
Floating Point
Micro Optimization
C: printf a float value
C
Floating Point
ValueError: could not convert string to float: id
Python
String
Floating Point
How can I convert a string to a number in Perl?
String
Perl
Floating Point
Double to string conversion without scientific notation
C#
.Net
Floating Point
Number Formatting
Use of floating point in the Linux kernel
Linux
Floating Point
Linux Kernel
What's the closest double to 1.0, that isn't 1.0?
C++
Floating Point
Floating Accuracy
How can I convert integer into float in Java?
Java
Integer
Floating Point
PHP - Floating Number Precision
Php
Floating Point
Precision
Floating Accuracy
Why is the "f" required when declaring floats?
C#
Floating Point
Float sum with javascript
Javascript
Math
Floating Point
How can I improve performance via a high-level approach when implementing long equations in C++
C++
Performance
Optimization
Floating Point
G++
why f is placed after float values?
Java
Floating Point
Why can I assign 0.0 to enumeration values, but not 1.0
C#
Enums
Floating Point
Literals
Is this floating-point optimization allowed?
C++
Floating Point
Clang
Converting a float to a string without rounding it
Python
String
Floating Point
Rounding
How to find max value for Double and Float in Swift
Swift
Floating Point
Int
Double
Infinity
Converting a number with comma as decimal point to float
Php
Parsing
Floating Point
How to round a floating point number up to a certain decimal place?
Python
Floating Point
Binary representation of float in Python (bits not hex)
Python
Binary
Floating Point
Storing statistical data, do I need DECIMAL, FLOAT or DOUBLE?
Mysql
Floating Point
Double
Decimal
When I divide numbers in clojure I get a fraction , how do I get the decimal?
Math
Clojure
Floating Point
Numbers
How many significant digits do floats and doubles have in java?
Java
Floating Point
Double cast to unsigned int on Win32 is truncating to 2,147,483,648
C
Visual C++
Casting
X86
Floating Point
Convert Bytes to Floating Point Numbers?
Python
Floating Point
Generate a random float between 0 and 1
Ios
C
Random
Floating Point
Arc4random
Checking if float is an integer
C
Floating Point
Int
What range of numbers can be represented in a 16-, 32- and 64-bit IEEE-754 systems?
Floating Point
Precision
Numerical
Ieee 754
Objective-C - float checking for nan
Objective C
Floating Point
Nan
Floating point comparison functions for C#
C#
.Net
Floating Point
Python, print all floats to 2 decimal places in output
Python
Floating Point
String Formatting
How do I check if a zero is positive or negative?
Java
Floating Point
Zero
What is the difference between int() and floor() in Python 3?
Python
Python 3.x
Floating Point
Make C floating point literals float (rather than double)
C
Gcc
Floating Point
Literals
How do I type a floating point infinity literal in python
Python
Floating Point
Portability
Numerical
Why does adding two decimals in Javascript produce a wrong result?
Javascript
Math
Floating Point
Addition
Decimal
Converting a double to an int in Javascript without rounding
Javascript
Casting
Floating Point
Int
What's the use of suffix `f` on float value
C
Floating Point
Value for epsilon in Python
Python
Comparison
Floating Point
Epsilon
Convert String to Integer/Float in Haskell?
Haskell
Floating Point
Int
How to check that a string is parseable to a double?
Java
String
Parsing
Floating Point
Why do floating-point numbers have signed zeros?
Java
Floating Point
Zero
long double vs double
C++
Floating Point
Long Double
Comparing floating point number to zero
C++
Floating Point
Convert float to string in positional format (without scientific notation and false precision)
Python
Python 3.x
Floating Point
Number Formatting
Python 2.x
Is a whole number float divided by itself guaranteed to be 1.f?
C++
Floating Point
Argument order to std::min changes compiler output for floating-point
Android
C++
Assembly
X86
Floating Point
Large numbers erroneously rounded in JavaScript
Javascript
Floating Point
Floating Accuracy
Ieee 754
Why 0.1 + 0.2 == 0.3 in D?
Floating Point
Floating Accuracy
D
Constantfolding
Python float to int conversion
Python
Floating Point
Int
How do I convert Int/Decimal to float in C#?
C#
Casting
Floating Point
In MATLAB, are variables REALLY double-precision by default?
Variables
Matlab
Floating Point
Precision
Round a float up to the next integer in javascript
Javascript
Floating Point
Rounding
Interface Builder degrades storyboards, resizes and repositions views in small increments
Ios
Floating Point
Xcode6
Interface Builder
Retina Display
Function for 'does matrix contain value X?'
Matlab
Function
Matrix
Floating Point
Fastest way to do horizontal SSE vector sum (or other reduction)
Assembly
Optimization
Floating Point
Sse
Simd
Why do we have 0.0 and -0.0 in Ruby?
Ruby
Floating Point
Negative Zero
Why is Java's double/float Math.min() implemented this way?
Java
Floating Point
Why is 24.0000 not equal to 24.0000 in MATLAB?
Matlab
Floating Point
Precision
How can we truncate float64 type to a particular precision?
Floating Point
Go
Is (x - x) always positive zero for doubles, or sometimes negative zero?
Java
Floating Point
Why wasn't a specifier for `float` defined in `printf`?
C
Floating Point
Printf
C Standard-Library
Converting Float to Dollars and Cents
Python
Python 3.x
Floating Point
String Formatting
Currency
Formatting doubles for output in C#
C#
Formatting
Floating Point
Ieee 754
Python: Converting string into decimal number
Python
String
Floating Point
Decimal
Floating point comparison
C++
C
Floating Point
How to get the sign, mantissa and exponent of a floating point number
C
Floating Point
Emulation
How do I round a number in JavaScript?
Javascript
Floating Point
Numbers
Rounding
storing money amounts in mysql
Mysql
Floating Point
Currency
Fixed Point
Why does C# allow dividing a non-zero number by zero in floating-point type?
C#
Floating Point
Divide by-Zero
Can a near-zero floating value cause a divide-by-zero error?
C++
C
Floating Point
Divide by-Zero
Convert timedelta to floating-point
Python
Datetime
Python 2.7
Floating Point
Timedelta
What are some possible calculations with numpy or scipy that can return a NaN?
Python
Numpy
Floating Point
Nan
What is a "bias value" of floating-point numbers?
Floating Point
Why does the division of two integers return 0.0 in Java?
Java
Floating Point
Integer Division
Emulate "double" using 2 "float"s
C++
Algorithm
Floating Point
Precision
Double Double-Arithmetic
Random float number between 0 and 1.0 php
Php
Random
Floating Point
Integer
Why does MSVS not optimize away +0?
C
Floating Point
JSON standard - floating point numbers
Json
Floating Point
Standards
Exponent
What is the difference between casting to `float` and adding `f` as a suffix when initializing a `float`?
C
Casting
Floating Point
Adding smallest possible float to a float
C++
C++11
Floating Point
Why does double in C print fewer decimal digits than C++?
C++
C
Floating Point
Numbers
Precision
Round a float up to the next integer in objective C?
Objective C
Floating Point
Int
Unittest (sometimes) fails because floating-point imprecision
Python
Unit Testing
Floating Point
Why does a float variable stop incrementing at 16777216 in C#?
C#
Floating Point
Python: Find index of minimum item in list of floats
Python
List
Floating Point
Minimum
Floating Point-Precision
How to force GCC to assume that a floating-point expression is non-negative?
C++
Gcc
Assembly
Floating Point
Micro Optimization
How to extract the decimal part from a floating point number in C?
C
Floating Point
Decimal
Numbers
What is the maximum length in chars needed to represent any double value?
C++
C
Floating Point
double or float, which is faster?
C++
Floating Point
Double
In JavaScript, why does zero divided by zero return NaN, but any other divided by zero return Infinity?
Javascript
Math
Floating Point
Nan
Infinity
Will the scope of floating point variables affect their values?
C#
Floating Point
Set the display precision of a float in Ruby
Ruby
Floating Point
Precision
How to check whether input value is integer or float?
Java
Floating Point
Int
Rounding
Are the bit patterns of NaNs really hardware-dependent?
Java
Floating Point
Nan
Ieee 754
Function to determine if two numbers are nearly equal when rounded to n significant decimal digits
Python
Math
Floating Point
Numpy
How to properly compare decimal values in C#?
C#
Comparison
Floating Point
How to convert string to float?
C
Floating Point
Type Conversion
Atof
Strtod
Why can a floating point dictionary key overwrite an integer key with the same value?
Python
Python 2.7
Dictionary
Floating Point
Int
Why does Math.min() return -0 from [+0, 0, -0]
Javascript
Math
Floating Point
Min
Negative Zero
Numerically stable way to compute sqrt((b²*c²) / (1-c²)) for c in [-1, 1]
C++
Math
Floating Point
Numerical Stability
Best way to generate a random float in C#
C#
Random
Floating Point
negative zero in python
Python
Floating Point
Floating Accuracy
Zero
Java:Why should we use BigDecimal instead of Double in the real world?
Java
Floating Point
Double
Bigdecimal
How can a primitive float value be -0.0? What does that mean?
Java
Floating Point
regular expression for finding decimal/float numbers?
Javascript
Regex
Floating Point
Decimal
Will floating point operations on the JVM give the same results on all platforms?
Java
Floating Point
can't multiply sequence by non-int of type 'float'
Python
Floating Point
Sequence
Is floating point arbitrary precision available?
Python
Floating Point
Floating Accuracy
Round a double in Java
Java
Floating Point
How to perform a bitwise operation on floating point numbers
C++
Floating Point
Genetic Algorithm
Bitwise Operators
C++ floating point to integer type conversions
C++
Floating Point
Integer
Type Conversion
Typecast Operator
What do F and D mean at the end of numeric literals?
Java
Floating Point
Double
The behaviour of floating point division by zero
C++
Floating Point
Language Lawyer
Undefined Behavior
Divide by-Zero
Are doubles faster than floats in C#?
C#
Performance
Floating Point
Precision
Usefulness of signaling NaN?
C++
Visual C++
Floating Point
Ieee 754
X87
Is floating-point == ever OK?
C++
Comparison
Floating Point
round a floating-point number to the next integer value in java
Java
Integer
Floating Point
Rounding
Getting the actual, floating-point width of an element
Jquery
Css
Floating Point
Width
JSON unmarshaling with long numbers gives floating point number
Json
Floating Point
Go
Marshalling
How do I convert a float to an int in Objective C?
Objective C
Casting
Floating Point
How do I convert an array of floats to a byte[] and back?
C#
.Net
Floating Point
Bytearray
Endianness
numpy float: 10x slower than builtin in arithmetic operations?
Python
Performance
Numpy
Floating Point
Why does IEEE 754 reserve so many NaN values?
Floating Point
Nan
Ieee 754
Why are floating point infinities, unlike NaNs, equal?
Java
Floating Point
Comparison
Nan
Infinity
Java double comparison epsilon
Java
Floating Point
Currency
How can I write a power function myself?
C++
Math
Floating Point
Limit the amount of number shown after a decimal place in javascript
Javascript
Floating Point
Decimal
Limit
Casting a result to float in method returning float changes result
C#
.Net
.Net 4.0
Casting
Floating Point
How does this float square root approximation work?
C++
C
Optimization
Floating Point
Ieee 754
How to convert from float to bigDecimal in java?
Java
Floating Point
Bigdecimal
What is the difference between the float and integer data type when the size is the same?
Java
Floating Point
Integer
Is there any advantage to using pow(x,2) instead of x*x, with x double?
C++
Math
Floating Point
Is there a document describing how Clang handles excess floating-point precision?
C
Floating Point
Clang
C99
Extended Precision
Do std::min(0.0, 1.0) and std::max(0.0, 1.0) yield undefined behavior?
C++
Floating Point
Language Lawyer
Undefined Behavior
C++ Standard-Library
Check double variable if it contains an integer, and not floating point
C++
C
Floating Point
Extra leading zeros when printing float using printf?
C++
C
Floating Point
Formatting
Printf
Numeric comparison difficulty in R
R
Floating Point
Comparison
Comparison Operators
R Faq
How to print float to n decimal places including trailing 0s?
Python
Floating Point
Compressing floating point data
Compression
Floating Point
Time Series
Scala Divide two integers and get a float result
Scala
Casting
Floating Point
Integer
Double multiplied by 100 and then cast to long is giving wrong value
Java
Floating Point
Numbers
Floating point format for std::ostream
C++
Floating Point
Cout
Ostream
Python 3 Float Decimal Points/Precision
Python
Python 3.x
Floating Point
Why does JavaScript appear to be 4 times faster than C++?
Javascript
C++
Performance
Floating Point
Benchmarking
Shortest way of checking if Double is "NaN"
C#
.Net
Floating Point
Nonintuitive result of the assignment of a double precision number to an int variable in C
C
Floating Point
Type Conversion
Implicit Conversion