Hi,
i'm pretty new to D, i was never too much a C/C++ programmer, so i don't
have too much knowledge from that side,
i've got one simple question, how do i use a sqrt() function in D ?
at first, i figured, if its in math.h, i would use 'import std.c.math' and
just call out sqrt(),
but it didn't work. seeing how i don't have anyone using D that i know, i
came here..
thanks in advance,
Asaf.

Hi,
i'm pretty new to D, i was never too much a C/C++ programmer, so i don't
have too much knowledge from that side,
i've got one simple question, how do i use a sqrt() function in D ?
at first, i figured, if its in math.h, i would use 'import std.c.math' and
just call out sqrt(),
but it didn't work. seeing how i don't have anyone using D that i know, i
came here..
thanks in advance,
Asaf.

For sqrt() you should use the std.intrinsic module. This module has the
sqrt() function build in. Before going any further, it may be wise to
read the Phobos page at the place a little bit.
http://www.digitalmars.com/d/phobos.html
Regards,
Sjoerd

Hi,
i'm pretty new to D, i was never too much a C/C++ programmer, so i
don't have too much knowledge from that side,
i've got one simple question, how do i use a sqrt() function in D ?
at first, i figured, if its in math.h, i would use 'import std.c.math'
and just call out sqrt(),
but it didn't work. seeing how i don't have anyone using D that i
know, i came here..
thanks in advance,
Asaf.

For sqrt() you should use the std.intrinsic module. This module has the
sqrt() function build in. Before going any further, it may be wise to
read the Phobos page at the place a little bit.
http://www.digitalmars.com/d/phobos.html
Regards,
Sjoerd

Hi,
i'm pretty new to D, i was never too much a C/C++ programmer, so i
don't have too much knowledge from that side,
i've got one simple question, how do i use a sqrt() function in D ?
at first, i figured, if its in math.h, i would use 'import
std.c.math' and just call out sqrt(),
but it didn't work. seeing how i don't have anyone using D that i
know, i came here..
thanks in advance,
Asaf.

For sqrt() you should use the std.intrinsic module. This module has
the sqrt() function build in. Before going any further, it may be wise
to read the Phobos page at the place a little bit.
http://www.digitalmars.com/d/phobos.html
Regards,
Sjoerd

BTW, std.math also includes the sqrt() function.

However, there are conflicting defininitions of sqrt() in std.math.
[i.e. creal sqrt(creal) conflicts with float sqrt(float)] which I think
is the problem Asaf ran into.

Hi,
i'm pretty new to D, i was never too much a C/C++ programmer, so i
don't have too much knowledge from that side,
i've got one simple question, how do i use a sqrt() function in D ?
at first, i figured, if its in math.h, i would use 'import std.c.math'
and just call out sqrt(),
but it didn't work. seeing how i don't have anyone using D that i know,
i came here..
thanks in advance,
Asaf.

For sqrt() you should use the std.intrinsic module. This module has the
sqrt() function build in. Before going any further, it may be wise to
read the Phobos page at the place a little bit.
http://www.digitalmars.com/d/phobos.html
Regards,
Sjoerd

BTW, std.math also includes the sqrt() function.

However, there are conflicting defininitions of sqrt() in std.math. [i.e.
creal sqrt(creal) conflicts with float sqrt(float)] which I think is the
problem Asaf ran into.

Regards,
Sjoerd

i kind of solved my problem before i saw the replies, i used the std.math
sqrt() one,
which is using real, my code (a stupid isprime() function) is now ok, i
think..
thanks for the help though..
Cheers,
Asaf

Hi,
i'm pretty new to D, i was never too much a C/C++ programmer, so i
don't have too much knowledge from that side,
i've got one simple question, how do i use a sqrt() function in D ?
at first, i figured, if its in math.h, i would use 'import std.c.math'
and just call out sqrt(),
but it didn't work. seeing how i don't have anyone using D that i
know, i came here..
thanks in advance,
Asaf.

For sqrt() you should use the std.intrinsic module. This module has the
sqrt() function build in. Before going any further, it may be wise to
read the Phobos page at the place a little bit.
http://www.digitalmars.com/d/phobos.html

There is no sqrt() function in the std.intrinsic module. The
documentation is incorrect.