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
61Display \fIn\fR in hexadecimal.61Display \fIn\fR in hexadecimal.
62.TP62.TP
63.I pb(n, b)63.I pb(n, b)
64Display \fIn\fR in base \fIb\fR (currently must be one of 0, 2, 8, 10, 16; 0 uses the defined output base).64Display \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).
65.TP65.TP
66.I abs(n)66.I abs(n)
67Absolute value of \fIn\fR.67Absolute value of \fIn\fR.
pc.y+4−4
@@ -196,7 +196,7 @@ numprint(Num *n) · 195 unmodified lines
196 *--q = '_';196 *--q = '_';
197 i = 0;197 i = 0;
198 }198 }
199 if(*p >= 'A')199 if(*p >= 'A' && b <= 16)
200 *--q = *p + ('a' - 'A');200 *--q = *p + ('a' - 'A');
201 else201 else
202 *--q = *p;202 *--q = *p;
@@ -339,7 +339,7 @@ stat: { last = nil; } · 136 unmodified lines
339 inbase = save;339 inbase = save;
340 if(!fail) 340 if(!fail)
341 inbase = mptoi($3);341 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){
343 error("no.");343 error("no.");
344 inbase = save;344 inbase = save;
345 }345 }
@@ -352,7 +352,7 @@ stat: { last = nil; } · 6 unmodified lines
352 save = outbase;352 save = outbase;
353 if(!fail) 353 if(!fail)
354 outbase = mptoi($3);354 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){
356 error("no.");356 error("no.");
357 outbase = save;357 outbase = save;
358 }358 }
@@ -731,7 +731,7 @@ fnpb(int unused, Num **a) · 372 unmodified lines
731 numdecref(a[1]);731 numdecref(a[1]);
732 return nil;732 return nil;
733 }733 }
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){
735 error("unsupported base");735 error("unsupported base");
736 goto out;736 goto out;
737 }737 }

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