History

allow base 4 for input and output, 32 and 64 for output

Sigrid Solveig Haflínudóttir committed 4 years ago0.4

Commit c3690041 parent 5ff4a102 files · +5 −5Browse files

Unified · Split

2 files
  1. pc.1 +1 −1
  2. pc.y +4 −4
pc.1+1−1
@@ -61,7 +61,7 @@ Display \fIn\fR in decimal. · 60 unmodified lines
6161 Display \fIn\fR in hexadecimal.
6262 .TP
6363 .I pb(n, b)
64−Display \fIn\fR in base \fIb\fR (currently must be one of 0, 2, 8, 10, 16; 0 uses the defined output base).
64+Display \fIn\fR in base \fIb\fR (currently must be one of 0, 2, 4, 8, 10, 16, 32, 64; 0 uses the defined output base).
6565 .TP
6666 .I abs(n)
6767 Absolute value of \fIn\fR.
pc.y+4−4
@@ -196,7 +196,7 @@ numprint(Num *n) · 195 unmodified lines
196196 *--q = '_';
197197 i = 0;
198198 }
199− if(*p >= 'A')
199+ if(*p >= 'A' && b <= 16)
200200 *--q = *p + ('a' - 'A');
201201 else
202202 *--q = *p;
@@ -339,7 +339,7 @@ stat: { last = nil; } · 136 unmodified lines
339339 inbase = save;
340340 if(!fail)
341341 inbase = mptoi($3);
342− if(inbase != 2 && inbase != 8 && inbase != 10 && inbase != 16){
342+ if(inbase != 2 && inbase != 4 && inbase != 8 && inbase != 10 && inbase != 16){
343343 error("no.");
344344 inbase = save;
345345 }
@@ -352,7 +352,7 @@ stat: { last = nil; } · 6 unmodified lines
352352 save = outbase;
353353 if(!fail)
354354 outbase = mptoi($3);
355− if(outbase != 0 && outbase != 2 && outbase != 8 && outbase != 10 && outbase != 16){
355+ if(outbase != 0 && outbase != 2 && outbase != 4 && outbase != 8 && outbase != 10 && outbase != 16 && outbase != 32 && outbase != 64){
356356 error("no.");
357357 outbase = save;
358358 }
@@ -731,7 +731,7 @@ fnpb(int unused, Num **a) · 372 unmodified lines
731731 numdecref(a[1]);
732732 return nil;
733733 }
734− if(b != 0 && b != 2 && b != 8 && b != 10 && b != 16){
734+ if(b != 0 && b != 2 && b != 4 && b != 8 && b != 10 && b != 16 && b != 32 && b != 64){
735735 error("unsupported base");
736736 goto out;
737737 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t