FloatExpLen=8;

FloatMantissaLen=23;

FloatBits=FloatExpLen+FloatMantissaLen+1;

FloatMaxExponent=BitShiftLeft[1,FloatExpLen-1]-1;

FloatExpMask=BitShiftLeft[1,FloatExpLen]-1;

FloatMantissaMask=BitShiftLeft[1,FloatMantissaLen]-1;

convertFloatSubnormal[sign_, mantissa_]:=(-1)^sign*(mantissa/(BitShiftLeft[1,((FloatBits-(FloatExpLen+1))+FloatMaxExponent-1)]))

convertFloatNaN[sign_, exp_, mantissa_]:=If[mantissa==0 ,If[sign==0,"Inf","-Inf"], "NaN"]

convertFloatNormal[sign_, exp_, mantissa_]:=(-1)^sign*(BitShiftLeft[1,FloatMantissaLen]+mantissa)/(2^(FloatMantissaLen-(exp-FloatMaxExponent)))

convertFloat[sign_, exp_, mantissa_]:=If[exp==FloatExpMask,convertFloatNaN[sign,exp,mantissa], If[exp==0,convertFloatSubnormal[sign, mantissa], convertFloatNormal[sign, exp, mantissa]]]

convertFloatDWORD[dw_]:=convertFloat[BitShiftRight[dw,FloatBits-1],BitAnd[BitShiftRight[dw,FloatMantissaLen],FloatExpMask],BitAnd[dw,FloatMantissaMask]]

N[convertFloatDWORD[16^^3dcccccd],100]

convertFloatDWORD[0]//N

N[convertFloatDWORD[16^^3f800000],100]

convertFloatDWORD[16^^bf800000]//N

convertFloatDWORD[16^^390173f8]//N

convertFloatDWORD[16^^ffffffff]//N

convertFloatDWORD[16^^ff800000]//N

convertFloatDWORD[16^^7f800000]//N

DoubleExpLen=11;

DoubleMantissaLen=52;

DoubleBits=DoubleExpLen+DoubleMantissaLen+1;

DoubleMaxExponent=BitShiftLeft[1,DoubleExpLen-1]-1;

DoubleExpMask=BitShiftLeft[1,DoubleExpLen]-1;

DoubleMantissaMask=BitShiftLeft[1,DoubleMantissaLen]-1;

convertDoubleSubnormal[sign_, mantissa_]:=(-1)^sign*(mantissa/(BitShiftLeft[1,((DoubleBits-(DoubleExpLen+1))+DoubleMaxExponent-1)]))

convertDoubleNaN[sign_, exp_, mantissa_]:=If[mantissa==0 ,If[sign==0,"Inf","-Inf"], "NaN"]

convertDoubleNormal[sign_, exp_, mantissa_]:=(-1)^sign*(BitShiftLeft[1,DoubleMantissaLen]+mantissa)/(2^(DoubleMantissaLen-(exp-DoubleMaxExponent)))

convertDouble[sign_, exp_, mantissa_]:=If[exp==DoubleExpMask,convertDoubleNaN[sign,exp,mantissa], If[exp==0,convertDoubleSubnormal[sign, mantissa], convertDoubleNormal[sign, exp, mantissa]]]

convertDoubleQWORD[dw_]:=convertDouble[BitShiftRight[dw,DoubleBits-1],BitAnd[BitShiftRight[dw,DoubleMantissaLen],DoubleExpMask],BitAnd[dw,DoubleMantissaMask]]

two=N[convertDoubleQWORD[16^^3fc999999999999a],200]

three=N[convertDoubleQWORD[16^^3fd3333333333334],200]

N[convertDoubleQWORD[16^^3c90000000000000],200]

one=N[convertDoubleQWORD[16^^3fb999999999999a],200]

one+two

three

one+two+three

N[convertDoubleQWORD[1],200]

x=N[convertDoubleQWORD[16^^3fd3333333333333],200]

y=N[convertDoubleQWORD[16^^3fd3333333333334],200]

a=Import["~/tmp/test","CSV"]

getError[ref_,my_]:=(convertFloatDWORD[my]-ref)/ref

Max[Table[getError[a[[i]][[2]],a[[i]][[1]]],{i,1,Length[a]}]]

Min[Table[getError[a[[i]][[2]],a[[i]][[1]]],{i,1,Length[a]}]]

a=N[convertDoubleQWORD[16^^3fb999999999999a],100]

b=N[convertDoubleQWORD[16^^3fc999999999999a],100]

a+b

N[convertDoubleQWORD[16^^3fd3333333333334],100]

N[convertDoubleQWORD[16^^3fd3333333333334],100]-N[convertDoubleQWORD[16^^3fd3333333333333],100]

N[convertDoubleQWORD[16^^3fb999999999999a],100]

N[convertFloatDWORD[16^^3dcccccd],100]

N[convertFloatDWORD[16^^3dcccccd-1],100]

N[convertFloatDWORD[16^^3dcccccd+1],100]