Share your thoughts in the 2025 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
ago in Clojure by
retagged ago by

ago by
But what exactly is the bug? What's `h2o.common.lang.SNumber`? What's the expected behavior?
ago by
I am giving an example to illustrate that 'SNumber' is a custom number type that implements the' Number 'interface. The bigdec function causes the decimal part to be lost
ago by
(number? x) (BigDecimal/valueOf (.doubleValue ^Number x))

https://mysys-images.oss-cn-beijing.aliyuncs.com/bigdec2.png
ago by
Can you link to documentation about SNumber or the source code somewhere (GitHub)?

What else does SNumber implement or extend?

2 Answers

0 votes
ago by
selected ago by
+1 vote
ago by

Not sure what else you are expecting to happen in this case? What could Clojure do at this point given that it only knows SNumber is a Number?

ago by
(number? x) (BigDecimal/valueOf (.doubleValue ^Number x))

https://mysys-images.oss-cn-beijing.aliyuncs.com/bigdec2.png
...