Thinking about this more, you ask "is this correct", but that is only meaningful if you say what the specification is. Correct relative to what?
> Yes, it seems to be the correct way, but thinking more about the > problem, it appeared to me that the implementation could be even easier > than yours. It seems to me that this may be sufficient: > uint64_t float64_to_uint64 (float64 a STATUS_PARAM) > { > int64_t v; > > v = llrint(a + (float64)INT64_MIN); > > return v - INT64_MIN; > } If a is NaN then so is the argument to llrint. 'man llrint' says: If x is infinite or NaN, or if the rounded value is outside the range of the return type, the numeric result is unspecified. So then float64_to_uint64 produces an unspecified result. It seems to me much safer to test and handle NaN, Inf and out-of-range values specially. However, even that does not help unless you say what the specification is. J _______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel