digitalmars.D - Problem¦with¦COS
- Luis¦Rodrigues (6/6) May 08 2004 I¦have¦this¦code:
- J Anderson (5/12) May 08 2004 Try converting the real to a float first:
- hellcatv hotmail.com (11/17) May 08 2004 I had trouble linking when using cos in gdc
I¦have¦this¦code:
printf("%f\n",¦cos(0.883573));
and¦it¦prints¦-0.0000,¦why?
I've¦imported¦std.math
Thanks.
_LR_
May 08 2004
Luis¦Rodrigues wrote:
I¦have¦this¦code:
printf("%f\n",¦cos(0.883573));
and¦it¦prints¦-0.0000,¦why?
I've¦imported¦std.math
Thanks.
_LR_
Try converting the real to a float first:
printf("%f\n", cast(float) cos(0.883573));
--
-Anderson: http://badmama.com.au/~anderson/
May 08 2004
I had trouble linking when using cos in gdc
my solution was to use version and cosl
cos worked fine for me in dmd.exe
import std.c.math;
import std.math;
version(Windows) {
return std.math.cos(x);
}else {
return cast(VALUE)std.c.math.cosl(cast(real)x);
}
In article <c7j5gn$1qka$1 digitaldaemon.com>, Luis¦Rodrigues says...
I¦have¦this¦code:
printf("%f\n",¦cos(0.883573));
and¦it¦prints¦-0.0000,¦why?
I've¦imported¦std.math
Thanks.
_LR_
May 08 2004









J Anderson <REMOVEanderson badmama.com.au> 