I am trying to debug a problem unrelated to this specific code and I am looking for clues, the clue being "what value might this counter have had?" The following line of code
sprintf(strAtLeast10long, "%lld%c%.02uP",
input/peta, decimal, (long)((input%peta) / (peta/hundred)));
is producing "0.00P" for output.
Here is what I know about the parameters. Input is an unsigned long long
with a value >= (10^12 - (10^7 / 2)). decimal = '.'
static const long long hundred = 100;
static const long long peta = 1000000000000000ULL;
Yes, I know the "%lld"
would be better as "%llu"
and I will fix that.
But meanwhile, I am looking for clues as to what might have been in input. The problem occurred at a customer and we do not know how to reproduce it, so adding debugging code or using a debugger is not an option.
Compiler is the IBM z/OS C++ compiler. Before you all roll your eyes and go "EBCDIC is the devil's handiwork!" it is a Posix-conformant C++ compiler and environment.