pow_hh.c

来自「DTMK软件开发包,此为开源软件,是一款很好的医学图像开发资源.」· C语言 代码 · 共 40 行

C
40
字号
#include "v3p_f2c.h"
#ifdef __cplusplus
extern "C" {
#endif

#ifdef KR_headers
shortint pow_hh(ap, bp) shortint *ap, *bp;
#else
shortint pow_hh(shortint *ap, shortint *bp)
#endif
{
        shortint pow, x, n;
        unsigned u;

        x = *ap;
        n = *bp;

        if (n <= 0) {
                if (n == 0 || x == 1)
                        return 1;
                if (x != -1)
                        return x == 0 ? 1/x : 0;
                n = -n;
                }
        u = n;
        for(pow = 1; ; )
                {
                if(u & 01)
                        pow *= x;
                if(u >>= 1)
                        x *= x;
                else
                        break;
                }
        return(pow);
        }
#ifdef __cplusplus
}
#endif

⌨️ 快捷键说明

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