Skip to content
#

bigdecimal

Here are 50 public repositories matching this topic...

Mazuh
Mazuh commented May 3, 2020

why would 0 * (-1) (as is negated() documented behavior) be considered negative?

Decimal('0').negated().isNegative() // true (1)
Decimal('0').isNegative() // false (2)

and that is a contradition when I compare 0 with itself, negated or not:

Decimal('0').negated().lessThan(Decimal('0')) // false (3)
Decimal('0').lessThan(Decimal('0')) // false (4)
Decimal('0').neg
klntsky
klntsky commented Dec 27, 2018

It would be nice to have an option to bypass adding zeros here.

What if we have dp = 1e6, and the value passed is just 0? We end up adding 1e6 zeros, which consumes a lot of time and may be pointless for most usage scenarios.

Also, I think that pushing constant value within cycle here (and in some other places in the code) is not

pnomolos
pnomolos commented Feb 20, 2020

The docs for round specify:

Round to the nearest integer (by default), returning the result as a BigDecimal.

However, this is inconsistent with what is actually happening:

> BigDecimal.new("10.5").round.class
=> Integer

> BigDecimal.new("10.5").round(1).class
=> BigDecimal

> BigDecimal.new("10.5").round(-1).class
=> BigDecimal

It would appear the issue lies h

Improve this page

Add a description, image, and links to the bigdecimal topic page so that developers can more easily learn about it.

Curate this topic

Add this topic to your repo

To associate your repository with the bigdecimal topic, visit your repo's landing page and select "manage topics."

Learn more

You can’t perform that action at this time.