You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// multiply last value by ten and add the new digitauto temp = value * 10 + *curptr - '0';
// test for overflowif (temp < value || temp > max)
{
// overflow
type = value_t::number_float;
}
The temp < value above will not detect overflow for some values, as we're not just adding a small value, but also multiplying by 10, so this may overflow couple of times over and end-up satisfying temp >= value. As for temp > max - it looks to me that it will never happen unless the width of temp is greater than that of max
Try round-tripping 166020696663385964490
The text was updated successfully, but these errors were encountered:
The
temp < value
above will not detect overflow for some values, as we're not just adding a small value, but also multiplying by 10, so this may overflow couple of times over and end-up satisfyingtemp >= value
. As fortemp > max
- it looks to me that it will never happen unless the width oftemp
is greater than that ofmax
Try round-tripping 166020696663385964490
The text was updated successfully, but these errors were encountered: