1. Recently doing some sqlite3 things, defined a blob type of field, want to put double-precision floating point in here, so the strange thing happened. Double precision floating point number 13.46, hex 402A EB85 1eb8 51EC, but sqlite inside data is 402A CB85 1ec2 B851 efbf BD, this tm what ghost, code as follows:
$str=$common->DoubleToHex(13.46);$s=hex2bin($str);echo $str;//输出的结果是402A EB85 1EB8 51EC,这是正确的$data->InsertData("table01", "'SS','0','".$s."'","time,timespan,data");//把数据插入到sqlite里面,数据就不对了
Strangely, the error occurs only when the double is created, and the other data formats are no problem.
Reply content:
1. Recently doing some sqlite3 things, defined a blob type of field, want to put double-precision floating point in here, so the strange thing happened. Double precision floating point number 13.46, hex 402A EB85 1eb8 51EC, but sqlite inside data is 402A CB85 1ec2 B851 efbf BD, this tm what ghost, code as follows:
$str=$common->DoubleToHex(13.46);$s=hex2bin($str);echo $str;//输出的结果是402A EB85 1EB8 51EC,这是正确的$data->InsertData("table01", "'SS','0','".$s."'","time,timespan,data");//把数据插入到sqlite里面,数据就不对了
Strangely, the error occurs only when the double is created, and the other data formats are no problem.