Hacker News new | past | comments | ask | show | jobs | submit login

This is nice, but I personally just do a rough estimate based on known perfect squares and the idea of graph in my head. If I need anything more accurate than +-0.5 for small numbers, and +-10 for large, I'd just take out a calculator. Small numbers are much easier to estimate accurately than large numbers.

Everyone generally knows the perfect squares up to at least 12, and then for bigger values, you can use even powers of 2, which I assume people also know. The useful trick is remembering the square root product/dividend property.

Some examples, for a small number, 33, that's less than 36 but more than 25 and it's a lot closer to 36, so I'd guess 5.8 or 5.7 (actual value 5.74..). Halfway between the numbers wouldn't necessarily mean halfway between the known factors. For a bigger number like 1076, you can use 1024, and since it grows more slowly as the factors get bigger, I'd assume something like 32.5 (actual value 32.74..). For a number like 34128, 34128 is ~ 32000, 2 * 16000, 2161000 (almost 1024), so 1.5ish432 so 192ish [1.5*128=128+64] (actual value 184.74).

Heron's method is much better in terms of error though. On the other hand, the method I use is better for larger numbers. I thought about trying Heron's after breaking down the number into smaller factors, but there's something about the division operator with decimals that feels exhausting to even think about.




BTW there’s a formatting issue with your last example. 2161000 should be 2 * 16 * 1000




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: