8
8
get_quadblas_version
9
9
)
10
10
11
- from dataclasses import dataclass
11
+ from dataclasses import dataclass , field
12
12
13
13
__all__ = [
14
14
'QuadPrecision' , 'QuadPrecDType' , 'SleefQuadPrecision' , 'LongDoubleQuadPrecision' ,
@@ -56,24 +56,24 @@ class QuadPrecFinfo:
56
56
used by the QuadPrecDType, similar to numpy.finfo but customized for
57
57
quad precision arithmetic.
58
58
"""
59
- bits : int = int ( bits )
60
- eps : float = float ( epsilon )
61
- epsneg : float = float ( epsilon )
62
- iexp : int = int ( precision )
59
+ bits : int = field ( default_factory = lambda : bits )
60
+ eps : float = field ( default_factory = lambda : epsilon )
61
+ epsneg : float = field ( default_factory = lambda : epsilon )
62
+ iexp : int = field ( default_factory = lambda : precision )
63
63
machar : object = None
64
- machep : float = float ( epsilon )
65
- max : float = float ( max_value )
66
- maxexp : float = float ( max_value )
67
- min : float = float ( smallest_normal )
68
- minexp : float = float ( smallest_normal )
69
- negep : float = float ( epsilon )
70
- nexp : int = int ( bits ) - int ( precision ) - 1
71
- nmant : int = int ( precision )
72
- precision : int = int ( precision )
73
- resolution : float = float ( resolution )
74
- tiny : float = float ( smallest_normal )
75
- smallest_normal : float = float ( smallest_normal )
76
- smallest_subnormal : float = float ( smallest_subnormal )
64
+ machep : float = field ( default_factory = lambda : epsilon )
65
+ max : float = field ( default_factory = lambda : max_value )
66
+ maxexp : float = field ( default_factory = lambda : max_value )
67
+ min : float = field ( default_factory = lambda : smallest_normal )
68
+ minexp : float = field ( default_factory = lambda : smallest_normal )
69
+ negep : float = field ( default_factory = lambda : epsilon )
70
+ nexp : int = field ( default_factory = lambda : bits - precision - 1 )
71
+ nmant : int = field ( default_factory = lambda : precision )
72
+ precision : int = field ( default_factory = lambda : precision )
73
+ resolution : float = field ( default_factory = lambda : resolution )
74
+ tiny : float = field ( default_factory = lambda : smallest_normal )
75
+ smallest_normal : float = field ( default_factory = lambda : smallest_normal )
76
+ smallest_subnormal : float = field ( default_factory = lambda : smallest_subnormal )
77
77
78
78
def get (self , attr ):
79
79
return getattr (self , attr , None )
@@ -82,4 +82,4 @@ def __str__(self):
82
82
return f"QuadPrecFinfo(precision={ self .precision } , resolution={ self .resolution } )"
83
83
84
84
def __repr__ (self ):
85
- return f"QuadPrecFinfo(max={ self .max } , min={ self .min } , eps={ self .eps } , bits={ self .bits } )"
85
+ return f"QuadPrecFinfo(max={ self .max } , min={ self .min } , eps={ self .eps } , bits={ self .bits } )"
0 commit comments