def bla(x: UInt) -> UInt:
return x * 2
def laber(x: UInt) -> UInt:
return x / 10
def main():
print(bla(3))
print(laber(10))
fails with
bla.mojo:4:14: error: cannot implicitly convert ‘SIMD[float64, 1]’ value to ‘UInt’
Is this expected?
sora
2
This is expected (and consistent with Python, at least).
The issue is that x / 10
results in a Float64
, you might want to use x // 10
.
1 Like
bgreni
(Brian Grenier)
4
It should be noted that SIMD
integer types do not share this behaviour and work as you had expected
def laber(x: Int64) -> Int64:
return x / 10
def main():
print(laber(10))
2 Likes