|Pathologically Eclectic Rubbish Lister|
Is there a better way to call fe(get|set)round?by HollyKing (Pilgrim)
|on Jun 29, 2007 at 18:00 UTC||Need Help??|
HollyKing has asked for the
wisdom of the Perl Monks concerning the following question:
I have a need to control the rounding direction being used for floating point calculations. In C I would just call fegetround() and fesetround(). I have used Inline::C with some success, but I wonder if there isn't a better way to accomplish the same thing.
Is there some magic flag or module that will let me manipulate the rounding mode? I think my options are:
I've included a small program below that shows my current solution. This works with Strawberry Perl although I have yet to test it anywhere else so YMMV.
Owl looked at him, and wondered whether to push him off the tree; but, feeling that he could always do it afterwards, he tried once more to find out what they were talking about.