Could someone tell me why calculating intercept by multiplication will cause error but division not?


  • 0
    L

    Hi guys, I just recognize the floating points numbers will be stored as an approximation in Python. I will get error if I compute intercept by y1 - kx1, where (x1, y1) is a point on line y = kx + b. But (x1y2 - x2y1) / (x1 - x2) will not raise error. By the way, I use Python.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.