Closed Xayah-Hina closed 2 years ago
As the error message suggests: Trigonometric operator takes real inputs only.
, ti.sin
expects real numbers (i.e. floating-point numbers) as argument. We may use x = 9.0
to let x
have a type float
, therefore fix this problem.
@xumingkuan I think we can actually cast the argument of int32/int64 to float32/float64 at this case?
Thank you so much XD
IMHO we don't want to allow the implicit cast of trigonometric operator's input to float-point values, because users may be writing degrees instead of radians.
For example, when a user writes ti.sin(45)
, it's very likely that what they really want is ti.sin(math.pi / 4)
. I think the error message can remind users to double-check errors like this...
If there exists some need for trigonometric functions of integral radians, maybe we can change the error to a warning then? (Of course, users can explicitly cast them now.)
This is no longer a bug rn as it outputs a proper type error: 'sin' takes real inputs only, however 'i32' is provided
Describe the bug
Hello, I found
ti.sin()
could not work with a local variable.[Environment]:
I'm new to Taichi, and wonder if this is just a feature or something?
Best regards.
To Reproduce
Log/Screenshots