[Info-vax] VMS Software Q1 '23 Update

Dave Froble davef at tsoft-inc.com
Sat Jan 28 20:19:35 EST 2023


On 1/28/2023 7:25 PM, Arne Vajhøj wrote:
> On 1/28/2023 6:19 PM, Johnny Billquist wrote:
>> On 2023-01-28 23:35, Arne Vajhøj wrote:
>>> On 1/28/2023 3:01 PM, Steven Schweda wrote:
>>>>> Consider the case where the numbers represent money.
>>>>
>>>>     Who cares what the numbers represent?  For example, if you round to
>>>> the nearest integer, then 1.49999 and 1.50001 differ by only 0.00002,
>>>> but one rounds to 1, and the other to 2, so the lame test says that
>>>> they're "unequal".  And 1.50001 and 2.49999 differ by 0.99998, but they
>>>> both round to 2, so the lame test says that they're "equal".  Any test
>>>> which treats a difference of 0.00002 as significant, and a difference of
>>>> 0.99998 as negligible, is, I claim, (obviously) a bad test, regardless
>>>> of what the numbers might represent.
>>>
>>> There are some specific rules for money usually about
>>> always rounding 2 digits.
>>>
>>> 1494 dollars divided by 1000 = 1.494 get rounded to 1.49
>>>                                diff 0.002          not equal
>>> 1496 dollars divided by 1000 = 1.496 get rounded to 1.50
>>>
>>> 1496 dollars divided by 1000 = 1.496 get rounded to 1.50
>>>                                diff 0.008            equal
>>> 1504 dollars divided by 1000 = 1.504 get rounded to 1.50
>
>> So by your own example, two values differing by 0.002 could be considered not
>> equal, but two values differing by 0.008 could be considered equal. Don't you
>> see that this leads to a very bad algorithm for comparing for approximate equal?
>>
>> More generally, 0.002 of difference might be considered equal or not equal
>> purely based on what the actual values are. For some, they will be equal, and
>> for some others not. The delta that is required for two numbers to be
>> considered unequal varies based on what the actual numbers are.
>>
>> At least in my book, that is a clear indication that it's a very bad method.
>
> I am not sure that I get your point.
>
> This is how rounding of money works.
>
> Software that operate on money needs to implement
> the rules.
>
> Same reason that good rounding supports different
> rounding mode: UP (round .5 up), EVEN (round .5 to
> even) etc.. Different places has different rules and
> the software need to implement those.
>
> Arne

Perhaps you mean .005 ???


-- 
David Froble                       Tel: 724-529-0450
Dave Froble Enterprises, Inc.      E-Mail: davef at tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA  15486



More information about the Info-vax mailing list