[Python-Dev] decimal.py signals & traps (original) (raw)
Tim Peters tim.peters at gmail.com
Tue Jul 13 05:41:02 CEST 2004
- Previous message: [Python-Dev] decimal.py signals & traps
- Next message: [Python-Dev] Re: decorators and 2.4
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Michael Hudson]
Well, there's an argument that this may not be the most natural interface for a C implementation or for an implementation of such things for floats -- but this is an argument involving predicting the future, so probably should be ignored.
[Greg Ewing]
I don't think it should be ignored. If the future is uncertain, surely it would be better to err on the side of not exposing implementation details?
Since virtually all modern processors implement sticky flags, trap enablers, and rounding modes in FPU context & control registers, virtually all modern compilers support some idiosyncratic way to set and query them. Google on ieee_flags for one extreme in C, entirely string-based. Google on _control87 and/or _controlfp for the other C extreme, passing ints, with a pile of #defines to give different bits different meanings.
Both of those actually hide the implementation quite well -- although the latter is most often implemented in such a way that the bit positions remarkably correspond exactly to their meanings in the Pentium instructions that fiddle FPU context.
- Previous message: [Python-Dev] decimal.py signals & traps
- Next message: [Python-Dev] Re: decorators and 2.4
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]