## digitalmars.D - math libraries

- Luc Bourhis (8/8) Feb 12 2015 What is the difference between (i) core.math, (ii) std.math,
- Ilya Yaroshenko (15/23) Feb 12 2015 Hi!
- Luc Bourhis (1/1) Feb 14 2015 Thank you very much Ilya for this comprehensive and clear answer.

What is the difference between (i) core.math, (ii) std.math, (iii) core.stdc.math and (iv) core.stdc.tgmath? (iv) falls back on (iii) as far as I can tell. (i) and (ii) seem to emit the same old x87 instructions, like fsin e.g., even for double and float. What's the difference? So that leaves only core.stdc.math which may use fast SSE2 scalar instructions. It looks like it may do so, from a glance at the assembly with GDB. Could somebody shine some light?

Feb 12 2015

Hi! 1. core.stdc.math - C math (sin(double), sinf(float), sinl(real)). This functions are linked to libm. 2. core.stdc.tgmath - C math overloads (single name for float/double/real). See also http://www.cplusplus.com/reference/ctgmath/ . This functions are link to libm. 3. core.math - Builtin mathematical intrinsics. They can be executed at compile time. 4. std.math - Standart math module. Some functions can be executed at compile time. Many functions defined only for `real`. Work for `double` and `float` in progress. Best Regards, Ilya On Thursday, 12 February 2015 at 20:56:34 UTC, Luc Bourhis wrote:What is the difference between (i) core.math, (ii) std.math, (iii) core.stdc.math and (iv) core.stdc.tgmath? (iv) falls back on (iii) as far as I can tell. (i) and (ii) seem to emit the same old x87 instructions, like fsin e.g., even for double and float. What's the difference? So that leaves only core.stdc.math which may use fast SSE2 scalar instructions. It looks like it may do so, from a glance at the assembly with GDB. Could somebody shine some light?

Feb 12 2015

Thank you very much Ilya for this comprehensive and clear answer.

Feb 14 2015