yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #10787
Re: [Question #260626]: Precision of variables saved using O.save
Hello,
you can also easily try it yourself:
import random; r=random.random
O.bodies.append(sphere((r(),r(),r()),1))
base = '/tmp/a.'
for ext in 'yade','xml':
print O.bodies[0].state.pos[0]
O.save(base+ext)
O.reset()
O.load(base+ext)
print O.bodies[0].state.pos[0]
my output:
0.872136848902
0.872136848902
0.872136848902
0.872136848902
it means that in both .yade and .xml format, the numbers (double precision
numbers) are saved in maximum possible precision. Do you have any problems
with O.save/O.load?
cheers
Jan
2015-01-21 9:41 GMT+01:00 Bruno Chareyre <
question260626@xxxxxxxxxxxxxxxxxxxxx>:
> Question #260626 on Yade changed:
> https://answers.launchpad.net/yade/+question/260626
>
> Bruno Chareyre proposed the following answer:
> Hi,
> Precision depends on which format you save to. If you save in binary
> (filename.yade) it will have the maximum precision.
> If you save in xml there is a conversion to string, and in that case I'm
> not sure what happens. You could check that in boost::serialization.
> I hope it helps.
> Bruno
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>
Follow ups
References