Lines Matching refs:x

33     'mean':    lambda xs: Float(sum(float(x) for x in xs) / len(xs)),
36 m.sqrt(sum((float(x) - mean)**2 for x in xs) / len(xs)))
37 )(sum(float(x) for x in xs) / len(xs)),
38 'gmean': lambda xs: Float(m.prod(float(x) for x in xs)**(1/len(xs))),
41 m.exp(m.sqrt(sum(m.log(float(x)/gmean)**2 for x in xs) / len(xs)))
43 )(m.prod(float(x) for x in xs)**(1/len(xs))),
50 def __new__(cls, x=0): argument
51 if isinstance(x, Int):
52 return x
53 if isinstance(x, str):
55 x = int(x, 0)
58 if re.match('^\s*\+?\s*(?:∞|inf)\s*$', x):
59 x = m.inf
60 elif re.match('^\s*-\s*(?:∞|inf)\s*$', x):
61 x = -m.inf
64 assert isinstance(x, int) or m.isinf(x), x
65 return super().__new__(cls, x)
68 if self.x == m.inf:
70 elif self.x == -m.inf:
73 return str(self.x)
76 assert not m.isinf(self.x)
77 return self.x
80 return float(self.x)
90 new = self.x if self else 0
91 old = other.x if other else 0
101 new = self.x if self else 0
102 old = other.x if other else 0
117 return self.__class__(self.x + other.x)
120 return self.__class__(self.x - other.x)
123 return self.__class__(self.x * other.x)
128 def __new__(cls, x=0.0): argument
129 if isinstance(x, Float):
130 return x
131 if isinstance(x, str):
133 x = float(x)
136 if re.match('^\s*\+?\s*(?:∞|inf)\s*$', x):
137 x = m.inf
138 elif re.match('^\s*-\s*(?:∞|inf)\s*$', x):
139 x = -m.inf
142 assert isinstance(x, float), x
143 return super().__new__(cls, x)
146 if self.x == m.inf:
148 elif self.x == -m.inf:
151 return '%.1f' % self.x
154 return float(self.x)
186 t = self.a.x/self.b.x if self.b.x else 1.0
207 new = new_a.x/new_b.x if new_b.x else 1.0
208 old = old_a.x/old_b.x if old_b.x else 1.0
221 self_t = self.a.x/self.b.x if self.b.x else 1.0
222 other_t = other.a.x/other.b.x if other.b.x else 1.0
223 return (self_t, self.a.x) < (other_t, other.a.x)
548 ' '.join('%*s' % (w, x)
549 for w, x in zip(widths[1:], line[1:-1])),
745 type=lambda x: (
747 )(*x.split('=', 1)),
753 type=lambda x: (
755 )(*x.split('=', 1)),
761 type=lambda x: (lambda k,v: (k, set(v.split(','))))(*x.split('=', 1)),