0

I use time command to measure execution time of the code A and B. I got results, and now, I want to get ratio between A and B. Concretely, I have execution time as below.

A : 0m0.819s
B : 0m2.119s

I need x in B = x * A. So, I did the division 2.119 / 0.819, and the result is 2.5873015873. Now, I want to know the significant figure of 2.5873015873. Can I treat 2.5873015873 as the answer or must I decide the significant figure? And if I must decide the significant figure, is it 4 by A and B's execution time?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
mmsss
  • 263
  • 1
  • 2
  • 7
  • What do you mean by 'the significant figure of 2.5873…'? Do you want just the first digit (2), or do you want it rounded (in which case the answer's 3), or do you have some other meaning? Yes, you're at liberty to treat 2.5873… as the answer — unless there's some constraint imposed on you that says you can't, of course. Your last question ("And if I must decide … is it 4 …?") is completely inscrutable. What would you do if one or both of the execution times included non-zero minutes (or hours, or days)? On the face of it, these are trivial maths issues that you can deal with from the spec. – Jonathan Leffler Nov 29 '16 at 07:22
  • The significant figure of 0.819 is 3 and the significant figure of 2.119 is 4, so I thought the significant figure of division 2.119 / 0.819 is 4. If so, the significant figure of division is 2.587. I want to know how I decide the significant figure of 2.119 / 0.819. – mmsss Nov 29 '16 at 12:54
  • Ah; I think I see. In English, what you've called 'significant figure' would probably be 'number of significant digits'. At least, that is consistent with your comment. If your command took 2m 18.315s, or 138.315s, you'd have 6 significant digits, or 6 digits available. Personally, I'd probably not regard more than about 3 digits as truly significant. That would apply in the ratio too. – Jonathan Leffler Nov 29 '16 at 13:04
  • I see. Thank you for your kindness! – mmsss Nov 30 '16 at 01:17

0 Answers0