Ok, I spent a long time tonight during low traffic to play around and experiment...
Here's what I have determined.
After looking at the number of ounces closely, the numbers were indeed being rounded, but the server was not getting the job done correctly.
So instead of 6.56, it would give a number like 6.55999999999999960920149533194489777088165283203125
I repeated this with several products, and it always had similar results - except for the very few products (with tare) that had a perfect integer number of ounces already. Then everything worked again like magic.
So I thought maybe I'd use floor and ceil to get the job done instead of round. I don't really need to detail the many different variations of code that I tried to use for the zen_round function. In the end, nothing worked. It always returned the same long number. The only thing that made a difference was to turn the zen_round function into a one line ceil or floor function.
So then I tried doing the code changes directly into the usps.php file rather than the functions_general.php. No luck there. Any kind of attempts to get around the rounding error just returned the same value again.
Doing a little bit of reading, this seems to be a float problem with some versions of php. So I'll be discussing this with my web host. We just upgraded last week from 5.2.14 to 5.2.17. It just seems obvious that its the server software.
In the meantime, I've done a little work-around to get the international shipping quotes working again.
Where there was this line:
$shipping_ounces = zen_round($shipping_ounces, 2);
I replaced it with this line:
$shipping_ounces = ceil($shipping_ounces);
USPS always rounds up to the nearest whole ounce anyway.
So I never really needed those decimal places to begin with.
But the rounding errors make me very nervous and I don't really know what other surprises are in-store for me. So I hope to get to the bottom of this with our web host.
Thanks so much for your time and help.
This still isn't finished, so if there is anything else useful to contribute, please don't be shy.
Cheers. :smile:
Jason