sadiuasdi67f678
sadiuasdi67f678 on Hacker News
Re:DEC64: Decimal Floating Point
on Sunday March 04, 2018 @07:52AM (#16514533)
I'm not talking about money, I am talking about the decimal data type, as is OP.
https://en.wikipedia.org/wiki/Decimal_data_type
Also, I don't try to endorse the Python API. I don't even use it. I just pointed out their api is easier since the operators work with their decimal data type, as opposed to the Java version.
Re:DEC64: Decimal Floating Point
on Sunday March 04, 2018 @05:45AM (#16514171)
In Java, the java.math.BigDecimal is not a primitive data type. It also has an awkward api due to lack of operator overloading (thanks to BigDecimal not being a primitive data type it seems).
In Python, the story looks slightly better:
from decimal import *
>>> getcontext().prec = 6
>>> Decimal(1) / Decimal(7)
Decimal('0.142857')
But neither of these data types is even close to being a first class citizen in either language.