|
From: | david wallin |
Subject: | Re: [Tinycc-devel] libtcc bug when evaluating math expressions |
Date: | Thu, 27 Nov 2003 16:42:38 +0000 |
ah! thank you very much.I thought I had covered that because I tried compiling a function like this:
"double evaluate_me(double v) { return fabs(v); }\0"and evaluated it with -1.0 and got 1.0 back (this was with 0.9.19). So I thought it worked fine. I guess a 1.0 was left somewhere and returned.
cheers, --david. On Thursday, November 27, 2003, at 04:03 PM, Daniel Glöckner wrote:
On Thu, Nov 27, 2003 at 01:28:45PM +0000, David Wallin wrote:char *eval_me = "double evaluate_me(double x, double v) { return (double) ((-1.0 * x) > v * fabs(v)); }\0" ;#include <math.h> fabs is not defined and so defaults to returning an integer in eax instead of a double in st0. On exit of fabs(), eax holds an undefined value which is then converted to a double and multiplied with v. GCC knows about fabs and generates the fabs instruction, even with -O0. Daniel
[Prev in Thread] | Current Thread | [Next in Thread] |