sin(float), cos(float)
bearophile
bearophileHUGS at lycos.com
Tue Apr 19 16:04:18 PDT 2011
In the C standard library there are the sqrtf, cosf, sinf functions, that return a 32 bit float. In D std.math.sqrt returns a float if the input argument is float, but sin and cos return double even if their argument is float:
import std.math: sqrt, sin, cos;
void main() {
float x = 1.0f;
static assert(is(typeof( sqrt(x) ) == float)); // OK
static assert(is(typeof( sin(x) ) == float)); // ERR
static assert(is(typeof( cos(x) ) == float)); // ERR
}
I think this is not correct, and it's worth a Bugzilla entry (if not already present). Do you agree?
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list