On Sat, Dec 31, 2016 at 15:27 +0100, Gerhard Sittig wrote:
> 
> But I'd like to get a review on commit 216ea623bb75.  I didn't
> quite get that "exponent" stuff, which is why the comments about
> it are a little fuzzy ("augments the number value" was the best I
> could do back then).  I guess it's not really an "exponent", but
> neither is it strict "precision" as it does not cover the integer
> part.  The best description I could come up with in the meantime
> is "(significant) length of the fractional part" of a measurement
> value.  That is required in addition to the float variable, as
> the internal representation of the value does not tell how much
> of it was significant at the origin.

Is "significance" some better name than "exponent"?  Or any other
term that expresses that the value is about how many digits after
the period are significant?  Is there some established term for
this in math?

The current patch is a mechanical edit, reflecting the exact
former implementation, just with pointer arith instead of integer
index values (strstr vs strspn).  Thinking some more about it, I
guess the following is the most appropriate phrase for what's
happening:

  dot_pos = g_strstr_len(valstr, -1, ".");
  *exponent = dot_pos ? -strlen(++dot_pos) : 0;

For comparison see
http://repo.or.cz/libsigrok/gsi.git/commitdiff/216ea623bb75ba40a7b14250e3e8653d8520b448
for the current implementation which works but might be
considered somewhat obfuscated in hindsight.


virtually yours
Gerhard Sittig
-- 
     If you don't understand or are scared by any of the above
             ask your parents or an adult to help you.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to