Re: [dev] sbase - seq.c: help wanted

From: Galos, David <galosd83_AT_students.rowan.edu>
Date: Mon, 16 Apr 2012 16:34:36 -0500

> Thanks for your contribution! Please test my munging of both codes!
It's basically all there, a few issues, though:

Checking for any sign is pointless in digitsright. Checking for the minus
sign is wrong in digitsleft, because the format string we create won't
ever print '+'; but since '-' might be printed, it needs to be accounted for.

When finding the number of digits to the right, do not include
digitsright(end).
It's not a factor, since (start*k*step) will never have more right digits than
MAX(right(start), right(step)). End isn't guaranteed to be printed.

After some testing I realized that my regex was inaccurate--I forgot to
encase it in '^$'. If everyone here's cool with REG_EXTENDED, I changed it to
"^([^%]|%%)*%[ +-]?[0-9]*.?[0-9]*[fFgGeE]([^%]|%%)*$"
Which seemed clearer, and survived more testing.

At the end, and all those checks to make sure we count the right way
are really ugly. Using multiplication, I clear this all up. For what it's
worth, getopt is preventing us from dealing with negatives right now.

I've attached a patch against tip with my changes.

Received on Mon Apr 16 2012 - 23:34:36 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 16 2012 - 23:36:07 CEST