9front - general discussion about 9front
 help / color / mirror / Atom feed
From: cinap_lenrek@felloff.net
To: 9front@9front.org
Subject: Re: [9front] libmemdraw memarc bug
Date: Thu, 7 Mar 2019 20:03:21 +0100	[thread overview]
Message-ID: <7C4A4B9D678C217C56E3A03E1D80B26D@felloff.net> (raw)
In-Reply-To: CAH_zEu77jC=ZrZfyyU4yJ50aw6u3k=-qoC4G5gAxyg0kLFK7Cg@mail.gmail.com

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


             reply	other threads:[~2019-03-07 19:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 19:03 cinap_lenrek [this message]
2019-03-09 22:40 ` Nick Owens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7C4A4B9D678C217C56E3A03E1D80B26D@felloff.net \
    --to=cinap_lenrek@felloff.net \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).