PG Reactive Client: Cannot create Money value in Range (-1.00, 0.00) #36144
Labels
area/reactive-sql-clients
kind/bug
Something isn't working
triage/upstream
Used for issues which are caused by issues in upstream projects/dependency
Milestone
Describe the bug
I cannot create a
Money
value of -0.XX, i.e., a Money value greater than -1.00, and less than 0.00. Range (-1.00 < value < 0.00)If the integer value of the Number argument is non-zero, e.g., using
Money
constructor argumentnew BigDecimal("-1.11")
works.If the integer value of the Number argument is zero, e.g., using a
Money
constructornew BigDecimal("-0.11")
does not work (as expected).I am not certain this is a bug, due to my expectation that the integerPart of a Money(-0.11) could be represented as -0.
Reproducing tests and debugger screenshots are below.
Expected behavior
Calling
new Money(new BigDecimal("-0.11"))
results in a negativeMoney(-0,11)
The Money value represents minus 11 cents, as expected.
Actual behavior
Calling
new Money(new BigDecimal("-0.11"))
results in a positiveMoney(0,11)
The Money value represents plus 11cents, not minus 11cents.
How to Reproduce?
Use a
BigDecimal
as aMoney
constructor argument.Money money = new Money(new BigDecimal("-1.11"));
Examine resulting Money in debugger:
Print resulting Money value:
Money(-1.11)
. As expected I seeMoney(-1.11)
.Use a
BigDecimal
as aMoney
constructor argument.Money money = new Money(new BigDecimal("-0.11"));
Examine resulting Money in debugger:
Print resulting Money value:
Money(0.11)
. I expect to seeMoney(-0.11)
.Below are some test cases.
Above, as expected
assertEquals(-1, money.getIntegerPart())
passes.Above, as expected
assertEquals(0, money.getIntegerPart())
passes, but I need to be able to create a Money(-0.11).Any advice?
Thanks.
Output of
uname -a
orver
Ubuntu 22.04.3 Linux 6.2.0-33-generic x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "17.0.7" 2023-04-18 OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7) OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
3.2.0.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 8.1.1
Additional information
No response
The text was updated successfully, but these errors were encountered: