#how to check if a specific float can be losslessly converted to the specified integer type?

1 messages · Page 1 of 1 (latest)

cinder pecan
#

Basically, is there a standard lib function im missing that can check if

  1. a float has a fractional component
  2. if it fits within the bounds of the specified integer type

i'm fine if it can only check the 1st point, the 2nd point should be fairly easy to check.

vivid pebble
cinder pecan
#

that works

#

ty

dawn sierra
#

std.math.lossyCast and check if it is equal?

cinder pecan
#

that prob makes the most sense

#

esp if i just do a @intFromFloat