- UID
- 2
- 精华
- 积分
- 7736
- 威望
- 点
- 宅币
- 个
- 贡献
- 次
- 宅之契约
- 份
- 最后登录
- 1970-1-1
- 在线时间
- 小时
|
发表于 2014-5-4 19:11:59
|
显示全部楼层
如果实在要纠结的话,看下vc6 sinf的实现源码,改成如下形式:
_inline float sinf(float _X)
{
return ((float)sin((double)_X));
}
就可以编译了。。。
探索过程中发现C不支持inline但是支持_inline
详细分析如下:
打开math.h找到:
#ifndef __cplusplus//C支持函数
#define acosl(x) ((long double)acos((double)(x)))
#define asinl(x) ((long double)asin((double)(x)))
#define atanl(x) ((long double)atan((double)(x)))
#define atan2l(x,y) ((long double)atan2((double)(x), (double)(y)))
#define _cabsl _cabs
#define ceill(x) ((long double)ceil((double)(x)))
#define cosl(x) ((long double)cos((double)(x)))
#define coshl(x) ((long double)cosh((double)(x)))
#define expl(x) ((long double)exp((double)(x)))
#define fabsl(x) ((long double)fabs((double)(x)))
#define floorl(x) ((long double)floor((double)(x)))
#define fmodl(x,y) ((long double)fmod((double)(x), (double)(y))
.........................
#define tanl(x) ((long double)tan((double)(x)))
#define tanhl(x) ((long double)tanh((double)(x)))
#else /* __cplusplus *///C++支持函数
inline long double acosl(long double _X)
{return (acos((double)_X)); }
inline long double asinl(long double _X)
{return (asin((double)_X)); }
inline long double atanl(long double _X)
{return (atan((double)_X)); }
inline long double atan2l(long double _X, long double _Y)
{return (atan2((double)_X, (double)_Y)); }
。。。。。。。。
inline float modff(float _X, float *_Y)
{ double _Di, _Df = modf((double)_X, &_Di);
*_Y = (float)_Di;
return ((float)_Df); }
inline float powf(float _X, float _Y)
{return ((float)pow((double)_X, (double)_Y)); }
inline float sinf(float _X)
{return ((float)sin((double)_X)); }
inline float sinhf(float _X)
{return ((float)sinh((double)_X)); }
也就是sinf在c里是没定义的
|
|