|
"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> wrote on 04/22/2020
11:26:46 AM:
But it's usually faster for the computer to keep all its
operations in the machine-native numeric format and use math rather
than converting to and from string. (This is not a hard-and-fast rule;
it depends on the thing you're trying to do.)
So, you're saying that if I wanted to know the number of digits
actually used in a 7-digit packed number (i.e., without the leading
zeroes), I might do it in the following "stringy" way:
dcnt = %len(%trim(%char(%abs(mynumber))));
Otherwise, the following might be the math way:
if dcnt < 10;
dcnt = 1;
else;
dcnt = %int((%abs(mynumber) + 1) / 10);
endif;
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.