summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Prakash Jana <engineerarun@gmail.com>2018-10-02 13:29:35 +0530
committerArun Prakash Jana <engineerarun@gmail.com>2018-10-02 13:29:35 +0530
commitd0cbf587020f78e26f03246939e4fb5c83c776fe (patch)
treea1093aa73bb8bbfee0f37ce142c41738219bdfd1
parent60a98f5180835b764a9da98ef7cbcca16710855f (diff)
Set bc scale=10, add test
-rw-r--r--README.md2
-rw-r--r--bcal.12
-rw-r--r--src/bcal.c2
-rwxr-xr-xtest.py2
4 files changed, 5 insertions, 3 deletions
diff --git a/README.md b/README.md
index d721a36..11524f9 100644
--- a/README.md
+++ b/README.md
@@ -169,7 +169,7 @@ optional arguments:
- sector size: 0x200 (512)
- max heads per cylinder: 0x10 (16)
- max sectors per track: 0x3f (63)
-- **bc variables**: scale = 5, ibase = 10. `bc` is not called in minimal output mode.
+- **bc variables**: scale = 10, ibase = 10. `bc` is not called in minimal output mode.
### Examples
diff --git a/bcal.1 b/bcal.1
index c664c1c..9f86b8c 100644
--- a/bcal.1
+++ b/bcal.1
@@ -60,7 +60,7 @@ Refer to:
- max sectors per track: 0x3f (63)
.PP
.IP 10. 4
-\fBbc variables\fR: scale = 5, ibase = 10. \fIbc\fR is not called in minimal output mode.
+\fBbc variables\fR: scale = 10, ibase = 10. \fIbc\fR is not called in minimal output mode.
.SH OPTIONS
.TP
.BI "-c=" N
diff --git a/src/bcal.c b/src/bcal.c
index ba74608..ee116f8 100644
--- a/src/bcal.c
+++ b/src/bcal.c
@@ -208,7 +208,7 @@ static int try_bc(char *expr)
/* parent */
char buffer[128] = "";
- ret = write(pipe_pc[1], "scale=5\n", 8);
+ ret = write(pipe_pc[1], "scale=10\n", 9);
ret = write(pipe_pc[1], "last=", 5);
if (lastres.p[0])
diff --git a/test.py b/test.py
index a646a4f..7580b7b 100755
--- a/test.py
+++ b/test.py
@@ -86,6 +86,7 @@ test = [
('./bcal', '-m', "2 >>> 2"), # 61
('./bcal', '-m', "2 b<3"), # 62
('./bcal', '-m', "(2giB * 2) / (2kib >> 2)"), # 63
+ ('./bcal', '-b', "9876543210.987654321 * 123456789.123456789"), # 64
]
res = [
@@ -154,6 +155,7 @@ res = [
b'ERROR: invalid sequence >>>\n', # 61
b'ERROR: invalid operator <\n', # 62
b'8388608\n', # 63
+ b'1219326312467611632.3609205901\n', # 64
]