Skip to content

Commit

Permalink
Version 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
peteroupc committed Nov 21, 2014
1 parent 23068e4 commit b7b1757
Show file tree
Hide file tree
Showing 7 changed files with 869 additions and 1,695 deletions.
8 changes: 3 additions & 5 deletions PeterO/DebugUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ internal static class DebugUtility
[System.Diagnostics.Conditional("DEBUG")]
public static void Log(string str) {
Type type = Type.GetType("System.Console");
type.GetMethod(
"WriteLine",
new[] { typeof(
String) }).Invoke(
type,
var types = new[] { typeof(String) };
type.GetMethod("WriteLine", types).Invoke(
type,
new object[] { str });
}
[System.Diagnostics.Conditional("DEBUG")]
Expand Down
1,317 changes: 443 additions & 874 deletions PeterO/ExtendedDecimal.cs

Large diffs are not rendered by default.

1,154 changes: 388 additions & 766 deletions PeterO/ExtendedFloat.cs

Large diffs are not rendered by default.

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

In version 2.1:

- Added Ulp, Precision, MovePointLeft, MovePointRight, and ScaleToPowerOfTwo/-Ten methods to
ExtendedDecimal and ExtendedFloat
- Fixed double-rounding issue with ToDouble and ToFloat methods
of ExtendedDecimal
- Added Odd and OddOrZeroFiveUp rounding modes
- Added non-decimal base conversion features to BigInteger
- Other bug fixes

In version 2.0:

- Several very special characters are escaped in JSON output, such as line and paragraph
Expand Down
30 changes: 9 additions & 21 deletions docs/PeterO.ExtendedDecimal.md
Original file line number Diff line number Diff line change
Expand Up @@ -1737,12 +1737,10 @@ Pi rounded to the given precision. Signals FlagInvalid and returns NaN if the pa
public PeterO.ExtendedDecimal MovePointLeft(
int places);

Returns a number similar to this number but with the decimal point moved to the right.
Returns a number similar to this number but with the decimal point moved to the right.

<b>Parameters:</b>

* <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.

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

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

<b>Parameters:</b>

* <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.

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

* <i>ctx</i>: A PrecisionContext object.
* <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.

<b>Returns:</b>

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

Returns a number similar to this number but with the decimal point moved to the left.
Returns a number similar to this number but with the decimal point moved to the left.

<b>Parameters:</b>

* <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.

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

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

<b>Parameters:</b>

* <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.

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

* <i>ctx</i>: A PrecisionContext object.
* <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.

<b>Returns:</b>

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

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

* <i>ctx</i>: A PrecisionContext object.
* <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.

<b>Returns:</b>

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

Returns a number similar to this number but with the decimal point moved to the right.
Returns a number similar to this number but with the decimal point moved to the right.

<b>Parameters:</b>

* <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.

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

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

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

* <i>ctx</i>: A PrecisionContext object.
* <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.

<b>Returns:</b>

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

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

* <i>ctx</i>: A PrecisionContext object.
* <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.

<b>Returns:</b>

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

<b>Parameters:</b>

* <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.

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

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

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

* <i>ctx</i>: A PrecisionContext object.
* <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.

<b>Returns:</b>

Expand Down
26 changes: 8 additions & 18 deletions docs/PeterO.ExtendedFloat.md
Original file line number Diff line number Diff line change
Expand Up @@ -1760,12 +1760,10 @@ The parameter <i>ctx</i>
public PeterO.ExtendedFloat MovePointLeft(
int places);

Returns a number similar to this number but with the radix point moved to the left.
Returns a number similar to this number but with the radix point moved to the left.

<b>Parameters:</b>

* <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.

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

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

Returns a number similar to this number but with the radix point moved to the left.
Returns a number similar to this number but with the radix point moved to the left.

<b>Parameters:</b>

* <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.

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

* <i>ctx</i>: A PrecisionContext object.
* <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.

<b>Returns:</b>

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

<b>Parameters:</b>

* <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.

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

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

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

* <i>ctx</i>: A PrecisionContext object.
* <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.

<b>Returns:</b>

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

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

* <i>ctx</i>: A PrecisionContext object.
* <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.

<b>Returns:</b>

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

<b>Parameters:</b>

* <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.

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

* <i>ctx</i>: A PrecisionContext object.
* <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.

<b>Returns:</b>

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

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

* <i>ctx</i>: A PrecisionContext object.
* <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.

<b>Returns:</b>

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

Returns a number similar to this number but with the scale adjusted.
Returns a number similar to this number but with the scale adjusted.

<b>Parameters:</b>

* <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.

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

<b>Returns:</b>
Expand Down

0 comments on commit b7b1757

Please sign in to comment.