I have two floating point (double) values a and b, and I'm looking to add them to get a result c.
I know that c will somehow be approximated, because everything is finite precision. Now, I want to 'round down' c, meaning that the floating point c is not greater than the real sum of floating points a and b, or c <= a + b.
How can I do this? The following code in c comes to mind, but I'm not sure whether the answer will be what I want.
c = nextafter(a + b, bigNegativeNumber)
Same question goes for multiplication instead of addition. :)
PS. If it helps, a and b are always non-negative numbers.
Edit: c should be a floating point as well