http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53367

             Bug #: 53367
           Summary: FMOD Standar C++ library
    Classification: Unclassified
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libstdc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: joaquinmonl...@gmail.com


Created attachment 27411
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27411
the preprocessed file (*.i*) that triggers the bug???

/*

Exact version of GCC: gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)

System Type: 32BITS --target=i486-linux-gnu.

Options given when GCC was configured/build: 

The complete command line that triggers the bug: "g++ -lm fmod.cpp -o fmod"

The compiler output (error messages, warnings, etc.): None.

the preprocessed file (*.i*) that triggers the bug, generated by adding
-save-temps to the complete compilation command: As attachment

http://en.tiraecol.net/modules/comic/cache/images/tiraecol_en-5.png

*/

#include <cmath>
#include <iostream>

using namespace std;

const long double _1PI2 = 1.5707963267948966193L;  // PI/2
const long double _3PI2 = 4.712388980384689858L;   // 3*PI/2

long double my_fmod(long double numerator, long double denominator){
    return numerator-((int)(numerator/denominator))*denominator;
}

int main(){

    // GCC Standard Library fmod
    cout << fmod(_3PI2,_1PI2) << endl;
    // RETURNS 1.0842e-19 !!!!!!!!!!!!!!!!!!BUG BUG BUG!!!!!!!!!!!!!!

    // my_fmod
    cout << my_fmod(_3PI2,_1PI2) << endl;
    // RETURNS 0

}

Reply via email to