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

📄 frexp.c

📁 基于4个mips核的noc设计
💻 C
字号:
/* * lib-src/ansi/math/frexp.c * ANSI/ISO 9899-1990, Section 7.5.4.2. * * frexp(double value, int *exp) * Return the significand of value scaled to the range [+-][.5, 1.) * and store the appropriate binary exponent into *exp. * * Exceptions: *	Error	Return	Store		Condition *	EDOM	NaN	0		value is NaN *	ERANGE	[+-]0.5	[+-]INT_MAX	value is +Infinity * * This source assumes IEEE-format doubles but does not deal with denormals. */#include "mathlib.h"#include <limits.h>#if	defined(__IEEE_FP__)doublefrexp(double value, int *exp){	DOUBLE u;	if (_isNaN(value)) {		errno = EDOM;		*exp = 0;		return value;		/* NaN: domain error, store 0, return NaN */	} else if (_isInfinity(value)) {		errno = ERANGE;		*exp = INT_MAX;		/* [+-]Infinity: range error, store INT_MAX, return [+-]0.5*/		return (value < 0.0) ? -0.5 : 0.5;	}	/* Zero. */	if (value == 0.0) {		*exp = 0;		return value;	}	/*	 * Normalized value.	 * Extract and set exponent using union DOUBLE, cf. "mathlib.h".	 * A double with an exponent of EXP_BIAS - 1 is in the range [.5, 1.).	 */	u.d = value;	*exp = (int)u.D.exponent - (EXP_BIAS - 1);	/* extract and unbias */	u.D.exponent = EXP_BIAS - 1;			/* adjust */	return u.d;}#else#error	!defined(__IEEE_FP__)#endif	/* defined(__IEEE_FP__) */

⌨️ 快捷键说明

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