Summary: std.math.sin(float), std.math.cos(float) to return
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: Phobos

--- Comment #0 from 2011-04-20 04:08:20 PDT ---
Currently (DMD 2.052) std.math doesn't seem to use the cosf, sinf C functions,
but it seems to use sqrtf (or something similar):

import std.math: sqrt, sin, cos;
import core.stdc.math: sqrtf, sinf, cosf;
void main() {
     float x = 1.0f;
     // C functions
     static assert(is(typeof( sqrtf(x) ) == float)); // OK
     static assert(is(typeof( sinf(x)  ) == float)); // OK
     static assert(is(typeof( cosf(x)  ) == float)); // OK
     // D functions
     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'd like std.math.sin/cos to return a float value when the input argument is a

This is useful if you want to perform operations on floats and keep
intermediate expressions (that call sin/cos) as floats:

enum float PI_FLOAT = 3.14159265358979323846264f; // not present in std.math
float x = 0.3f;
float y = 2.0f * PI_FLOAT * sin(x); // contains no double->float conversions

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to