From b2af13441616dde06c192f8929087df34354c711 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Tue, 5 Oct 2021 11:19:00 +0800 Subject: [PATCH] Update math.md --- contents/algorithms/math.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contents/algorithms/math.md b/contents/algorithms/math.md index 81a20885..bb9749b0 100644 --- a/contents/algorithms/math.md +++ b/contents/algorithms/math.md @@ -13,8 +13,7 @@ Check for and handle overflow/underflow if you are using a typed language like J Consider negative numbers and floating point numbers. This may sound obvious, but under interview pressure, many obvious cases go unnoticed. -When dealing with floating point numbers, avoid rounding mistakes by using epsilon comparison instead of equality check. - - E.g. `abs(x - y) <= 10e7` instead of `x == y`) +When dealing with floating point numbers, take note of rounding mistakes. Consider using epsilon comparisons instead of equality checks. E.g. `abs(x - y) <= 10e7` instead of `x == y`). If the question asks to implement an operator such as power, squareroot or division and want it to be faster than O(n), binary search is usually the approach to go.