/***
成都创新互联公司是少有的网站设计制作、网站建设、营销型企业网站、小程序开发、手机APP,开发、制作、设计、买链接、推广优化一站式服务网络公司,从2013年成立,坚持透明化,价格低,无套路经营理念。让网页惊喜每一位访客多年来深受用户好评
*math.h - definitions and declarations for math library
*
* Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains constant definitions and external subroutine
* declarations for the math subroutine library.
* [ANSI/System V]
*
* [Public]
*
****/
#if _MSC_VER 1000
#pragma once
#endif
#ifndef _INC_MATH
#define _INC_MATH
#if !defined(_WIN32) !defined(_MAC)
#error ERROR: Only Mac or Win32 targets supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __assembler /* Protect from assembler */
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) !defined(__cdecl) )
#define __cdecl
#endif
/* Define _CRTAPI1 (for compatibility with the NT SDK) */
#ifndef _CRTAPI1
#if _MSC_VER = 800 _M_IX86 = 300
#define _CRTAPI1 __cdecl
#else
#define _CRTAPI1
#endif
#endif
/* Definition of _exception struct - this struct is passed to the matherr
* routine when a floating point exception is detected
*/
#ifndef _EXCEPTION_DEFINED
struct _exception {
int type; /* exception type - see below */
char *name; /* name of function where error occured */
double arg1; /* first argument to function */
double arg2; /* second argument (if any) to function */
double retval; /* value to be returned by function */
} ;
#define _EXCEPTION_DEFINED
#endif
/* Definition of a _complex struct to be used by those who use cabs and
* want type checking on their argument
*/
#ifndef _COMPLEX_DEFINED
struct _complex {
double x,y; /* real and imaginary parts */
} ;
#if !__STDC__ !defined (__cplusplus)
/* Non-ANSI name for compatibility */
#define complex _complex
#endif
#define _COMPLEX_DEFINED
#endif
#endif /* __assembler */
/* Constant definitions for the exception type passed in the _exception struct
*/
#define _DOMAIN 1 /* argument domain error */
#define _SING 2 /* argument singularity */
#define _OVERFLOW 3 /* overflow range error */
#define _UNDERFLOW 4 /* underflow range error */
#define _TLOSS 5 /* total loss of precision */
#define _PLOSS 6 /* partial loss of precision */
#define EDOM 33
#define ERANGE 34
/* Definitions of _HUGE and HUGE_VAL - respectively the XENIX and ANSI names
* for a value returned in case of error by a number of the floating point
* math routines
*/
#ifndef __assembler /* Protect from assembler */
_CRTIMP extern double _HUGE;
#endif /* __assembler */
#define HUGE_VAL _HUGE
/* Function prototypes */
#if !defined(__assembler) /* Protect from assembler */
#if _M_MRX000
_CRTIMP int __cdecl abs(int);
_CRTIMP double __cdecl acos(double);
_CRTIMP double __cdecl asin(double);
_CRTIMP double __cdecl atan(double);
_CRTIMP double __cdecl atan2(double, double);
_CRTIMP double __cdecl cos(double);
_CRTIMP double __cdecl cosh(double);
_CRTIMP double __cdecl exp(double);
_CRTIMP double __cdecl fabs(double);
_CRTIMP double __cdecl fmod(double, double);
_CRTIMP long __cdecl labs(long);
_CRTIMP double __cdecl log(double);
_CRTIMP double __cdecl log10(double);
_CRTIMP double __cdecl pow(double, double);
_CRTIMP double __cdecl sin(double);
_CRTIMP double __cdecl sinh(double);
_CRTIMP double __cdecl tan(double);
_CRTIMP double __cdecl tanh(double);
_CRTIMP double __cdecl sqrt(double);
#else
int __cdecl abs(int);
double __cdecl acos(double);
double __cdecl asin(double);
double __cdecl atan(double);
double __cdecl atan2(double, double);
double __cdecl cos(double);
double __cdecl cosh(double);
double __cdecl exp(double);
double __cdecl fabs(double);
double __cdecl fmod(double, double);
long __cdecl labs(long);
double __cdecl log(double);
double __cdecl log10(double);
double __cdecl pow(double, double);
double __cdecl sin(double);
double __cdecl sinh(double);
double __cdecl tan(double);
double __cdecl tanh(double);
double __cdecl sqrt(double);
#endif
_CRTIMP double __cdecl atof(const char *);
_CRTIMP double __cdecl _cabs(struct _complex);
#if defined(_M_ALPHA)
double __cdecl ceil(double);
double __cdecl floor(double);
#else
_CRTIMP double __cdecl ceil(double);
_CRTIMP double __cdecl floor(double);
#endif
_CRTIMP double __cdecl frexp(double, int *);
_CRTIMP double __cdecl _hypot(double, double);
_CRTIMP double __cdecl _j0(double);
_CRTIMP double __cdecl _j1(double);
_CRTIMP double __cdecl _jn(int, double);
_CRTIMP double __cdecl ldexp(double, int);
int __cdecl _matherr(struct _exception *);
_CRTIMP double __cdecl modf(double, double *);
_CRTIMP double __cdecl _y0(double);
_CRTIMP double __cdecl _y1(double);
_CRTIMP double __cdecl _yn(int, double);
#if defined(_M_MRX000)
/* MIPS fast prototypes for float */
/* ANSI C, 4.5 Mathematics */
/* 4.5.2 Trigonometric functions */
_CRTIMP float __cdecl acosf( float );
_CRTIMP float __cdecl asinf( float );
_CRTIMP float __cdecl atanf( float );
_CRTIMP float __cdecl atan2f( float , float );
_CRTIMP float __cdecl cosf( float );
_CRTIMP float __cdecl sinf( float );
_CRTIMP float __cdecl tanf( float );
/* 4.5.3 Hyperbolic functions */
_CRTIMP float __cdecl coshf( float );
_CRTIMP float __cdecl sinhf( float );
_CRTIMP float __cdecl tanhf( float );
/* 4.5.4 Exponential and logarithmic functions */
_CRTIMP float __cdecl expf( float );
_CRTIMP float __cdecl logf( float );
_CRTIMP float __cdecl log10f( float );
_CRTIMP float __cdecl modff( float , float* );
/* 4.5.5 Power functions */
_CRTIMP float __cdecl powf( float , float );
float __cdecl sqrtf( float );
/* 4.5.6 Nearest integer, absolute value, and remainder functions */
float __cdecl ceilf( float );
float __cdecl fabsf( float );
float __cdecl floorf( float );
_CRTIMP float __cdecl fmodf( float , float );
_CRTIMP float __cdecl hypotf(float, float);
#endif /* _M_MRX000 */
#if defined(_M_ALPHA)
/* ALPHA fast prototypes for float */
/* ANSI C, 4.5 Mathematics */
/* 4.5.2 Trigonometric functions */
float __cdecl acosf( float );
float __cdecl asinf( float );
float __cdecl atanf( float );
float __cdecl atan2f( float , float );
float __cdecl cosf( float );
float __cdecl sinf( float );
float __cdecl tanf( float );
/* 4.5.3 Hyperbolic functions */
float __cdecl coshf( float );
float __cdecl sinhf( float );
float __cdecl tanhf( float );
/* 4.5.4 Exponential and logarithmic functions */
float __cdecl expf( float );
float __cdecl logf( float );
float __cdecl log10f( float );
_CRTIMP float __cdecl modff( float , float* );
/* 4.5.5 Power functions */
float __cdecl powf( float , float );
float __cdecl sqrtf( float );
/* 4.5.6 Nearest integer, absolute value, and remainder functions */
float __cdecl ceilf( float );
float __cdecl fabsf( float );
float __cdecl floorf( float );
float __cdecl fmodf( float , float );
_CRTIMP float __cdecl _hypotf(float, float);
#endif /* _M_ALPHA */
#if !defined(_M_M68K)
/* Macros defining long double functions to be their double counterparts
* (long double is synonymous with double in this implementation).
*/
#ifndef __cplusplus
#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 frexpl(x,y) ((long double)frexp((double)(x), (y)))
#define _hypotl(x,y) ((long double)_hypot((double)(x), (double)(y)))
#define ldexpl(x,y) ((long double)ldexp((double)(x), (y)))
#define logl(x) ((long double)log((double)(x)))
#define log10l(x) ((long double)log10((double)(x)))
#define _matherrl _matherr
#define modfl(x,y) ((long double)modf((double)(x), (double *)(y)))
#define powl(x,y) ((long double)pow((double)(x), (double)(y)))
#define sinl(x) ((long double)sin((double)(x)))
#define sinhl(x) ((long double)sinh((double)(x)))
#define sqrtl(x) ((long double)sqrt((double)(x)))
#define tanl(x) ((long double)tan((double)(x)))
#define tanhl(x) ((long double)tanh((double)(x)))
#else /* __cplusplus */
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 long double ceill(long double _X)
{return (ceil((double)_X)); }
inline long double cosl(long double _X)
{return (cos((double)_X)); }
inline long double coshl(long double _X)
{return (cosh((double)_X)); }
inline long double expl(long double _X)
{return (exp((double)_X)); }
inline long double fabsl(long double _X)
{return (fabs((double)_X)); }
inline long double floorl(long double _X)
{return (floor((double)_X)); }
inline long double fmodl(long double _X, long double _Y)
{return (fmod((double)_X, (double)_Y)); }
inline long double frexpl(long double _X, int *_Y)
{return (frexp((double)_X, _Y)); }
inline long double ldexpl(long double _X, int _Y)
{return (ldexp((double)_X, _Y)); }
inline long double logl(long double _X)
{return (log((double)_X)); }
inline long double log10l(long double _X)
{return (log10((double)_X)); }
inline long double modfl(long double _X, long double *_Y)
{double _Di, _Df = modf((double)_X, _Di);
*_Y = (long double)_Di;
return (_Df); }
inline long double powl(long double _X, long double _Y)
{return (pow((double)_X, (double)_Y)); }
inline long double sinl(long double _X)
{return (sin((double)_X)); }
inline long double sinhl(long double _X)
{return (sinh((double)_X)); }
inline long double sqrtl(long double _X)
{return (sqrt((double)_X)); }
inline long double tanl(long double _X)
{return (tan((double)_X)); }
inline long double tanhl(long double _X)
{return (tanh((double)_X)); }
inline float frexpf(float _X, int *_Y)
{return ((float)frexp((double)_X, _Y)); }
inline float ldexpf(float _X, int _Y)
{return ((float)ldexp((double)_X, _Y)); }
#if !defined(_M_MRX000) !defined(_M_ALPHA)
inline float acosf(float _X)
{return ((float)acos((double)_X)); }
inline float asinf(float _X)
{return ((float)asin((double)_X)); }
inline float atanf(float _X)
{return ((float)atan((double)_X)); }
inline float atan2f(float _X, float _Y)
{return ((float)atan2((double)_X, (double)_Y)); }
inline float ceilf(float _X)
{return ((float)ceil((double)_X)); }
inline float cosf(float _X)
{return ((float)cos((double)_X)); }
inline float coshf(float _X)
{return ((float)cosh((double)_X)); }
inline float expf(float _X)
{return ((float)exp((double)_X)); }
inline float fabsf(float _X)
{return ((float)fabs((double)_X)); }
inline float floorf(float _X)
{return ((float)floor((double)_X)); }
inline float fmodf(float _X, float _Y)
{return ((float)fmod((double)_X, (double)_Y)); }
inline float logf(float _X)
{return ((float)log((double)_X)); }
inline float log10f(float _X)
{return ((float)log10((double)_X)); }
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)); }
inline float sqrtf(float _X)
{return ((float)sqrt((double)_X)); }
inline float tanf(float _X)
{return ((float)tan((double)_X)); }
inline float tanhf(float _X)
{return ((float)tanh((double)_X)); }
#endif /* !defined(_M_MRX000) !defined(_M_ALPHA) */
#endif /* __cplusplus */
#endif /* _M_M68K */
#endif /* __assembler */
#if !__STDC__
/* Non-ANSI names for compatibility */
#define DOMAIN _DOMAIN
#define SING _SING
#define OVERFLOW _OVERFLOW
#define UNDERFLOW _UNDERFLOW
#define TLOSS _TLOSS
#define PLOSS _PLOSS
#ifndef _MAC
#define matherr _matherr
#endif /* ndef _MAC */
#ifndef __assembler /* Protect from assembler */
_CRTIMP extern double HUGE;
_CRTIMP double __cdecl cabs(struct _complex);
_CRTIMP double __cdecl hypot(double, double);
_CRTIMP double __cdecl j0(double);
_CRTIMP double __cdecl j1(double);
_CRTIMP double __cdecl jn(int, double);
int __cdecl matherr(struct _exception *);
_CRTIMP double __cdecl y0(double);
_CRTIMP double __cdecl y1(double);
_CRTIMP double __cdecl yn(int, double);
求sin的:参考下 #includestdio.h void main() { double x,a,b,sum=0; printf("请输入x的弧度值:\n"); scanf("%lf",x); int i,j,count=0; for(i=1;;i+=2) { count++; a=b=1; for(j=1;j=i;j++) { a*=x; b*=(double)j; } if(a/b0.0000001) break; else { if(count%2==0) sum-=a/b; else sum+=a/b; } } printf("%lf\n",sum); }
#include#definePI3.14159floaterea_round(floatr){//圆形面积returnr*r*PI;}floaterea_tri(floatd,floath){//三角形面积return0.5*d*h;}floaterea_rec(floata,floatb){//矩形面积returna*b;}intmain
#includestdio.h
#include math.h
void main()
{
double a,b,c,d;
scanf("%f,%f",b,d);
a=sin(b);/*这是三角函数*/
c=asin(d);/*这是反三角函数*/
printf("sin(b)=%f,asin(d)=%d",a,c);
}
其他三角函数如cos(x)什么的,可以直接用,前提有math.h的头文件