Ignore:
Timestamp:
05/15/06 14:43:58 (8 years ago)
Author:
xi
Message:

Dynamically determine the inf and nan values. Should fix #14.
Thanks to Scott Daniels for the report and the patch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyyaml/trunk/lib/yaml/representer.py

    r152 r168  
    193193        return self.represent_scalar(u'tag:yaml.org,2002:int', unicode(data)) 
    194194 
    195     repr_pos_inf = repr(1e300000) 
    196     repr_neg_inf = repr(-1e300000) 
    197     repr_nan = repr(1e300000/1e300000) 
     195    inf_value = 1e300 
     196    while repr(inf_value) != repr(inf_value*inf_value): 
     197        inf_value *= inf_value 
     198    nan_value = inf_value/inf_value 
     199 
     200    repr_pos_inf = repr(inf_value) 
     201    repr_neg_inf = repr(-inf_value) 
     202    repr_nan = repr(inf_value/inf_value) 
    198203 
    199204    def represent_float(self, data): 
Note: See TracChangeset for help on using the changeset viewer.