← Back to team overview

yade-users team mailing list archive

Re: [Question #260626]: Precision of variables saved using O.save

 

Question #260626 on Yade changed:
https://answers.launchpad.net/yade/+question/260626

Jan Stránský proposed the following answer:
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
>

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.