blob: 254eefe68f597a48cb4c6504d9e287bf0fb69218 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/* <--- bug.bc ---><--- bug.bc ---><--- bug.bc ---><--- bug.bc ---> */
/*
* See the file "signum" for a description and reference for this
* program.
*
* THIS BUG IS *NOT* IN GNU BC!!!
*
*/
obase=16
ibase=16
x=1A8F5C99605AE52 /* dividend */
y=BB0B404 /* divisor */
q=245A07AD /* (correct) quotient */
r=147EB9E /* (correct) remainder */
"Base 16
"
"x = "; x /* output numbers just to be sure... */
"y = "; y
"quo = "; q
"rem = "; r
"x/y = "; x/y /* watch this result! */
"x%y = "; x%y /* watch this result! */
"y*q+r= "; y*q+r /* check quotient & remainder */
/*
* Do the same thing in base 10:
*/
"
Base 10
"
ibase=A
obase=10
"x = "; x /* output numbers just to be sure... */
"y = "; y
"q = "; q
"r = "; r
"x/y = "; x/y /* watch this result! */
"x%y = "; x%y /* watch this result! */
"y*q+r= "; y*q+r /* check quotient & remainder */
|