Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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?
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://624250]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-08-22 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (147 votes), past polls