According to the standard, fmax (the function, not macro) takes two doubles and returns a double. Is it safe to pass integers to the function?
One consideration I’m aware of is the size of the types. long long fits in double, but I don’t know if it’s always the case.
I don’t know any other considerations involved in type conversions.
fmax works fine but I want to make sure if my understanding of it is valid.
You use the word "safe" at one point and then ask if it's "valid" in another. These are completely different concepts. What is valid may not be safe.
It is NOT "safe" to pass arbitrary long long and expect a good mathematical result from
fmax.Consider the following
which gives me