Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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

by bart (Canon)
on Jun 30, 2007 at 22:28 UTC ( #624250=note: print w/replies, xml ) Need Help??

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://624250]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2018-02-25 01:40 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (312 votes). Check out past polls.