Skip to content

Commit 99c19ec

Browse files
committed
Added Clarification for handling of Double.NaN and INIFINITIES.
1 parent cd4cd08 commit 99c19ec

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/main/asciidoc/JavaMoneySpecification.adoc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
:title: JSR 354 (Money & Currency) - Specification
44
:revnumber: 1.0-SNAPSHOT
55
:revremark: Public Final Draft
6-
:revdate: November 2014
6+
:revdate: January 2015
77
:longversion: {revnumber} ({revremark}) {revdate}
88
:authorinitials: ATR
99
:author: Anatole Tresch, Credit Suisse
@@ -813,7 +813,16 @@ Hereby
813813
+BigDecimal+, +long+ or something else. The only constraint is that the numeric value can be exposed as +NumberValue+
814814
and that the +MonetaryContext+ returned reflects the numeric capabilities accordingly.
815815
816-
Implementations of +MonetaryAmount<T>+
816+
When dealing with +double+ values additional aspects must be considered:
817+
818+
* multiplying/adding/subtracting with POSITIVE_INFINITY should throw ArithmeticException because it overflows
819+
* multiplying/adding/subtracting with NEGATIVE_INFINITY should throw ArithmeticException because it overflows
820+
* multiplying/adding/subtracting with NaN should throw ArithmeticException because the result is NaN
821+
* dividing by POSITIVE_INFINITY returns 0
822+
* dividing by NEGATIVE_INFINITY returns 0
823+
* dividing/multiplying/adding/subtracting by NaN should throw ArithmeticException because the result is NaN
824+
825+
Finally implementations of +MonetaryAmount<T>+
817826
818827
. must implement +equals/hashCode+, hereby it is recommended considering
819828
.. its implementation type

0 commit comments

Comments
 (0)