Re: [commons-math] function or Number class to count/track number of significant figures

2023-08-10 Thread Daniel Watson
After some thought, this wrapper class might be better named something like BigMeasurement (or just Measurement?). Significant figures and precision are very closely tied to measurements, since the act of measuring is really what causes the uncertainty to begin with. I think a static method to cou

Re: [commons-math] function or Number class to count/track number of significant figures

2023-08-09 Thread Daniel Watson
I believe the convention is to take the *least* precise term and apply that precision (here "precision" != "sigfigs" - Ive been using both terms to mean sigfigs, but for these purposes precision is actually defined as how small a fraction the measurement is able to convey - e.g 0.01 is more precise

Re: [commons-math] function or Number class to count/track number of significant figures

2023-08-09 Thread Alex Herbert
On Wed, 9 Aug 2023 at 17:13, Daniel Watson wrote: > BigSigFig result = new BigSigFig("1.1").multiply(new BigSigFig("2")) Multiply is easy as you take the minimum significant figures. What about addition? 12345 + 0.0001 Here the significant figures should remain at 5. And for this: 12345 + 10

Re: [commons-math] function or Number class to count/track number of significant figures

2023-08-09 Thread Daniel Watson
Ah I see what you were asking. Yes it is up to the human entering data to understand that 1 has exactly one sigfig according to standard convention. If you need it to have more then you must write it in full scientific notation. Obviously If a specific precision is required due to some flaw in

Re: [commons-math] function or Number class to count/track number of significant figures

2023-08-09 Thread Alex Herbert
On Wed, 9 Aug 2023 at 15:43, Daniel Watson wrote: > > Hope that answers more questions than it creates! It does not address the issue of the last significant zero, e.g: 1 (4 sf) 1 (3 sf) 1 (2 sf) One way to solve this with standard parsing would be to use scientific notation: 1.000

Re: [commons-math] function or Number class to count/track number of significant figures

2023-08-09 Thread Daniel Watson
Before I answer your questions - I'll say that looking at the commons-math codebase it is apparent that it's focused on specific functional computation, rather than util-like features. So I agree this probably doesn't fit well there. I honestly did not know commons-numbers existed. I'll check there

Re: [commons-math] function or Number class to count/track number of significant figures

2023-08-09 Thread Alex Herbert
Hi, On Wed, 9 Aug 2023 at 12:27, Daniel Watson wrote: > This feature is necessary when working with scientific/clinical data which > was reported with significant figures in mind, and for which calculation > results must respect the sigfig count. As far as I could tell there is no > Number imple

[commons-math] function or Number class to count/track number of significant figures

2023-08-09 Thread Daniel Watson
I noticed there is not (or I could not find) a function within commons-math to count the number of significant figures in a number string. I wrote a function to do it and want to make sure I'm not missing something within commons-math before submitting a PR. This feature is necessary when working