that's not much better than `BigDecimal(0.5)`
# language-proposals
j
that's not much better than
BigDecimal(0.5)
3
j
It removes the requirement to explicitly import it. ¯\_(ツ)_/¯
v
In what way does it affect imports?
r
@voddan you would be able to get the conversion to
BigDecimal
without explicitly importing it to use its constructor.
v
Ether way you have to import a function, be it
BigDecimal()
or
toBigDecimal()
, no?
j
Not if it's in the stdlib
r
I think in Scala there were some concerns with
BigDecimal
at some point regarding rounding precision from
Double
but I can't recall what the reasons were
v
you are right, they are in the auto-importing package
j
If you have
0.8
in big decimal it becomes
0.8000000000000000000523... ect
k
@jlleitschuh Technically it already was
.800..00523
,
BigDecimal
just has a different toString.
The documentation specifically says it creates a new bigint with the exact double value.
j
?! Can you explain that? Also, does big decimal have some sort of "from string" method? I couldn't find one.
b
The one advantage is you can do
nullable?.toBigDecimal()
but not
BigDecimal(nullable)
1
j
Oh, thanks for finding that.
k
As for the
0.3
thing, you're in for a ride ☺️. This page seems to explain it pretty well: