Message137647
float_info.rounds is a bit of an odd fish, and I think it was probably a mistake to include it in sys.float_info in the first place.
All the other float_info fields relate to parameters of the floating-point format, which is fixed, useful information. In contrast, float_info.rounds gives information about the current FPU settings, which are variable. Moreover, it doesn't do that very well: all it does is give information about the FPU settings at the time that Python was compiled, which isn't really very helpful (and perhaps not even that: it reports the value of FLT_ROUNDS, which may not even reflect those FPU settings accurately). I wouldn't mind seeing this field fade quietly into obscurity.
FWIW, the value is taken from C's FLT_ROUNDS, and its interpretation is *supposed* to be the following (C99 5.2.4.2.2, para 7):
-1: The compiler was unable to determine rounding mode.
0: Round towards zero.
1: Round to nearest (this is the most likely value for
float_info.rounds on common platforms).
2: Round towards positive infinity
3: Round towards negative infinity. |
|
Date |
User |
Action |
Args |
2011-06-04 15:14:43 | mark.dickinson | set | recipients:
+ mark.dickinson, rhettinger, docs@python |
2011-06-04 15:14:43 | mark.dickinson | set | messageid: <1307200483.18.0.174086604847.issue12245@psf.upfronthosting.co.za> |
2011-06-04 15:14:42 | mark.dickinson | link | issue12245 messages |
2011-06-04 15:14:42 | mark.dickinson | create | |
|