× 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.



Adam West wrote:
the problem is with a whole number, something that weighs 2 pounds. Currently, they manually round up to next pound regardless. but 2 always remains at 2.

Are you describing the correct behaviour for the algorithm, or the incorrect behaviour that you want to correct? That is, if you have weight = 2.0, should the result be 2.0 or 3.0?

In the first case, the CEILING function mentioned by Birgitta is as good a choice as any. The ceil() function is also callable as part of the C/C++ runtime. Booth's suggestion is a way to implement the CEILING function if choose not to use embedded SQL or an API call, but be aware that it will need to be modified depending on the number of decimal places in your weight field:
%int(2.01 + 0.9) = %int(2.91) = 2.0

In case you want 2.0 to become 3.0, you could use
newWeight = FLOOR(originalWeight + 1).

Hope this helps,
Adam

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.