Skip to content

Commit 3eabbd4

Browse files
committed
✨ system-dependent extended precision scalar types
1 parent 3b8ccda commit 3eabbd4

File tree

8 files changed

+579
-183
lines changed

8 files changed

+579
-183
lines changed

src/numpy-stubs/__init__.pyi

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -519,12 +519,12 @@ __all__ = [ # noqa: RUF022
519519
"bitwise_and", "bitwise_count", "bitwise_invert", "bitwise_left_shift", "bitwise_not", "bitwise_or",
520520
"bitwise_right_shift", "bitwise_xor", "block", "bool", "bool_", "broadcast", "busday_count", "busday_offset",
521521
"busdaycalendar", "byte", "bytes_", "can_cast", "cbrt", "cdouble", "ceil", "character", "choose", "clip",
522-
"clongdouble", "complex128", "complex192", "complex256", "complex64", "complexfloating", "compress", "concat",
522+
"clongdouble", "complex128", "complex64", "complexfloating", "compress", "concat",
523523
"concatenate", "conj", "conjugate", "convolve", "copysign", "copyto", "correlate", "cos", "cosh", "count_nonzero",
524524
"cross", "csingle", "cumprod", "cumsum", "cumulative_prod", "cumulative_sum", "datetime64", "datetime_as_string",
525525
"datetime_data", "deg2rad", "degrees", "diagonal", "divide", "divmod", "dot", "double", "dtype", "e", "einsum",
526526
"einsum_path", "empty", "empty_like", "equal", "errstate", "euler_gamma", "exp", "exp2", "expm1", "fabs", "finfo",
527-
"flatiter", "flatnonzero", "flexible", "float128", "float16", "float32", "float64", "float96", "float_power",
527+
"flatiter", "flatnonzero", "flexible", "float16", "float32", "float64", "float_power",
528528
"floating", "floor", "floor_divide", "fmax", "fmin", "fmod", "format_float_positional", "format_float_scientific",
529529
"frexp", "from_dlpack", "frombuffer", "fromfile", "fromfunction", "fromiter", "frompyfunc", "fromstring", "full",
530530
"full_like", "gcd", "generic", "geomspace", "get_printoptions", "getbufsize", "geterr", "geterrcall", "greater",
@@ -595,6 +595,11 @@ __all__ = [ # noqa: RUF022
595595
"__version__",
596596
] # fmt: skip
597597

598+
if sys.platform == "win32" or sys.platform == "cygwin":
599+
__all__ += ["complex192", "float96"]
600+
else:
601+
__all__ += ["complex256", "float128"]
602+
598603
###
599604
# Constrained types (for internal use only)
600605

@@ -4698,8 +4703,10 @@ class longdouble(_FloatMixin[L[12, 16]], floating):
46984703
@override
46994704
def tolist(self, /) -> Self: ... # pyright: ignore[reportIncompatibleMethodOverride]
47004705

4701-
float96 = longdouble
4702-
float128 = longdouble
4706+
if sys.platform == "win32" or sys.platform == "cygwin":
4707+
float96 = longdouble
4708+
else:
4709+
float128 = longdouble
47034710

47044711
class complexfloating(inexact[complex]):
47054712
@override
@@ -4886,8 +4893,10 @@ class clongdouble(complexfloating):
48864893
#
48874894
def __complex__(self, /) -> complex: ...
48884895

4889-
complex192 = clongdouble
4890-
complex256 = clongdouble
4896+
if sys.platform == "win32" or sys.platform == "cygwin":
4897+
complex192 = clongdouble
4898+
else:
4899+
complex256 = clongdouble
48914900

48924901
# NOTE: The `object_` constructor returns the passed object, so instances with type `object_` cannot exists at runtime.
48934902
# NOTE: Because mypy does not fully support `__new__`, `object_` can't be made generic.

0 commit comments

Comments
 (0)