cnuernber / dtype-next

A Clojure library designed to aid in the implementation of high performance algorithms and systems.
Other
339 stars 21 forks source link

`[printing]` Sufficiently long (npi) Doubles print w/ no decimal point #98

Open harold opened 7 months ago

harold commented 7 months ago

https://github.com/cnuernber/dtype-next/blob/ce52aabc4777a085fd389b50490344972c430cb9/src/tech/v3/datatype/pprint.clj#L7

This line leads to this unexpected (to Carsten and I) result:

user> (tech.v3.datatype.pprint/format-object (Double. 1.0))
"1.000"
user> (tech.v3.datatype.pprint/format-object (Double. 11.0))
"11.00"
user> (tech.v3.datatype.pprint/format-object (Double. 111.0))
"111.0"
user> (tech.v3.datatype.pprint/format-object (Double. 1111.0))
"1111"

Which in turn leads to some strange printing of columns in TMD.

harold commented 7 months ago

Discussion that led to this: https://clojurians.zulipchat.com/#narrow/stream/236259-tech.2Eml.2Edataset.2Edev/topic/float.20vs.20long.20columns

behrica commented 7 months ago

what is funny", that for larger number it works "somehow":

(tech.v3.datatype.pprint/format-object (Double. 12345.0))
"1.235E+04"

So it is precisely on number which have "4-digits dot 1-digit"

behrica commented 7 months ago

Main issue is "confusion" about the column type when "looking" at print of a printed dataset/column

My case was especially confusing, because it had column type "object", so it took me a while to see that object was "java.lang.Double" and not "java.lang.Integer"

I had row filters with predicates like this (= 2016 ....) and could not understand why they do not work.