[Info-vax] VMS Software Q1 '23 Update

Arne Vajhøj arne at vajhoej.dk
Sat Jan 28 20:32:45 EST 2023


On 1/28/2023 8:16 PM, Dave Froble wrote:
> On 1/28/2023 5:35 PM, Arne Vajhøj wrote:
>> PS: One should never use traditional binary based floating
>>     point for storing money instead use some decimal based
>>     type. But sometimes calculations switch to floating point
>>     anyway.
> 
> For maybe 45 years I've used FP (D-float) for monetary transactions and 
> storage.  Never any problems.  The secret is understanding what one is 
> doing.
> 
> It is not always simple.  Consider products with cost and prices using 
> thousands and even ten thousands, ie; .001 or .0001.  Think of things 
> such as golf tees, sold by the bag, or rather large quantities.  The 
> final calculations will be less than $.01 off, but that is acceptable.  
> Now, sales analysis, where perhaps millions of items are considered, can 
> get off a bit.  Usually acceptable.  But, rounding will cause some small 
> discrepancies.

I find it hard to see why one would bother with the risks
of using floating point if a decimal type is available.

VMS Basic has a decimal type.

So has Cobol and most of the post-1990 languages.

The C crowd are missing out.

Arne





More information about the Info-vax mailing list