On Tue, Mar 25, 2025 at 08:47:49AM +0100, Richard Biener wrote: > On Mon, 24 Mar 2025, Jakub Jelinek wrote: > > > On Mon, Mar 24, 2025 at 10:55:44PM +0100, Jakub Jelinek wrote: > > > If it was HOST_WIDE_INT_MAX + (size_t) 1 to ~(size_t) 0, previously it > > > would > > > be false and now is false. > > > > Sorry, this case used to be false and now is true. > > Just to add, when writing this I wondered whether a > > bool real_is_integer (const REAL_VALUE_TYPE *, wide_int *, int); > > would be useful, or adding an optional bool *exact arg to the > existing real_to_integer.
Maybe the latter would be better. > Semantics of -0.0 vs. 0.0 and INF/NAN (which previously, when > casting to (size_t) was UB, likewise for out-of-bound values?) > is of course details that need to be documented. Yes, it was UB at compile time. Note, my fmodf128 replacements with mpfr most likely don't handle infinities and NaNs right either, but I think the code was again UB at those points because it used casts to integers from _Float128 after that. > I think the main issue with my transform is that it lost the > non-negative check. And also the cases of unsigned which fits into host size_t but doesn't fit into HOST_WIDE_INT. But what exactly the code wants to do is unclear. > The problem with the orignal code is that > it lacks documentation on the intent of the check. Yes. Jakub