You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nota bene: If y2 is written fully: y2 = slope * x + slope * (- _y) + _a, we see that the distributive law is used to transform from y1. In other words the multiplication occurs before the addition in y1.
Now let's see why y1 is the better representation:
alias S = double;
S slope = 2.87415e+15;
S _a = -0.139631;
S _y = -1.5;
S intercept = slope * (- _y) + _a; // 4.31123e+15
S x = -1.5;
S y1 = _a + slope * (x - _y); // -0.139631
S y2 = slope * x + intercept; // 0
btw with real there's no difference ;-)
Compile-time evaluation uses a different precision
real x = -1.0; // -0x1p+0enum y = -1.0; // -0x8p-3
-> Always use %a (exact hexadecimal printing) to verify.