~ubuntu-branches/debian/sid/bc/sid

« back to all changes in this revision

Viewing changes to dc/numeric.c

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2009-04-16 10:23:39 UTC
  • Revision ID: james.westby@ubuntu.com-20090416102339-l7970sr667eekbvw
Tags: 1.06.94-3.1
* Non-maintainer upload with John's permission.
* Apply patch to restore the .dcrc config file (closes: #472250)
* Merge patch from Ubuntu to notice read and write errors on
  input and output (closes: #488735)
* Include the bc manual (HTML) in the bc binary package

* Bump Standards Version to 3.8.1
* Bump debhelper compatibility to 7
* debian/rules: replace "dh_clean -k" with "dh_prep"
* debian/control: Add homepage field
* Fix hyphens in the bc and dc manpages
* Add a watch file
* debian/dc.doc-base: Remove leading whitespace
* debian/dc.doc-base: Move to section Science/Mathematics

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
        bc_init_num((bc_num *)result);
125
125
        if (bc_divide(CastNum(a), CastNum(b), (bc_num *)result, kscale)){
126
126
                fprintf(stderr, "%s: divide by zero\n", progname);
 
127
                checkferror_output(stderr);
127
128
                return DC_DOMAIN_ERROR;
128
129
        }
129
130
        return DC_SUCCESS;
146
147
        if (bc_divmod(CastNum(a), CastNum(b),
147
148
                                                (bc_num *)quotient, (bc_num *)remainder, kscale)){
148
149
                fprintf(stderr, "%s: divide by zero\n", progname);
 
150
                checkferror_output(stderr);
149
151
                return DC_DOMAIN_ERROR;
150
152
        }
151
153
        return DC_SUCCESS;
164
166
        bc_init_num((bc_num *)result);
165
167
        if (bc_modulo(CastNum(a), CastNum(b), (bc_num *)result, kscale)){
166
168
                fprintf(stderr, "%s: remainder by zero\n", progname);
 
169
                checkferror_output(stderr);
167
170
                return DC_DOMAIN_ERROR;
168
171
        }
169
172
        return DC_SUCCESS;
180
183
        bc_init_num((bc_num *)result);
181
184
        if (bc_raisemod(CastNum(base), CastNum(expo), CastNum(mod),
182
185
                                        (bc_num *)result, kscale)){
183
 
                if (bc_is_zero(CastNum(mod)))
 
186
                if (bc_is_zero(CastNum(mod))) {
184
187
                        fprintf(stderr, "%s: remainder by zero\n", progname);
 
188
                        checkferror_output(stderr);
 
189
                }
185
190
                return DC_DOMAIN_ERROR;
186
191
        }
187
192
        return DC_SUCCESS;
216
221
        tmp = bc_copy_num(CastNum(value));
217
222
        if (!bc_sqrt(&tmp, kscale)){
218
223
                fprintf(stderr, "%s: square root of negative number\n", progname);
 
224
                checkferror_output(stderr);
219
225
                bc_free_num(&tmp);
220
226
                return DC_DOMAIN_ERROR;
221
227
        }
419
425
{
420
426
        out_char('\0'); /* clear the column counter */
421
427
        bc_out_num(CastNum(value), obase, out_char, 0);
422
 
        if (newline_p == DC_WITHNL)
 
428
        if (newline_p == DC_WITHNL) {
423
429
                putchar ('\n');
 
430
                checkferror_output(stdout);
 
431
        }
424
432
        if (discard_p == DC_TOSS)
425
433
                dc_free_num(&value);
426
434
}
465
473
 
466
474
        for (cur=top_of_stack; cur; cur=next) {
467
475
                putchar(cur->digit);
 
476
                checkferror_output(stdout);
468
477
                next = cur->link;
469
478
                free(cur);
470
479
        }
582
591
                        out_col = 1;
583
592
                }
584
593
                putchar(ch);
 
594
                checkferror_output(stderr);
585
595
        }
586
596
}
587
597
 
621
631
        vfprintf (stderr, mesg, args);
622
632
        va_end (args);
623
633
        fprintf (stderr, "\n");
 
634
        checkferror_output(stderr);
624
635
}
625
636
 
626
637
 
654
665
        vfprintf (stderr, mesg, args);
655
666
        va_end (args);
656
667
        fprintf (stderr, "\n");
 
668
        checkferror_output(stderr);
657
669
}
658
670
 
659
671