📄 modf.c
字号:
#ifndef lintstatic char sccsid[] = "@(#)modf.c 1.1 92/07/30 SMI"; /* from ATT S5R3 */#endif/* The following is extracted from... *//* Copyright (c) 1984 AT&T *//* All Rights Reserved *//* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T *//* The copyright notice above does not evidence any *//* actual or intended publication of such source code. *//* * modf(value, iptr) returns the signed fractional part of value * and stores the integer part indirectly through iptr. * */#define MAXPOWTWO 4.503599627370496000E+15 /* doubles >= MAXPOWTWO are already integers */doublemodf(value, iptr)double value;register double *iptr;{ register double absvalue; if ((absvalue = (value >= 0.0) ? value : -value) >= MAXPOWTWO) *iptr = value; /* it must be an integer */ else { *iptr = absvalue + MAXPOWTWO; /* shift fraction off right */ *iptr -= MAXPOWTWO; /* shift back without fraction */ while (*iptr > absvalue) /* above arithmetic might round */ *iptr -= 1.0; /* test again just to be sure */ if (value < 0.0) *iptr = -*iptr; } return (value - *iptr); /* signed fractional part */}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -