Jeremie Pelletier wrote: > Jari-Matti Mäkelä wrote: >> Jeremie Pelletier wrote: >> >>> Nick Sabalausky wrote: >>>> union A { >>>> int foo; >>>> float bar; >>>> } >>>> >>> Yet it's the only way I know of to do bitwise logic on floating points >>> in D to extract the exponent, sign and mantissa for example. >> >> You could add built-in methods for those operations to the float type: >> >> float bar; >> >> boolean s = bar.sign; >> ... > > That would be so inefficient in some cases, you don't always want to > shift the data like bar.sign implies.
It depends on the boolean representation. I see no reason why a built-in feature should be slower than some bitwise logic operation in user code. After all, the set of operations the language provides for the user is a subset of all possible operations the language implementation can do.