Do you know where your variables are? | |
PerlMonks |
integer container for floatby basiliscos (Pilgrim) |
on Mar 28, 2016 at 11:21 UTC ( [id://1158943]=perlquestion: print w/replies, xml ) | Need Help?? |
basiliscos has asked for the wisdom of the Perl Monks concerning the following question: Hello Monks, The business values I operated are floats; meanwhile the module I use to them in shared memory uses integers, that also guarantees the atomicity of writing int-values in shared memory. Is there any way to pack (not convert) float to integer, without loosing precision? Way# 1
Obviously, I loose precision here. In C I can do to manipulation with pointers, to get the result I like:
Then I've found can do something like that via pack/upack build-ins in Perl:
Seems fine.
Thanks!
WBR, basiliscos.
Back to
Seekers of Perl Wisdom
|
|