weld icon indicating copy to clipboard operation
weld copied to clipboard

Pow on types other than float

Open radujica opened this issue 7 years ago • 0 comments

There's a comment in the source saying pow is only supported for 'floats'. I presume support for integers would also be possible?

EDIT: The following is actually incorrect Weld code.

Could not compile function |_inp0: vec[f64]| 
       result(
           for(_inp0, 
               appender[f64], 
               |b: appender[f64], i: i64, n: f64| 
                   merge(b, pow(n, 2))
           )
       ): b'Type mismatch: expected i32 but got f64'

The following clearly work:

|_inp0: vec[f64]| 
       result(
           for(_inp0, 
               appender[f64], 
               |b: appender[f64], i: i64, n: f64| 
                   merge(b, pow(n, 2.0))
           )
       )

or:

|_inp0: vec[f32]| 
       result(
           for(_inp0, 
               appender[f32], 
               |b: appender[f32], i: i64, n: f32| 
                   merge(b, pow(n, 2f))
           )
       )

radujica avatar Sep 06 '18 12:09 radujica