Hi Liya Fan, I'm not sure if this is a good idea. First, floating point operations have more edge cases than integer arithmetic (e.g. dealing with NaNs). Second, and I apologize that I've been remiss in thinking this through on reviews, but I think we should be thinking about how to make algorithms/operations as efficient as possible. In this regards putting everything behind an interface prevents the JVM JIT from inlining them effectively.
It might not be a bad idea to have a have a common interface for just the Float4 and Float8 vectors, but I'd like to get other peoples thoughts on this. Thanks, Micah On Wed, Aug 14, 2019 at 7:26 PM Fan Liya <liya.fa...@gmail.com> wrote: > Dear all, > > > > We want to provide an interface for all vectors with numeric types (small > int, float4, float8, etc). This interface will make it convenient for many > operations on a vector, like average, sum, variance, etc. With this > interface, the client code will be greatly simplified, with many > branches/switch removed. > > > > The design is similar to BaseIntVector (the interface for all integer > vectors). We provide 3 methods for setting & getting numeric values: > > setWithPossibleRounding > > setSafeWithPossibleRounding > > getValueAsDouble > > > > Please give some comments. Thanks a lot. > > > > Best, > > Liya Fan >