Skip to content

Commit b7b1757

Browse files
committed
Version 2.1
1 parent 23068e4 commit b7b1757

7 files changed

Lines changed: 869 additions & 1695 deletions

File tree

PeterO/DebugUtility.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ internal static class DebugUtility
1313
[System.Diagnostics.Conditional("DEBUG")]
1414
public static void Log(string str) {
1515
Type type = Type.GetType("System.Console");
16-
type.GetMethod(
17-
"WriteLine",
18-
new[] { typeof(
19-
String) }).Invoke(
20-
type,
16+
var types = new[] { typeof(String) };
17+
type.GetMethod("WriteLine", types).Invoke(
18+
type,
2119
new object[] { str });
2220
}
2321
[System.Diagnostics.Conditional("DEBUG")]

PeterO/ExtendedDecimal.cs

Lines changed: 443 additions & 874 deletions
Large diffs are not rendered by default.

PeterO/ExtendedFloat.cs

Lines changed: 388 additions & 766 deletions
Large diffs are not rendered by default.

Portable.CBOR.nuspec

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@
1616
</description>
1717
<summary>A C# implementation of Concise Binary Object Representation (CBOR), a data serialization format. This implementation can also convert between CBOR and JSON.</summary>
1818
<releaseNotes>
19-
In version 2.0:
20-
- Several very special characters are escaped in JSON output, such as line and paragraph
21-
separators, and byte order marks.
22-
- BigInteger's longValue method was fixed
23-
- BigInteger was changed to have no public constructors
24-
- ReadJSON now supports UTF-16 and UTF-32 in addition to UTF-8
25-
- PrecisionContext's JavaBigDecimal object was corrected.
26-
- Fixed bugs in parsing JSON numbers in some cases
27-
- CBORObject's one-argument Add method now adds CBORObject.Null if passed null,
28-
rather than throwing an exception.
29-
See the project page for release notes on previous versions: https://github.com/peteroupc/CBOR
19+
In version 2.1:
20+
- Added Ulp, Precision, MovePointLeft, MovePointRight, and ScaleToPowerOfTwo/-Ten methods to
21+
ExtendedDecimal and ExtendedFloat
22+
- Fixed double-rounding issue with ToDouble and ToFloat methods
23+
of ExtendedDecimal
24+
- Added Odd and OddOrZeroFiveUp rounding modes
25+
- Added non-decimal base conversion features to BigInteger
26+
- Other bug fixes See the project page for release notes on previous versions: https://github.com/peteroupc/CBOR
3027
</releaseNotes>
3128
<copyright>Written by Peter O. in 2013-2014. Any copyright is released to the Public Domain.</copyright>
3229
<tags>cbor data serialization binary json numbers arithmetic</tags>

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,16 @@ The following are some clarifications to RFC 7049.
197197
Release Notes
198198
-----------
199199

200+
In version 2.1:
201+
202+
- Added Ulp, Precision, MovePointLeft, MovePointRight, and ScaleToPowerOfTwo/-Ten methods to
203+
ExtendedDecimal and ExtendedFloat
204+
- Fixed double-rounding issue with ToDouble and ToFloat methods
205+
of ExtendedDecimal
206+
- Added Odd and OddOrZeroFiveUp rounding modes
207+
- Added non-decimal base conversion features to BigInteger
208+
- Other bug fixes
209+
200210
In version 2.0:
201211

202212
- Several very special characters are escaped in JSON output, such as line and paragraph

docs/PeterO.ExtendedDecimal.md

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,12 +1737,10 @@ Pi rounded to the given precision. Signals FlagInvalid and returns NaN if the pa
17371737
public PeterO.ExtendedDecimal MovePointLeft(
17381738
int places);
17391739

1740-
Returns a number similar to this number but with the decimal point moved to the right.
1740+
Returns a number similar to this number but with the decimal point moved to the right.
17411741

17421742
<b>Parameters:</b>
17431743

1744-
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
1745-
17461744
* <i>places</i>: A 32-bit signed integer.
17471745

17481746
<b>Returns:</b>
@@ -1759,11 +1757,9 @@ Returns a number similar to this number but with the decimal point moved to the
17591757

17601758
<b>Parameters:</b>
17611759

1762-
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
1763-
17641760
* <i>places</i>: A 32-bit signed integer.
17651761

1766-
* <i>ctx</i>: A PrecisionContext object.
1762+
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
17671763

17681764
<b>Returns:</b>
17691765

@@ -1774,12 +1770,10 @@ An ExtendedDecimal object.
17741770
public PeterO.ExtendedDecimal MovePointLeft(
17751771
PeterO.BigInteger bigPlaces);
17761772

1777-
Returns a number similar to this number but with the decimal point moved to the left.
1773+
Returns a number similar to this number but with the decimal point moved to the left.
17781774

17791775
<b>Parameters:</b>
17801776

1781-
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
1782-
17831777
* <i>bigPlaces</i>: A BigInteger object.
17841778

17851779
<b>Returns:</b>
@@ -1796,11 +1790,9 @@ Returns a number similar to this number but with the decimal point moved to the
17961790

17971791
<b>Parameters:</b>
17981792

1799-
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
1800-
18011793
* <i>bigPlaces</i>: A BigInteger object.
18021794

1803-
* <i>ctx</i>: A PrecisionContext object.
1795+
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
18041796

18051797
<b>Returns:</b>
18061798

@@ -1833,7 +1825,7 @@ Returns a number similar to this number but with the decimal point moved to the
18331825

18341826
* <i>places</i>: A 32-bit signed integer.
18351827

1836-
* <i>ctx</i>: A PrecisionContext object.
1828+
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
18371829

18381830
<b>Returns:</b>
18391831

@@ -1844,12 +1836,10 @@ An ExtendedDecimal object.
18441836
public PeterO.ExtendedDecimal MovePointRight(
18451837
PeterO.BigInteger bigPlaces);
18461838

1847-
Returns a number similar to this number but with the decimal point moved to the right.
1839+
Returns a number similar to this number but with the decimal point moved to the right.
18481840

18491841
<b>Parameters:</b>
18501842

1851-
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
1852-
18531843
* <i>bigPlaces</i>: A BigInteger object.
18541844

18551845
<b>Returns:</b>
@@ -1868,7 +1858,7 @@ Returns a number similar to this number but with the decimal point moved to the
18681858

18691859
* <i>bigPlaces</i>: A BigInteger object.
18701860

1871-
* <i>ctx</i>: A PrecisionContext object.
1861+
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
18721862

18731863
<b>Returns:</b>
18741864

@@ -1902,7 +1892,7 @@ Returns a number similar to this number but with the scale adjusted.
19021892

19031893
* <i>places</i>: A 32-bit signed integer.
19041894

1905-
* <i>ctx</i>: A PrecisionContext object.
1895+
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
19061896

19071897
<b>Returns:</b>
19081898

@@ -1917,8 +1907,6 @@ Returns a number similar to this number but with the scale adjusted.
19171907

19181908
<b>Parameters:</b>
19191909

1920-
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
1921-
19221910
* <i>bigPlaces</i>: A BigInteger object.
19231911

19241912
<b>Returns:</b>
@@ -1937,7 +1925,7 @@ Returns a number similar to this number but with its scale adjusted.
19371925

19381926
* <i>bigPlaces</i>: A BigInteger object.
19391927

1940-
* <i>ctx</i>: A PrecisionContext object.
1928+
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
19411929

19421930
<b>Returns:</b>
19431931

docs/PeterO.ExtendedFloat.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,12 +1760,10 @@ The parameter <i>ctx</i>
17601760
public PeterO.ExtendedFloat MovePointLeft(
17611761
int places);
17621762

1763-
Returns a number similar to this number but with the radix point moved to the left.
1763+
Returns a number similar to this number but with the radix point moved to the left.
17641764

17651765
<b>Parameters:</b>
17661766

1767-
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
1768-
17691767
* <i>places</i>: A 32-bit signed integer.
17701768

17711769
<b>Returns:</b>
@@ -1778,15 +1776,13 @@ An ExtendedFloat object.
17781776
int places,
17791777
PeterO.PrecisionContext ctx);
17801778

