in reply to Is there a better way to call fe(get|set)round?

I recently read something about custom pragmas being allowed in experimental and future releases of Perl. So, I'm thinking that for the user, it might be a good idea if you make it a pragma. That way, its scope will be lexical, and outside the embedding block, floating rounding will happen as usual. Well, that's my basic idea, anyway; I'm not sure you can successfully use pragmas for this purpose. integer is a pragma, and my role model here.

Another idea is using a global tied variable (setting a value will call fesetround() and reading it fegetround()), so you can use local on it. Hence, the scope will then be temporal instead of lexical, so calculations in other modules will be affected while called from the current scope. And when you leave the block, the old value will be restored.

  • Comment on Re: Is there a better way to call fe(get|set)round?

Replies are listed 'Best First'.
Re^2: Is there a better way to call fe(get|set)round?
by HollyKing (Pilgrim) on Jul 04, 2007 at 18:44 UTC
    Thanks for the ideas. I'll keep them in mind should I end up implementing this.

    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.