something else needs to change so that the two cmplxdivide files get compiled together. i ...
14 years, 9 months ago
(2010-06-15 20:40:24 UTC)
#2
something else needs to change so that the two cmplxdivide files get compiled
together.
i suggest having cmplxdivide.c print a single file with all the code.
-rob
On Tue, Jun 15, 2010 at 13:40, <r@google.com> wrote: > something else needs to change ...
14 years, 9 months ago
(2010-06-15 20:43:00 UTC)
#3
On Tue, Jun 15, 2010 at 13:40, <r@google.com> wrote:
> something else needs to change so that the two cmplxdivide files get
> compiled together.
they get compiled together by // $G $D/$F.go $D/cmplxdivide1.go
are you saying to avoid that approach?
On Jun 15, 2010, at 1:42 PM, Russ Cox wrote: > On Tue, Jun 15, ...
14 years, 9 months ago
(2010-06-15 20:43:59 UTC)
#4
On Jun 15, 2010, at 1:42 PM, Russ Cox wrote:
> On Tue, Jun 15, 2010 at 13:40, <r@google.com> wrote:
>> something else needs to change so that the two cmplxdivide files get
>> compiled together.
>
> they get compiled together by // $G $D/$F.go $D/cmplxdivide1.go
> are you saying to avoid that approach?
ah, i missed that. it's ok then, but i would have considered writing
a single file.
-rob
http://codereview.appspot.com/1686044/diff/5001/6001 File src/pkg/runtime/complex.c (right): http://codereview.appspot.com/1686044/diff/5001/6001#newcode9 src/pkg/runtime/complex.c:9: void you should put in a comment explaining the ...
14 years, 9 months ago
(2010-06-15 20:47:46 UTC)
#5
> http://codereview.appspot.com/1686044/diff/5001/6001#newcode9 > src/pkg/runtime/complex.c:9: void > you should put in a comment explaining the source ...
14 years, 9 months ago
(2010-06-15 21:38:08 UTC)
#7
> http://codereview.appspot.com/1686044/diff/5001/6001#newcode9
> src/pkg/runtime/complex.c:9: void
> you should put in a comment explaining the source of the algorithm.
> plus: do you need (the effect of) the pragma? in any case if you depend
> on the no-compact property you should say so.
I tried to understand the C99 implementation and gave up.
(It depends on concepts we don't have available like scalbn and logb,
which are like but the same as frexp and ldexp.)
This implementation behaves the same for all the special
cases (verified by the test) and is Ken's original code for
the ordinary case. It may not be as precise for the arithmetic
and it may not be as efficient, but it is correct.
Having the test means someone can make it more efficient later.
I added two small comments.
> http://codereview.appspot.com/1686044/diff/5001/6002
> File test/cmplxdivide.c (right):
>
> http://codereview.appspot.com/1686044/diff/5001/6002#newcode57
> test/cmplxdivide.c:57: printf("\tTest{cmplx(%s, %s), cmplx(%s, %s),
> cmplx(%s, %s)},\n", fmt(creal(n)), fmt(cimag(n)), fmt(creal(d)),
> fmt(cimag(d)), fmt(creal(q)), fmt(cimag(q)));
> i'm nervous that we trust the C implementation. should we?
Seems okay to me. It's not automatically generated
so we're not trusting every C implementation, just the
one I ran to generate the test. If we find out that it's
wrong then we can always do something else, but
all the differences I had to fix were bugs in Go's output, not C's.
> http://codereview.appspot.com/1686044/diff/5001/6003#newcode1
> test/cmplxdivide.go:1: // $G $D/$F.go $D/cmplxdivide1.go && $L $D/$F.$A
> && ./$A.out
> you say it below but say it here: this file is the driver for
> cmplxdivide1.go
Done.
Russ
Issue 1686044: code review 1686044: complex divide: match C99 implementation
(Closed)
Created 14 years, 9 months ago by rsc
Modified 14 years, 9 months ago
Reviewers:
Base URL:
Comments: 4