In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.
Become a Premium Member and unlock a new, free course in leading technologies each month.
Function EntConvertInts ( Const Int2 : SmallInt; Const Int4 : LongInt) : Double; StdCall;
Var
TheRealArray : Array [1..6] Of Char;
TheReal : Real;
Begin
Move (Int2, TheRealArray[1], 2);
Move (Int4, TheRealArray[3], 4);
Move (TheRealArray[1], TheReal, 6);
Result := TheReal;
End
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
typedef unsigned char pasreal[6];
typedef unsigned char bassngl[4];
typedef unsigned char basdble[8];
typedef union {
double value;
unsigned char byte[8];
} IEEEdouble;
double pasrealtodouble(pasreal OldNum);
double bassngltodouble(bassngl OldNum);
double basdbletodouble(basdble OldNum);
void doubletopasreal(pasreal *New, double Old);
void doubletobassngl(bassngl *New, double Old);
void doubletobasdble(basdble *New, double Old);
/* converts TP 6-byte real to IEEE 8-byte real */
double pasrealtodouble(pasreal OldNum) {
IEEEdouble NewNum;
char Sign;
int Exp;
int X;
for(X = 0; X < 2; X++)
NewNum.byte[X] = 0x00;
Sign = OldNum[5] & 0x80;
Exp = OldNum[0] - 0x81 + 0x3FF;
NewNum.byte[6] = (Exp << 4);
NewNum.byte[7] = (Exp >> 4) | Sign;
for(X = 5; X > 1; X--) {
OldNum[X] <<= 1;
OldNum[X] |= OldNum[X-1] >> 7;
}
OldNum[1] <<= 1;
for(X = 6; X >= 2; X--) {
NewNum.byte[X] |= OldNum[X-1] >> 4;
NewNum.byte[X-1] = OldNum[X-1] << 4;
}
return(NewNum.value);
}
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.