~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/runtime/complex.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
        float64 a, b, ratio, denom;
14
14
 
15
15
        // Special cases as in C99.
16
 
        ninf = runtime·isInf(n.real, 0) || runtime·isInf(n.imag, 0);
17
 
        dinf = runtime·isInf(d.real, 0) || runtime·isInf(d.imag, 0);
 
16
        ninf = n.real == runtime·posinf || n.real == runtime·neginf ||
 
17
               n.imag == runtime·posinf || n.imag == runtime·neginf;
 
18
        dinf = d.real == runtime·posinf || d.real == runtime·neginf ||
 
19
               d.imag == runtime·posinf || d.imag == runtime·neginf;
18
20
 
19
 
        nnan = !ninf && (runtime·isNaN(n.real) || runtime·isNaN(n.imag));
20
 
        dnan = !dinf && (runtime·isNaN(d.real) || runtime·isNaN(d.imag));
 
21
        nnan = !ninf && (ISNAN(n.real) || ISNAN(n.imag));
 
22
        dnan = !dinf && (ISNAN(d.real) || ISNAN(d.imag));
21
23
 
22
24
        if(nnan || dnan) {
23
 
                q.real = runtime·NaN();
24
 
                q.imag = runtime·NaN();
25
 
        } else if(ninf && !dinf && !dnan) {
26
 
                q.real = runtime·Inf(0);
27
 
                q.imag = runtime·Inf(0);
28
 
        } else if(!ninf && !nnan && dinf) {
 
25
                q.real = runtime·nan;
 
26
                q.imag = runtime·nan;
 
27
        } else if(ninf && !dinf) {
 
28
                q.real = runtime·posinf;
 
29
                q.imag = runtime·posinf;
 
30
        } else if(!ninf && dinf) {
29
31
                q.real = 0;
30
32
                q.imag = 0;
31
33
        } else if(d.real == 0 && d.imag == 0) {
32
34
                if(n.real == 0 && n.imag == 0) {
33
 
                        q.real = runtime·NaN();
34
 
                        q.imag = runtime·NaN();
 
35
                        q.real = runtime·nan;
 
36
                        q.imag = runtime·nan;
35
37
                } else {
36
 
                        q.real = runtime·Inf(0);
37
 
                        q.imag = runtime·Inf(0);
 
38
                        q.real = runtime·posinf;
 
39
                        q.imag = runtime·posinf;
38
40
                }
39
41
        } else {
40
42
                // Standard complex arithmetic, factored to avoid unnecessary overflow.