GridTools / gt4py

Python library for generating high-performance implementations of stencil kernels for weather and climate modeling from a domain-specific language (DSL).
https://GridTools.github.io/gt4py
Other
107 stars 48 forks source link

next: unsupported negative floating point number casts #1643

Open dastrm opened 6 days ago

dastrm commented 6 days ago

Using -float(1) anywhere within a field operator works, whereas float(-1) does not.

tehrengruber commented 6 days ago

This should be simple to add. The syntax type_name(scalar_val) is only implemented for literals, but float(-1) is actually a unary op on a literal, which is why it doesn't work. With GTIR the always somewhat artificial looking restriction that the argument has to be a literal is not required anymore anyway so we can fix this in one go.