diff --git a/src/tech/v3/datatype/array_buffer.clj b/src/tech/v3/datatype/array_buffer.clj index d9999bd8..784b6e3a 100644 --- a/src/tech/v3/datatype/array_buffer.clj +++ b/src/tech/v3/datatype/array_buffer.clj @@ -240,7 +240,7 @@ :int64 (Arrays/fill ^longs ary-data offset end-offset (unchecked-long value)) :float32 (Arrays/fill ^floats ary-data offset end-offset (unchecked-float value)) - :float64 (Arrays/fill ^longs ary-data offset end-offset (unchecked-long value)) + :float64 (Arrays/fill ^doubles ary-data offset end-offset (unchecked-double value)) (Arrays/fill ^"[Ljava.lang.Object;" ary-data offset end-offset value)))) dtype-proto/PClone (clone [this] diff --git a/test/tech/v3/datatype_test.clj b/test/tech/v3/datatype_test.clj index 1c142197..9ebaaa5d 100644 --- a/test/tech/v3/datatype_test.clj +++ b/test/tech/v3/datatype_test.clj @@ -717,3 +717,18 @@ (deftest ->reader-bad-dtype (is (thrown? Throwable (dtype/->reader [1 2 3] :foo)))) + + +(deftest set-constant-all-numeric-dtypes + (let [dtypes [:int8 :uint8 + :int16 :uin16 + :int32 :uint32 + :int64 :uint64 + :float32 :float64] + containers [:jvm-heap :native-heap]] + (for [dtype dtypes + container containers] + (let [data (dtype/make-container container dtype 10)] + (dtype/set-constant! data 1) + (is (= (mapv long (dtype/->reader data)) + (vec (repeat 10 1))))))))