www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - computing ceil at compile time

reply "bioinfornatics" <bioinfornatics fedoraproject.org> writes:
Hi,
with ldc maybe that works with an another compiler, i fail to 
compute std.math.ceil at compile time

minimal example: http://paste.fedoraproject.org/56332/52482751


$ ldc2 compute.d main.d -of ok
/usr/include/d/std/math.d(2471): Error: ceill cannot be 
interpreted at compile time, because it has no available source 
code
compute.d(5):        called from here: ceil(cast(real)i)
compute.d(8):        called from here: foo(2.4F)
Nov 23 2013
parent "bearophile" <bearophileHUGS lycos.com> writes:
bioinfornatics:

 $ ldc2 compute.d main.d -of ok
 /usr/include/d/std/math.d(2471): Error: ceill cannot be 
 interpreted at compile time, because it has no available source 
 code
 compute.d(5):        called from here: ceil(cast(real)i)
 compute.d(8):        called from here: foo(2.4F)
At the moment some std.math functions that deal with floating point numbers can't be run at compile-time. Bye, bearophile
Nov 23 2013