Skip to main content

Questions tagged [floating-point]

For questions with concerns specifically related to the usage of floating point, such as accuracy and precision of calculations, handling of 0, infinity, and over/underflow, input/output, and binary representation. Not for code that casually happens to use floating point.

6 votes
1 answer
342 views

This is a library I've been writing, for now named ALFPN, for converting between native floats and layouts that are not native - half, various 8-bit formats etc. ...
herhor67's user avatar
8 votes
1 answer
553 views

I have written a C program to compute values of the Hardy Z function, \$Z(t)\$. The Hardy Z function is a continuous, real-valued function that takes a positive real number \$t\$ as its input and ...
TMurphy's user avatar
  • 183
3 votes
2 answers
150 views

This is a simple function that accepts a null-terminated string that represents a non-negative number of seconds. It can optionally end in the suffix "s" (seconds, default), "m" (...
xiazhu's user avatar
  • 39
6 votes
2 answers
125 views

I originally premiered this code to the internet in this StackOverflow post, and per a recommendation through one of the comments, I am reposting it here. I am making a floating-point number set ...
Xavier Pedraza's user avatar
6 votes
2 answers
479 views

When we add lots of floating-point values, we can lose precision if we blindly use std::accumulate() or similar, when the running total becomes much larger than the ...
Toby Speight's user avatar
  • 88.7k
3 votes
1 answer
268 views

I'm looking for a function in C++ that can determine, how accurate all floating point numbers in a given range can be represented as strings, without the use of e.g. boost library, etc. Please take a ...
Tobias Grothe's user avatar
5 votes
2 answers
355 views

I am trying to make an is_integer template function to determine a number is an integer or not. The experimental implementation ...
JimmyHu's user avatar
  • 7,575
3 votes
2 answers
128 views

Whatever language you choose, you may encounter a rounding problem. In fact, this is due to the limit of the required number of bits needed to get the right number after a calculation. Simple example: ...
Sébastien Josserand's user avatar
3 votes
2 answers
222 views

I have a sample svg file from the graphics program Inkscape. My objective is to collect every third pair from a very long line of floating point numbers. That seems simple enough. The larger objective ...
Bryan-StackExchange's user avatar
9 votes
3 answers
3k views

I implemented the following code for determining if two floating point numbers are equal is_float_equal(...). It handles the tests for my use cases well, but I was ...
dvnlo's user avatar
  • 153
4 votes
3 answers
559 views

I am a beginner, who is just learning the language (C++) from C++ Primer. I have been trying to build a side pico-project by writing functions for validation of user input for an signed double. The ...
SogaBan's user avatar
  • 63
2 votes
1 answer
1k views

I have designed a class to perform float compare. I used Knuth's strong compare to do it. Float compare is really really tricky, I'm sure there's something wrong :) Any comments? ...
greywolf82's user avatar
8 votes
1 answer
182 views

I wrote a function that receives a number as an argument and returns a number (technically, a string) with a maximum of 3 numerals, no matter if there's a decimal separator or not, plus the adequate ...
Megaptera novaeangliae's user avatar
1 vote
1 answer
232 views

This is a follow up to https://codereview.stackexchange.com/questions/272333/conversion-from-long-double-to-string where I do the reverse conversion. This time around it is string to long double. It ...
user253344's user avatar

15 30 50 per page
1
2 3 4 5
13