× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




How do I get around this error using the eval statement?  I DO NOT want
to make the field bigger,  I just want to truncate the extra decimals.

Huh? Do you mean that you want to truncate the extra digits? Truncating extra decimals is not necessary, it happens automatically.

For example, the following code won't receive any errors, in spite of the fact that it drops a decimal place:

     D A               s              5P 1
     D B               s              5P 1
      /free
          a = 0.5;
          b = a / 2;

It is a complex equation,  which I then push the result to a display
field,  so to determine the max field size will be difficult,  plus I
then have to move the 'temp' field to a display field.

If the max field size is a really big issue for you and you don't care about losing accuracy (which is very unsual for an RPG programmer, I might add!) you might consider using floating point fields. They allow for extremely huge numbers or extremely low numbers without a need to know ahead of time how many digits/decimals are needed.

The drawback is that they can lose accuracy. The result will be close, but might not be exact. Since you're not worried about digits being lost, I assume that you don't care if your result is exact -- so this might be a good solution.

I just want to ignore the extra decimals!   I tried eval(r)    also and
still get the same errors

I don't understand what eval(r) has to do with your question. Are you having trouble with an intermediate result? If that's the case, you could try using %DEC() to control the intermediate result size.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.