C語言math頭文件(math.h)中frexp函數的用法及代碼示例。
用法:
double frexp (double x , int* exp);
float frexpf (float x , int* exp);
long double frexpl (long double x, int* exp);
獲得重要和 index
0.5
(包括)和1.0
(不包括))和2
,這樣:x =有效位數* 2exponent
這個exponent存儲在由指向的位置exp和significand是該函數返回的值。
如果x為零,兩個部分(有效數和 index )均為零。
如果x是負數,重要的此函數返回的結果為負。
標頭<tgmath.h>提供此函數的type-generic宏版本。
參數
- x
- 待分解的價值。
- exp
- 指向一個指針
int
存儲 index 值的位置。
返回值
的二進製有效位x。該值是浮點值,其絕對值位於區間中
[0.5,1)
乘以2
提升到exp,產量x。示例
/* frexp example */
#include <stdio.h> /* printf */
#include <math.h> /* frexp */
int main ()
{
double param, result;
int n;
param = 8.0;
result = frexp (param , &n);
printf ("%f = %f * 2^%d\n", param, result, n);
return 0;
}
輸出:
8.000000 = 0.500000 * 2^4 |
相關用法
- C語言 cos用法及代碼示例
- C語言 sin用法及代碼示例
- C語言 tan用法及代碼示例
- C語言 acos用法及代碼示例
- C語言 asin用法及代碼示例
- C語言 atan用法及代碼示例
- C語言 atan2用法及代碼示例
- C語言 cosh用法及代碼示例
- C語言 sinh用法及代碼示例
- C語言 tanh用法及代碼示例
- C語言 acosh用法及代碼示例
- C語言 asinh用法及代碼示例
- C語言 atanh用法及代碼示例
- C語言 exp用法及代碼示例
- C語言 ldexp用法及代碼示例
- C語言 log用法及代碼示例
- C語言 log10用法及代碼示例
- C語言 modf用法及代碼示例
- C語言 exp2用法及代碼示例
- C語言 expm1用法及代碼示例
- C語言 ilogb用法及代碼示例
- C語言 log1p用法及代碼示例
- C語言 log2用法及代碼示例
- C語言 logb用法及代碼示例
- C語言 scalbn用法及代碼示例
- C語言 scalbln用法及代碼示例
- C語言 pow用法及代碼示例
- C語言 sqrt用法及代碼示例
- C語言 cbrt用法及代碼示例
- C語言 hypot用法及代碼示例
- C語言 erf用法及代碼示例
- C語言 erfc用法及代碼示例
- C語言 tgamma用法及代碼示例
- C語言 lgamma用法及代碼示例
- C語言 ceil用法及代碼示例
- C語言 floor用法及代碼示例
- C語言 fmod用法及代碼示例
- C語言 trunc用法及代碼示例
- C語言 round用法及代碼示例
- C語言 lround用法及代碼示例
- C語言 llround用法及代碼示例
- C語言 rint用法及代碼示例
- C語言 lrint用法及代碼示例
- C語言 llrint用法及代碼示例
- C語言 nearbyint用法及代碼示例
- C語言 remainder用法及代碼示例
- C語言 remquo用法及代碼示例
- C語言 copysign用法及代碼示例
- C語言 nextafter用法及代碼示例
- C語言 nexttoward用法及代碼示例
- C語言 fdim用法及代碼示例
- C語言 fmax用法及代碼示例
- C語言 fmin用法及代碼示例
- C語言 fabs用法及代碼示例
- C語言 abs用法及代碼示例
- C語言 fma用法及代碼示例
- C語言 isfinite用法及代碼示例
- C語言 isgreater用法及代碼示例
- C語言 isgreaterequal用法及代碼示例
- C語言 isless用法及代碼示例
- C語言 islessequal用法及代碼示例
- C語言 islessgreater用法及代碼示例
- C語言 isunordered用法及代碼示例
注:本文由純淨天空篩選整理自C標準庫大神的英文原創作品 C frexp function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。