Re: [Tinycc-devel] sinf/sin problems

2014-12-26 Thread Lee Duhem
On Wed, Dec 24, 2014 at 8:53 PM, Daniel Glöckner wrote: > > The return value of a function returning an int is not passed in the > register where a double would be returned, so you might get garbage > that is in no way related to the input. You are correct. Assembly code generated by tcc reveals

Re: [Tinycc-devel] sinf/sin problems

2014-12-24 Thread Daniel Glöckner
Hi, just some nit-picking: On Wed, Dec 24, 2014 at 04:46:14PM +0800, Lee Duhem wrote: > `sinf' is defined in libm.so, you need to link with it. on Linux > As explained by Aharon, c compiler will offer an implicit declaration > for any undeclared function that it saw, and the return type of this

Re: [Tinycc-devel] sinf/sin problems

2014-12-24 Thread Lee Duhem
On Wed, Dec 24, 2014 at 10:08 AM, Oleg N. Cher wrote: > Hi all, > > float version sinf does not work as expected: > > #include > #include > > int main(int argc, char **argv) { > float f = sinf(0.1); > printf("%f", f); > return 0; > } > >>tcc testsinf.c > tcc: error: undefined symbol 'sinf' `

Re: [Tinycc-devel] sinf/sin problems

2014-12-23 Thread Aharon Robbins
The problem is apparently that sinf isn't declared in Microsoft's header file; try searching MSDN to see where it is declared. What's happening is that C treats undeclared functions as being implicitly declared to return int (4 bytes), which explains why you're getting bad values. If you explici

Re: [Tinycc-devel] sinf/sin problems

2014-12-23 Thread Mads
I use tcc as a part of a numerical framework on Windows. I can confirm that: - sinf does not work - some math functions (not just limited to sin) do not announce as undeclared when math.h is missing. Instead these undeclared math functions return strange values. In my case, sin(1.0) returns 639.0 w

[Tinycc-devel] sinf/sin problems

2014-12-23 Thread Oleg N. Cher
Hi all, float version sinf does not work as expected: #include #include int main(int argc, char **argv) { float f = sinf(0.1); printf("%f", f); return 0; } >tcc testsinf.c tcc: error: undefined symbol 'sinf' Next question is a very evil problem, I think. if #include not specified, ab