Share Your Experience: Take the 2024 Developer Survey

# Tag Info

Accepted

### A function to convert 0-2000 milliseconds to a double representing a fraction of a second

random garbage in initial word // fakeDouble is expected to be {0, 0} This is insanity. The code needs to implement this comment. Either ...
• 27.6k

### A function to convert 0-2000 milliseconds to a double representing a fraction of a second

Code fails every time With ms == 0, code can return a non-zero fake double due to unassigned fakeDouble[]. Non-zero ...

### A function to convert 0-2000 milliseconds to a double representing a fraction of a second

Missing header uint32_t is not defined - we need to include <stdint.h> for this to compile. Unit tests The tests are ...
• 75.9k
Accepted

### An is_integer Template Function Implementation in C++

This is wrong for several reasons. What do you mean by "is an integer"? There are many ways to interpret the assertion that some number "is an integer". Do you mean it's an integer ...
• 57.1k

### Computing the square root of a 64-bit integer

Your code is OK for prime sieving. If the rounding mode is nearest-ties-to-even and std::sqrt is correctly rounded (as required by IEEE 754), your code returns \\$\...
• 161
Accepted

### Calculate the maximum number of decimal places with which all floating point numbers can be represented in a range in C++

Precision vs digits While the decimal representation of a floating point number might result in a certain number of digits, that's not the same as the precision of the floating point number itself. ...
• 57.1k
Accepted

### Solving round number in JS by using String

document the return value round(number, decimalsLength) { The name suggests something similar to this documented function: Math.round() The Math.round() static ...
• 27.6k

### An is_integer Template Function Implementation in C++

The tests miss most of the important cases The tests only consider a small range of inputs. In particular, we're not testing any of the following possible inputs: doubles with zero fractional part: <...
• 75.9k

### Demonstrate effects of summation order

Tree pairwise can be written in a more functional style The "tree pairwise" function can be rewritten to use ranges and views to get the same result, avoiding the need to deal with two ...
• 57.1k

### Demonstrate effects of summation order

I found it amusing to sweep through multiple affine transforms. With denominators of 11 and 17 we see identical error in both ...
• 27.6k
1 vote

### Solving round number in JS by using String

Questionable goal Code suffers from/abuses double rounding. Javascript numbers use binary64 encoding. That provides about 1019 different values. 10.395 is not one of them as it is not a dyadic ...
1 vote

### Computing the square root of a 64-bit integer

An alterative to risking floating point issues is to perform an integer based square root: C based code ...

Only top scored, non community-wiki answers of a minimum length are eligible