MCPcopy Create free account
hub / github.com/numpy/numpy / _fix_int_lt_zero

Function _fix_int_lt_zero

numpy/lib/scimath.py:140–164  ·  view source on GitHub ↗

Convert `x` to double if it has real, negative components. Otherwise, output is just the array version of the input (via asarray). Parameters ---------- x : array_like Returns ------- array Examples -------- >>> np.lib.scimath._fix_int_lt_zero([1,2]) a

(x)

Source from the content-addressed store, hash-verified

138
139
140def _fix_int_lt_zero(x):
141 """Convert `x` to double if it has real, negative components.
142
143 Otherwise, output is just the array version of the input (via asarray).
144
145 Parameters
146 ----------
147 x : array_like
148
149 Returns
150 -------
151 array
152
153 Examples
154 --------
155 >>> np.lib.scimath._fix_int_lt_zero([1,2])
156 array([1, 2])
157
158 >>> np.lib.scimath._fix_int_lt_zero([-1,2])
159 array([-1., 2.])
160 """
161 x = asarray(x)
162 if any(isreal(x) & (x < 0)):
163 x = x * 1.0
164 return x
165
166
167def _fix_real_abs_gt_1(x):

Callers 1

powerFunction · 0.85

Calls 3

anyFunction · 0.90
isrealFunction · 0.90
asarrayFunction · 0.50

Tested by

no test coverage detected