⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ldexp.c

📁 VXWORKS源代码
💻 C
字号:
/* ldexp.c - ldexp math routine *//* Copyright 1992-1993 Wind River Systems, Inc. *//*modification history--------------------01h,05feb99,dgp  document errno values01g,05feb93,jdi  doc changes based on kdl review.01f,02dec92,jdi  doc tweaks.01e,28oct92,jdi  documentation cleanup.01d,21sep92,smb  replaced original version.01c,20sep92,smb  documentation additions01b,30jul92,kdl  replaced routine contents with ldexp() from floatLib.c.01a,08jul92,smb  written, documentation.*//*DESCRIPTIONSEE ALSO: American National Standard X3.159-1989NOMANUAL*/#include "math.h"#include "stddef.h"#include "errno.h"#include "private/mathP.h"/********************************************************************************* ldexp - multiply a number by an integral power of 2 (ANSI)** This routine multiplies a floating-point number by an integral power of 2.* A range error may occur.** INCLUDE FILES: math.h** RETURNS: The double-precision value of <v> times 2 to the power of <xexp>.** ERRNO: EDOM, ERANGE**/double ldexp    (    double v,		/* a floating point number */    int xexp		/* exponent                */    )    {    double zero = 0.0;    switch (fpTypeGet (v, NULL))	       	{       	case NAN:		/* NOT A NUMBER */            errno = EDOM;	    break;    	case INF:		/* INFINITE */	    errno = ERANGE;	    break;    	case ZERO:		/* ZERO */	    return (zero);	default:	    if (xexp >= 0)		for(; (xexp > 0); xexp--, v *= 2.0);	    else		for(; (xexp < 0); xexp++, v /= 2.0);	    return (v);    	}    return (zero);    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -