tag:blogger.com,1999:blog-1215138205010460377.post7268567835899282007..comments2023-05-13T04:43:49.156-04:00Comments on It's a COBOL world!: Precision: What is it Precisely?Robert Collinshttp://www.blogger.com/profile/06987247885620411892noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-1215138205010460377.post-67221496228850466022010-04-30T23:35:13.115-04:002010-04-30T23:35:13.115-04:00AFAIK, "Standard" COBOL doesn't allo...AFAIK, "Standard" COBOL doesn't allow for more than 18 digits of precision, so PIC S9(18)v(18) must be a vendor extension.<br /><br />Also, I believe all of the COMP-x usages are vendor-dependent, so you have to know your vendor and platform to truly understand what you're getting.<br /><br />Regards,<br /><br />GlennGlennhttps://www.blogger.com/profile/02037150859289254711noreply@blogger.comtag:blogger.com,1999:blog-1215138205010460377.post-39129565010797168882010-04-18T13:25:21.799-04:002010-04-18T13:25:21.799-04:00Hi,
For clarity:
comp-1 is an oddity, the precis...Hi,<br /><br />For clarity:<br /><br />comp-1 is an oddity, the precision is dependant on the COBOL version. This is also the case for comp-2.<br /><br />The true high precision stuff comes with comp and comp-5, comp-3. All of these work with base 10 arithmetic not base-2 as float-long and comp-2 (MF) do.<br /><br />Java its self as no equivalent to:<br /><br />pic s9(18)v(18) comp.<br /><br />or<br /><br />pic s9(18)v(18) comp-3.<br /><br />etc.<br /><br />However, there are libraries which allow manipulation of decimal fixed point mathematics. The particular library that is normally used in BigDeciml. <br /><br />Because this is not part of the language, using it is much more cumbersome than doing the equivalent in COBOL. It also makes it very hard indeed to port an existing COBOL program and get exactly the same result in Java (so don't - use interop instead).<br /><br />BTW comp-1 is basically the same as float-short in MF but is a fixed type in ACU. MF support a compiler directive to make the MF compiler produce ACU style maths in this regard. Hence, it is much nicer to use float-short and float-long as there is no ambiguity as to what one indents - that is why I used them :)<br /><br />Best wishes - AJAnonymoushttps://www.blogger.com/profile/05340869749061179136noreply@blogger.com