Date: Sat, 10 Mar 2012 08:12:45 -0500 From: Rich Felker <dalias@...ifal.cx> To: musl@...ts.openwall.com Subject: Re: libm On Sat, Mar 10, 2012 at 01:45:53PM +0100, Szabolcs Nagy wrote: > there are two remaining problems: > > for two argument functions __RETCAST((x)+(y)) is not ok > if x is float, y is int then the return type should be double, not float > (this can be solved by a __RETCAST2(x,y) i guess) I don't see any better way right off... Actually it's really ugly that C's promotions don't respect the size of the integer type when combining with floating point types. x+0.0f where x is an integer type is almost sure to destroy the value of x except for very small values. C really should have made the promotion be to the smallest floating point type that has at least as many bits in its mantissa as value bits in the integer type, or long double if no such type exists. Or from the other side (with C as it is), programmers should be really careful about implicit conversions to floating point types from integer types. > if sizeof(long double) == sizeof(double) then the selected > function will be wrong > (it should not matter much, we can leave it as is or enforce double) It would probably be nice to put the case for double before long double to avoid going through an extra wrapper function on LD64 systems, but it's not a big deal. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.