//-----------------------------------------------------------------------------
//      주어진 float 값을 Digit 곱한 정수값을 리턴함
//      float(IEEE-754) 값을 정수로 변환함
//      INTPARTBITS==25 이면 (0.1 ~ 200,0000.0 범위)
//          Fixed 25:7  25비트 정수에 7비트 소수점자리임
//-----------------------------------------------------------------------------
#define INTPARTBITS     25  //고정소숫점방식에서 정수부로 할당된 비트수
#define FRACPARTBITS    (32-INTPARTBITS)
int WINAPI FloatToInt(UINT Float, UINT Digit, UINT Max)
    {
    int  Exp, Value=Max;
    UINT Frac;

    Frac=(Float|0x800000)<<8;   //생략된 비트를 설정하고 맨 앞으로 밀착
    Exp=((Float<<1)>>24)-126-INTPARTBITS; //지수

    if (Exp>0) goto ProcExit;   //OverFlow

    Exp=-Exp;
    if (Exp<INTPARTBITS)        //정수부가 있는 경우
        {
        Frac>>=Exp;
        if ((Frac>>FRACPARTBITS)>Max/Digit) goto ProcExit;  //OverFlow
        Value=(Frac>>FRACPARTBITS)*Digit + UMulDiv((Frac<<INTPARTBITS)>>INTPARTBITS, Digit, 1<<FRACPARTBITS);
        }
    else{                           //유효숫자는 모두 소수부
        Frac>>=Exp-INTPARTBITS+1;   //+1은 양수 범위로 만들기 위함
        Value=UMulDiv(Frac, Digit, 0x80000000); //= 1<<31
        }

    ProcExit:
    if ((Float>>31)!=0) Value=-Value;
    return Value;
    }