15,494 questions
2
votes
2
answers
117
views
What are examples of non-finite float values other than infinity and NaN?
C23 §5.2.5.3.3 [Characteristics of floating types <float.h>] paragraph 8 says:
Floating types shall be able to represent signed zeros or an unsigned zero and all normalized floating-point ...
2
votes
1
answer
185
views
Accurate computation of the inverse gamma function with the standard C math library
The inverse of the gamma function over the reals is multivalued with an infinite number of branches. This self-answered question is about the principal
inverse of the gamma function, Γ0-1(x), whose ...
4
votes
1
answer
112
views
Invalid Operation with Arm64 fcmp and simd
Consider the following snippet:
ldr q0, [x0]
cmeq v0.16b, v0.16b, #0
shrn v0.8b, v0.8h, #4
fcmp d0, #0.0
This is a common way to implement functions such as strlen with SIMD. According to the Arm64 ...
16
votes
2
answers
703
views
Parsing of small floats with std::istream
I have a program that reads the coordinates of some points from a text file using std::istringstream, and then it verifies the correctness of parsing by calling stream's operator bool().
In general it ...
2
votes
1
answer
252
views
Why does Newton’s method overshoot on the first deceleration step in my motion profile generator?
I’m porting a Python motion profile generator to C to implement for my STM32H743. The generator produces step timings for a simple acceleration → cruise → deceleration motion profile. See the ...
4
votes
1
answer
172
views
Weird behavior in large complex128 NumPy arrays, imaginary part only [closed]
I'm working on numerical simulations. I ran into an issue with large NumPy arrays (~ 26 GB) on Linux with 128 GB of RAM. The arrays are of type complex128.
Arrays are instantiated without errors (if ...
25
votes
13
answers
3k
views
How can I parse a string to a float in C in a way that isn't affected by the current locale?
I'm writing a program where I need to parse some configuration files in addition to user input from a graphical user interface. In particular, I'm having issues with parsing strings taken from the ...
4
votes
2
answers
315
views
Why does adding a value to Float.MAX_VALUE not reach infinity?
According to the standard, overflow in java is handled using a special value called infinity, but here the sum is 3.4028235E38. Why is this the case?
public class FloatingPointTest {
public static ...