[D-runtime] Is core.math public API?

Jonathan M Davis jmdavisProg at gmx.com
Tue Oct 2 09:48:30 PDT 2012

On Tuesday, October 02, 2012 18:43:03 David Nadlinger wrote:
> core.math contains a few magic declarations (cos, fabs, ldexp, rint,
> rndtol, rndtonl, sin, sqrt, yl2x) recognized by DMD as intrinsics for
> the respective math functions.
> Is the module actually public API? I would guess so, but the reason
> why I'm asking is that currently LDC does not implement them, but
> nobody has ever complained about linker errors so far. Also,
> http://dlang.org/phobos/core_math.html is not linked from the doc
> index in the sidebar on dlang.org.

It's public in that it's public and that you _can_ use it directly, but I 
think that it's like core.stdc.math in that you're not really supposed to use 

I would point out however that those same intrinsics are listed in std.math 
(or at least some of them anyway - I haven't checked them all), meaning that 
Phobos assumes that the intrinsics exist, so either LDC expects the intrinsics 
and will blow up if you use them, it just doesn't have those functions in its 
version of Phobos, or it's providing its own implementations, since the 
standard Phobos doesn't provide implemenations for them.

- Jonathan M Davis

More information about the D-runtime mailing list