EPiCS / soundgates

Project Group Soundgates
MIT License
1 stars 2 forks source link

zynq debuggen. floating point und constant block initialisierungen #87

Open gwue opened 10 years ago

vollkorn commented 10 years ago

Links:

http://stackoverflow.com/questions/17702429/linux-c-arm-cross-compiler-floor-function-bug http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

gwue commented 10 years ago

Blöde cross compiliererei...

Bei meiner Sache mit den Mongo Treibern hat sich auch noch niemand gemeldet. Bin fast versucht zu sagen, dass wir den ganzen Kram mal direkt auf dem Zynq kompilieren. Dauert zwar vermutlich ewig, aber dann könnte man die Cross Compilation entweder als Problem identifizieren, oder ausschließen. (Und vielleicht lässt sich auf dem ARM ja auch der Mongotreiber bauen)

Am 25.02.2014 19:05, schrieb Lukas:

Links:

http://stackoverflow.com/questions/17702429/linux-c-arm-cross-compiler-floor-function-bug http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

— Reply to this email directly or view it on GitHub https://github.com/pc2/pg-soundgates/issues/87#issuecomment-36038391.

vollkorn commented 10 years ago

Also hier schauts wie folgt aus:

boost::lexical<float>(char*) cast liefert nur mist, während std::atof(char*) funktioniert. Edit: scheint nur bei Konstanten > 0 zu funktionieren...

vollkorn commented 10 years ago

Verschiedene Testprogramme:

int main(int argc, char** argv){ float a = 0.05; float b = 0.06; float c; c = a + b; std::cout << "c is " << c << std::endl; return 0; }

liefer "c is 0"

int main(int argc, char** argv){
        const std::string foo = "5";
        float myfloat;

        myfloat = std::atof(foo.c_str());

        std::cout << "myfloat is: " << myfloat << std::endl;

        return 0;
}

leifert "myfloat is: 0"

vollkorn commented 10 years ago

Okay....ich raste hier gleich aus! std::cout scheint irgendwie kaputt zu sein:

int main(int argc, char** argv){

 //std::setprecision(10);
 std::cout.setf( std::ios::fixed, std:: ios::floatfield ); // floatfield set to fixed
 float a = 0.05;
 float b = 0.06;

 float c;

 c = a + b;

 std::cout << "std::cout: " << c << std::endl;
 printf("printf: %f\n", c);
 return 0;
}

Ausgabe:

[root@alarm soundgates]# ./a.out 
std::cout: 0.000000
printf: 0.110000
vollkorn commented 10 years ago

Okay, ich vermute, dass das Problem in der std C++ lib liegt. Mit scanf/printf funktioniert das const geraffel bzw. die Ausgabe und Umwandlung tadellos.

posewsky commented 10 years ago

Betrifft als nur die Ausgabe auf der Konsole? Aber irgendwie haben wir ja auch nichts gehört oder?

vollkorn commented 10 years ago

Übersetzung wurde durch "stringstream" durchgeführt, was ebenfalls Bestandteil von std c++ ist. Lag evtl. daran, muss aber noch überprüft werden. Habe erstmal nur mit den kleinen Testprogrammen getestet.