save double type to file



所有跟贴·加跟贴·新语丝科技论坛

送交者: neo6 于 2005-5-25, 01:26:36:

I saved double type to file simply using fprintf (file, "%lg\n", data)
and later load it using fscanf (file, "%lg\n", &data)
these data then go through some fft stuff

I found this only save 6 or 7 digits, however, previously it works fine

but recently I got some weired results when my data is 32k, 64k, 128k

I am wondering wether the precision loss during the simple save and load caused this

do you think this could be a cause?

also what's the standard way to save and load double type to a text file? I am now change to fprintf(file, "%30.16lg\n", data) but I prefer some standard way to do that

thanks



所有跟贴:


加跟贴

笔名: 密码(可选项): 注册笔名请按这里

标题:

内容(可选项):

URL(可选项):
URL标题(可选项):
图像(可选项):


所有跟贴·加跟贴·新语丝科技论坛