Thread overview | |||||
---|---|---|---|---|---|
|
May 08, 2004 Problem¦with¦COS | ||||
---|---|---|---|---|
| ||||
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 Re: Problem¦with¦COS | ||||
---|---|---|---|---|
| ||||
Posted in reply to Luis¦Rodrigues | 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 Re: Problem¦with¦COS | ||||
---|---|---|---|---|
| ||||
Posted in reply to Luis¦Rodrigues | 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_ |
Copyright © 1999-2021 by the D Language Foundation