Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You don't need a calculator to perform 10⁴·¹; 10·⁰⁸ = 1.2 and 10·¹¹ = 1.3, so (interpolating) 10·¹ is about 1.27, so 10⁴·¹ is about 12700. (The truth is about 12590, but that's within the margin of error.)


You are right, I did not realize.

But one should use more precise values to make it work.

10^0.08 = 1.202 and 10^0.115 = 1.303 : 20/35 in the distance from 0.08 and 0.115, where you have 0.1, you likewise proceed with the same proportion on the results and obtain 1.202+0.057 = 1.259

Thing is, practice is required, and experience in managing precision confidently in this realm.

Edit:

In fact, the linear interpolation can work surprisingly well, but the space in linear vs logarithmic remains warped, and it is easy to err without realizing.

I just threw those numbers in a calculator to verify it:

  l12.d = Log10(1.2)           ==>  0.0791812460476248175522684
  l13.d = Log10(1.3)           ==>  0.1139433523068367759556452
  dst.d = (0.1-l12)/(l13-l12)
  lrs.d = 1.2 + 0.1*dst        ==>  1.2598892190166359750236325
  Log10(lrs)                   ==>  0.1003323596533426953492096
  Pow(10,0.1)                  ==>  1.2589254117941672816982646


Sure, especially with very imprecise values like 1.2 and 1.3 the error can be quite significant; generally you only interpolate tenths to get a single extra digit of precision, because mentally multiplying or dividing by .2 or .3 is a lot easier than multiplying by 20/35 or something. In theory you could use a more precise form of interpolation like quadratic Hermite interpolation or cubic spline interpolation, but for mental work I think that almost never pays off.

You may be aware that the linear interpolation error for a regular function scales as the square of the interval size, so if the table you're interpolating from has 10× as many entries, you get 100× less absolute error.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: