Floats in std_cmath.h

Benjamin Kosnik bkoz@cygnus.com
Thu Aug 26 02:06:00 GMT 1999


> #include <bits/std_cmath.h>
> 
> int main() {
> 
>     sin(static_cast<float>(0));
> 
>     return 0;
> 
> }

yup. I filed a bug for you.

> compiles but the executable generates a Segmentation Fault. This happens
> with any math function in place of the sin. With double instead of float
> it runs fine. What's going on there ?

Well. We'd been debating adding the checks for the builtins and float
versions of these functions, so I just went ahead and did it, pending
approval by Gaby when he gets back in a week or two. There's got to be a
better way to do it than what I did, but my lobbying for a configure-time
macro in autoconf fell by the wayside. In anycase, the fix is in CVS, so
this should be usable again.

-benjamin



More information about the Libstdc++ mailing list