9front - general discussion about 9front
 help / color / mirror / Atom feed
* Re: [9front] libmemdraw memarc bug
@ 2019-03-07 19:03 cinap_lenrek
  2019-03-09 22:40 ` Nick Owens
  0 siblings, 1 reply; 2+ messages in thread
From: cinap_lenrek @ 2019-03-07 19:03 UTC (permalink / raw)
  To: 9front

this is a sneaky one because it looks like phi should never
be negative given that we flip the sign when phi < 0 in the
first if() below. however, here is a singularity when phi equals
-0x80000000 (which is the same as 0x80000000 in twos complement).

	if(phi < 0){
		tmp = alpha;
		alpha = beta;
		beta = tmp;
		phi = -phi;
	}
+	if(phi < 0)
+		phi = 0;
	if(phi >= 360){
		memellipse(dst, c, a, b, t, src, sp, op);
		return;
	}

the same issue is at the top:

	if(a < 0)
		a = -a;
	if(b < 0)
		b = -b;

also, stupid stuff like:

	while(alpha < 0)
		alpha += 360;
	while(beta < 0)
		beta += 360;

so i'd say back to the drawing board...

--
cinap


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9front] libmemdraw memarc bug
  2019-03-07 19:03 [9front] libmemdraw memarc bug cinap_lenrek
@ 2019-03-09 22:40 ` Nick Owens
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Owens @ 2019-03-09 22:40 UTC (permalink / raw)
  To: 9front

fixed in 7084:02eab1215f98 by cinap.

thanks!

On Thu, Mar 7, 2019 at 11:03 AM <cinap_lenrek@felloff.net> wrote:
>
> this is a sneaky one because it looks like phi should never
> be negative given that we flip the sign when phi < 0 in the
> first if() below. however, here is a singularity when phi equals
> -0x80000000 (which is the same as 0x80000000 in twos complement).
>
>         if(phi < 0){
>                 tmp = alpha;
>                 alpha = beta;
>                 beta = tmp;
>                 phi = -phi;
>         }
> +       if(phi < 0)
> +               phi = 0;
>         if(phi >= 360){
>                 memellipse(dst, c, a, b, t, src, sp, op);
>                 return;
>         }
>
> the same issue is at the top:
>
>         if(a < 0)
>                 a = -a;
>         if(b < 0)
>                 b = -b;
>
> also, stupid stuff like:
>
>         while(alpha < 0)
>                 alpha += 360;
>         while(beta < 0)
>                 beta += 360;
>
> so i'd say back to the drawing board...
>
> --
> cinap


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-09 22:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 19:03 [9front] libmemdraw memarc bug cinap_lenrek
2019-03-09 22:40 ` Nick Owens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).