On Thursday, August 29, 2013 07:47:16 Paul Jurczak wrote: > I'm writing this rather ugly: > > sqrt(cast(float)D) != round(sqrt(cast(float)D) > > line and I'm looking for more concise notation without > introducing a meaningless variable to hold expression being > tested. Is there an equivalent of std.math.trunc(), which would > return fractional portion instead, maybe frac()?
There may be something in std.math which makes it cleaner, but I would have thought that the to test whether a floating point value is an integral value, you'd just cast it to an integral type and then compare that against the original. e.g. auto isIntegral = cast(int)my_float == my_float; - Jonathan M Davis