What's the most efficient way to convert a float/double/real to an integer type with a specified rounding scheme (eg floor/ceil etc)?<div><br></div><div>Is there anything besides:</div><div>int x=floor(1.2); ?</div><div>
there's also</div><div>core.stdc.math.floor{l,f,}</div><div><br></div><div>Because these first convert to floating point representation and then then the conversion to int happens.</div><div><br></div><div>Could we support the following instead:</div>
<div><br></div><div>T floor(T,S)(S x) if (/+insert good template constraits+/) {</div><div>//right now just return existing floor and convert to T but later can provide more efficient direct implementation, so user can start using it right now.</div>
<div>}</div><div><br></div><div>and friends, modeled after <a href="http://std.conv.to">std.conv.to</a>.</div><div><br></div><div><br></div>