Issue 18364: RealValue::toString puts too many digits in the mantissa (fuml-rtf) Source: Model Driven Solutions (Mr. Ed Seidewitz, ed-s(at)modeldriven.com) Nature: Uncategorized Issue Severity: Summary: Specification: Semantics of a Foundational Subset for Executable UML Models (fUML), v1.1, RTF Beta (ptc/2012-10-18) Subclause: 8.3.2.2.21 RealValue The toString operation for RealValue is specified to determine the mantissa of a real number to 10 significant digits. It does this by scaling the (absolute value of) the real number and then converting it to an integer. Per the bUML representation in Annex B, the integer value is denoted as a Java int. Unfortunately, the upper bound of a Java int is 2,147,483,647, so some ten digit integers will overflow this value. While it is technically the UML semantics that apply to the specification here, via the Annex B mapping, not the Java semantics, it is still convenient (an intended) for the execution model operations to be able to run as Java methods, too. Therefore, it would be better to limit the mantissa to 9 digits rather than 10, so that the Java int representation of the mantissa never overflows. Resolution: Update RealValue::toString Agreed. Revised Text: In 8.3.2.2.21 RealValue, in the toString operation, change the comment // This gives 10 significant digits in the mantissa. to // This gives 9 significant digits in the mantissa. and, on the following line, in the header of the for statement, change 10 to 9. Actions taken: January 5, 2013: received issue October 8, 2015: Resolved December 22, 2015: closed issue Discussion: End of Annotations:===== m: Ed Seidewitz To: "issues@omg.org" Date: Sat, 5 Jan 2013 15:32:29 -0500 Subject: RealValue::toString puts too many digits in the mantissa Thread-Topic: RealValue::toString puts too many digits in the mantissa Thread-Index: Ac3rgvd2RdgoVqS1R1u+L8Im8niI6Q== Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US X-Mailprotector-Decision: deliver X-Mailprotector-Connection: TLSv1|[10.1.50.226]|10.1.50.226|outbound.mailprotector.net|0.0|0.0|0|||0|0|0|0 X-Mailprotector-Results: null_ptr subject_50_chars clean X-Mailprotector-Score: 60 X-Mailprotector-IP-Analysis: 0, 10.1.50.226, Ugly c=0.695462 p=-0.990621 Source White X-Mailprotector-Scan-Diagnostics: 0-0-0-7069-c X-Mailprotector-ID: 22af3d7f-3348-4572-9836-be446918a5d8 Specification: Semantics of a Foundational Subset for Executable UML Models (fUML), v1.1, RTF Beta (ptc/2012-10-18) Subclause: 8.3.2.2.21 RealValue The toString operation for RealValue is specified to determine the mantissa of a real number to 10 significant digits. It does this by scaling the (absolute value of) the real number and then converting it to an integer. Per the bUML representation in Annex B, the integer value is denoted as a Java int. Unfortunately, the upper bound of a Java int is 2,147,483,647, so some ten digit integers will overflow this value. While it is technically the UML semantics that apply to the specification here, via the Annex B mapping, not the Java semantics, it is still convenient (an intended) for the execution model operations to be able to run as Java methods, too. Therefore, it would be better to limit the mantissa to 9 digits rather than 10, so that the Java int representation of the mantissa never overflows.