Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/6c-asadd-mul/readme

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



in the following, += and *= are miscompiled because an optimisation
is applied that only works if the left-hand side of the assignment
is floating point.


cat <<'!' >pt.c
typedef struct Point {int x, y;} Point;
#define	PI	3.1415626535

double cos(double), sin(double);
int print(char*, ...);
Point
circlept(Point c, int r, int degrees)
{
        double rad;

        rad = (double) degrees * PI/180.0;
        c.x += cos(rad)*r;
		c.x *= cos(rad)*r;
     	c.y -= sin(rad)*r;
        print("circlerad %d %d\n", c.x, c.y);
        return c;
}
!

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].