1781-
Returns a number similar to this number but with the radix point moved to the left.
1779+
Returns a number similar to this number but with the radix point moved to the left.
17821780

17831781
<b>Parameters:</b>
17841782

1785-
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
1786-
17871783
* <i>places</i>: A 32-bit signed integer.
17881784

1789-
* <i>ctx</i>: A PrecisionContext object.
1785+
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
17901786

17911787
<b>Returns:</b>
17921788

@@ -1801,8 +1797,6 @@ Returns a number similar to this number but with the radix point moved to the le
18011797

18021798
<b>Parameters:</b>
18031799

1804-
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
1805-
18061800
* <i>bigPlaces</i>: A BigInteger object.
18071801

18081802
<b>Returns:</b>
@@ -1821,7 +1815,7 @@ Returns a number similar to this number but with the radix point moved to the le
18211815

18221816
* <i>bigPlaces</i>: A BigInteger object.
18231817

1824-
* <i>ctx</i>: A PrecisionContext object.
1818+
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
18251819

18261820
<b>Returns:</b>
18271821

@@ -1854,7 +1848,7 @@ Returns a number similar to this number but with the radix point moved to the ri
18541848

18551849
* <i>places</i>: A 32-bit signed integer.
18561850

1857-
* <i>ctx</i>: A PrecisionContext object.
1851+
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
18581852

18591853
<b>Returns:</b>
18601854

@@ -1885,11 +1879,9 @@ Returns a number similar to this number but with the radix point moved to the ri
18851879

18861880
<b>Parameters:</b>
18871881

1888-
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
1889-
18901882
* <i>bigPlaces</i>: A BigInteger object.
18911883

1892-
* <i>ctx</i>: A PrecisionContext object.
1884+
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
18931885

18941886
<b>Returns:</b>
18951887

@@ -1923,7 +1915,7 @@ Returns a number similar to this number but with the scale adjusted.
19231915

19241916
* <i>places</i>: A 32-bit signed integer.
19251917

1926-
* <i>ctx</i>: A PrecisionContext object.
1918+
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
19271919

19281920
<b>Returns:</b>
19291921

@@ -1934,12 +1926,10 @@ An ExtendedDecimal object.
19341926
public PeterO.ExtendedFloat ScaleByPowerOfTwo(
19351927
PeterO.BigInteger bigPlaces);
19361928

1937-
Returns a number similar to this number but with the scale adjusted.
1929+
Returns a number similar to this number but with the scale adjusted.
19381930

19391931
<b>Parameters:</b>
19401932

1941-
* <i>ctx</i>: A precision context to control precision, rounding, and exponent range of the result. If HasFlags of the context is true, will also store the flags resulting from the operation (the flags are in addition to the pre-existing flags). Can be null.
1942-
19431933
* <i>bigPlaces</i>: A BigInteger object.
19441934

19451935
<b>Returns:</b>

0 commit comments

Comments
 (0)