-
Notifications
You must be signed in to change notification settings - Fork 135
Closed as duplicate of#544
Description
Summary
The result of an integer to the power of a float returns type int instead of float. The Minimal Playground Example shows int instead of float.
If I use it with jax Array, type int is expected instead of Array. If i use a a float like 10.0**1.2 its working as expected.
# /// script
# requires-python = ">=3.13"
# dependencies = ["jax"]
# ///
import jax
from jax import Array
def main() -> None:
a: Array = jax.numpy.array([1.1, 2.1, 3.1])
b: int = 10**a
c: Array = 10**a
d: Array = 10.0**a
e: Array = jax.numpy.power(10, a)
f: int = 10**1.2
print(f"a: {a}, b: {b}, c: {c}, d: {d}, e: {e}, f: {f}")
if __name__ == "__main__":
main()Output of ty check:
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
Checking ------------------------------------------------------------ 1/1 files error[invalid-assignment]: Object of type `int` is not assignable to `Array`
--> ty_issue.py:13:5
|
11 | a: Array = jax.numpy.array([1.1, 2.1, 3.1])
12 | b: int = 10**a
13 | c: Array = 10**a
| ^
14 | d: Array = 10.0**a
15 | e: Array = jax.numpy.power(10, a)
|
info: rule `invalid-assignment` is enabled by default
Found 1 diagnostic
Version
ty 0.0.1-alpha.17
Metadata
Metadata
Assignees
Labels
No labels