Skip to content

Commit 2a1dfe6

Browse files
committed
Minor code edits
1 parent b151f99 commit 2a1dfe6

5 files changed

Lines changed: 46 additions & 42 deletions

File tree

Numbers/PeterO/Numbers/EDecimal.cs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,13 @@ namespace PeterO.Numbers {
9595
/// too, unless the flag's trap is enabled in the arithmetic context
9696
/// (see EContext's Traps property).</para>
9797
/// <para>If an operation requires creating an intermediate value that
98-
/// might be too big to fit in memory (or might require more than 2
99-
/// gigabytes of memory to store -- due to the current use of a 32-bit
100-
/// integer internally as a length), the operation may signal an
101-
/// invalid-operation flag and return not-a-number (NaN). In certain
102-
/// rare cases, the CompareTo method may throw OutOfMemoryException
103-
/// (called OutOfMemoryError in Java) in the same circumstances.</para>
98+
/// might be too big to fit in system memory (or might require more
99+
/// than 2 gigabytes of system memory to store -- due to the current
100+
/// use of a 32-bit integer internally as a length), the operation may
101+
/// signal an invalid-operation flag and return not-a-number (NaN). In
102+
/// certain rare cases, the CompareTo method may throw
103+
/// OutOfMemoryException (called OutOfMemoryError in Java) in the same
104+
/// circumstances.</para>
104105
/// <para><b>Serialization</b>
105106
/// </para>
106107
/// <para>An arbitrary-precision decimal value can be serialized
@@ -5337,10 +5338,10 @@ public double ToDouble() {
53375338
/// <summary>Converts this value to an arbitrary-precision integer,
53385339
/// discarding the fractional part in this value. Note that depending
53395340
/// on the value, especially the exponent, generating the
5340-
/// arbitrary-precision integer may require a huge amount of memory.
5341-
/// Use the ToSizedEInteger method to convert a number to an EInteger
5342-
/// only if the integer fits in a bounded bit range; that method will
5343-
/// throw an exception on overflow.</summary>
5341+
/// arbitrary-precision integer may require a huge amount of system
5342+
/// memory. Use the ToSizedEInteger method to convert a number to an
5343+
/// EInteger only if the integer fits in a bounded bit range; that
5344+
/// method will throw an exception on overflow.</summary>
53445345
/// <returns>An arbitrary-precision integer.</returns>
53455346
/// <exception cref='OverflowException'>This object's value is infinity
53465347
/// or not-a-number (NaN).</exception>
@@ -5354,9 +5355,10 @@ public EInteger ToEInteger() {
53545355
/// checking whether the fractional part of the value would be lost.
53555356
/// Note that depending on the value, especially the exponent,
53565357
/// generating the arbitrary-precision integer may require a huge
5357-
/// amount of memory. Use the ToSizedEIntegerIfExact method to convert
5358-
/// a number to an EInteger only if the integer fits in a bounded bit
5359-
/// range; that method will throw an exception on overflow.</summary>
5358+
/// amount of system memory. Use the ToSizedEIntegerIfExact method to
5359+
/// convert a number to an EInteger only if the integer fits in a
5360+
/// bounded bit range; that method will throw an exception on
5361+
/// overflow.</summary>
53605362
/// <returns>An arbitrary-precision integer.</returns>
53615363
/// <exception cref='OverflowException'>This object's value is infinity
53625364
/// or not-a-number (NaN).</exception>
@@ -5371,9 +5373,10 @@ public EInteger ToEIntegerExact() {
53715373
/// checking whether the fractional part of the value would be lost.
53725374
/// Note that depending on the value, especially the exponent,
53735375
/// generating the arbitrary-precision integer may require a huge
5374-
/// amount of memory. Use the ToSizedEIntegerIfExact method to convert
5375-
/// a number to an EInteger only if the integer fits in a bounded bit
5376-
/// range; that method will throw an exception on overflow.</summary>
5376+
/// amount of system memory. Use the ToSizedEIntegerIfExact method to
5377+
/// convert a number to an EInteger only if the integer fits in a
5378+
/// bounded bit range; that method will throw an exception on
5379+
/// overflow.</summary>
53775380
/// <returns>An arbitrary-precision integer.</returns>
53785381
/// <exception cref='OverflowException'>This object's value is infinity
53795382
/// or not-a-number (NaN).</exception>

Numbers/PeterO/Numbers/EDecimals.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ internal static byte[] FromLogical(EInteger um, EContext ec, int iradix) {
10101010
null;
10111011
EInteger bytecount = prec.ShiftRight(3).Add(1);
10121012
if (bytecount.CompareTo(0x7fffffff) > 0) {
1013-
return null; // Out of memory
1013+
return null; // Out of system memory
10141014
}
10151015
var bitindex = 0;
10161016
var bytes = new byte[bytecount.ToInt32Checked()];

Numbers/PeterO/Numbers/EFloat.cs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ namespace PeterO.Numbers {
4545
/// identify a particular arbitrary-precision binary floating-point
4646
/// number value.</item></list>
4747
/// <para>If an operation requires creating an intermediate value that
48-
/// might be too big to fit in memory (or might require more than 2
49-
/// gigabytes of memory to store -- due to the current use of a 32-bit
50-
/// integer internally as a length), the operation may signal an
51-
/// invalid-operation flag and return not-a-number (NaN). In certain
52-
/// rare cases, the CompareTo method may throw OutOfMemoryException
53-
/// (called OutOfMemoryError in Java) in the same circumstances.</para>
48+
/// might be too big to fit in system memory (or might require more
49+
/// than 2 gigabytes of system memory to store -- due to the current
50+
/// use of a 32-bit integer internally as a length), the operation may
51+
/// signal an invalid-operation flag and return not-a-number (NaN). In
52+
/// certain rare cases, the CompareTo method may throw
53+
/// OutOfMemoryException (called OutOfMemoryError in Java) in the same
54+
/// circumstances.</para>
5455
/// <para><b>Thread safety</b></para>
5556
/// <para>Instances of this class are immutable, so they are inherently
5657
/// safe for use by multiple threads. Multiple instances of this object
@@ -4338,9 +4339,9 @@ public EDecimal ToEDecimal() {
43384339
/// fractional part of this value will be discarded when converting to
43394340
/// an arbitrary-precision integer. Note that depending on the value,
43404341
/// especially the exponent, generating the arbitrary-precision integer
4341-
/// may require a huge amount of memory. Use the ToSizedEInteger method
4342-
/// to convert a number to an EInteger only if the integer fits in a
4343-
/// bounded bit range; that method will throw an exception on
4342+
/// may require a huge amount of system memory. Use the ToSizedEInteger
4343+
/// method to convert a number to an EInteger only if the integer fits
4344+
/// in a bounded bit range; that method will throw an exception on
43444345
/// overflow.</summary>
43454346
/// <returns>An arbitrary-precision integer.</returns>
43464347
/// <exception cref='OverflowException'>This object's value is infinity
@@ -4352,10 +4353,10 @@ public EInteger ToEInteger() {
43524353
/// <summary>Converts this value to an arbitrary-precision integer,
43534354
/// checking whether the value contains a fractional part. Note that
43544355
/// depending on the value, especially the exponent, generating the
4355-
/// arbitrary-precision integer may require a huge amount of memory.
4356-
/// Use the ToSizedEIntegerIfExact method to convert a number to an
4357-
/// EInteger only if the integer fits in a bounded bit range; that
4358-
/// method will throw an exception on overflow.</summary>
4356+
/// arbitrary-precision integer may require a huge amount of system
4357+
/// memory. Use the ToSizedEIntegerIfExact method to convert a number
4358+
/// to an EInteger only if the integer fits in a bounded bit range;
4359+
/// that method will throw an exception on overflow.</summary>
43594360
/// <returns>An arbitrary-precision integer.</returns>
43604361
/// <exception cref='OverflowException'>This object's value is infinity
43614362
/// or not-a-number (NaN).</exception>
@@ -4369,10 +4370,10 @@ public EInteger ToEIntegerExact() {
43694370
/// <summary>Converts this value to an arbitrary-precision integer,
43704371
/// checking whether the value contains a fractional part. Note that
43714372
/// depending on the value, especially the exponent, generating the
4372-
/// arbitrary-precision integer may require a huge amount of memory.
4373-
/// Use the ToSizedEIntegerIfExact method to convert a number to an
4374-
/// EInteger only if the integer fits in a bounded bit range; that
4375-
/// method will throw an exception on overflow.</summary>
4373+
/// arbitrary-precision integer may require a huge amount of system
4374+
/// memory. Use the ToSizedEIntegerIfExact method to convert a number
4375+
/// to an EInteger only if the integer fits in a bounded bit range;
4376+
/// that method will throw an exception on overflow.</summary>
43764377
/// <returns>An arbitrary-precision integer.</returns>
43774378
/// <exception cref='OverflowException'>This object's value is infinity
43784379
/// or not-a-number (NaN).</exception>

docs/PeterO.Numbers.EDecimal.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Unless noted otherwise, passing a null arbitrary-precision decimal argument to a
3232

3333
When an arithmetic operation signals the flag FlagInvalid, FlagOverflow, or FlagDivideByZero, it will not throw an exception too, unless the flag's trap is enabled in the arithmetic context (see EContext's Traps property).
3434

35-
If an operation requires creating an intermediate value that might be too big to fit in memory (or might require more than 2 gigabytes of memory to store -- due to the current use of a 32-bit integer internally as a length), the operation may signal an invalid-operation flag and return not-a-number (NaN). In certain rare cases, the CompareTo method may throw OutOfMemoryException (called OutOfMemoryError in Java) in the same circumstances.
35+
If an operation requires creating an intermediate value that might be too big to fit in system memory (or might require more than 2 gigabytes of system memory to store -- due to the current use of a 32-bit integer internally as a length), the operation may signal an invalid-operation flag and return not-a-number (NaN). In certain rare cases, the CompareTo method may throw OutOfMemoryException (called OutOfMemoryError in Java) in the same circumstances.
3636

3737
<b>Serialization</b>
3838

@@ -4809,7 +4809,7 @@ An arbitrary-precision binary floating-point number.
48094809

48104810
public PeterO.Numbers.EInteger ToEInteger();
48114811

4812-
Converts this value to an arbitrary-precision integer, discarding the fractional part in this value. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of memory. Use the ToSizedEInteger method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
4812+
Converts this value to an arbitrary-precision integer, discarding the fractional part in this value. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of system memory. Use the ToSizedEInteger method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
48134813

48144814
<b>Return Value:</b>
48154815

@@ -4830,7 +4830,7 @@ There is not enough memory to store the value as an EInteger.
48304830

48314831
<b>Obsolete.</b> Renamed to ToEIntegerIfExact.
48324832

4833-
Converts this value to an arbitrary-precision integer, checking whether the fractional part of the value would be lost. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of memory. Use the ToSizedEIntegerIfExact method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
4833+
Converts this value to an arbitrary-precision integer, checking whether the fractional part of the value would be lost. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of system memory. Use the ToSizedEIntegerIfExact method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
48344834

48354835
<b>Return Value:</b>
48364836

@@ -4849,7 +4849,7 @@ This object's value is not an exact integer.
48494849

48504850
public PeterO.Numbers.EInteger ToEIntegerIfExact();
48514851

4852-
Converts this value to an arbitrary-precision integer, checking whether the fractional part of the value would be lost. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of memory. Use the ToSizedEIntegerIfExact method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
4852+
Converts this value to an arbitrary-precision integer, checking whether the fractional part of the value would be lost. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of system memory. Use the ToSizedEIntegerIfExact method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
48534853

48544854
<b>Return Value:</b>
48554855

docs/PeterO.Numbers.EFloat.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ An arbitrary-precision binary floating-point number value can be serialized in o
1818

1919
* By calling the UnsignedMantissa, Exponent, and IsNegative properties, and calling the IsInfinity, IsQuietNaN, and IsSignalingNaN methods. The return values combined will uniquely identify a particular arbitrary-precision binary floating-point number value.
2020

21-
If an operation requires creating an intermediate value that might be too big to fit in memory (or might require more than 2 gigabytes of memory to store -- due to the current use of a 32-bit integer internally as a length), the operation may signal an invalid-operation flag and return not-a-number (NaN). In certain rare cases, the CompareTo method may throw OutOfMemoryException (called OutOfMemoryError in Java) in the same circumstances.
21+
If an operation requires creating an intermediate value that might be too big to fit in system memory (or might require more than 2 gigabytes of system memory to store -- due to the current use of a 32-bit integer internally as a length), the operation may signal an invalid-operation flag and return not-a-number (NaN). In certain rare cases, the CompareTo method may throw OutOfMemoryException (called OutOfMemoryError in Java) in the same circumstances.
2222

2323
<b>Thread safety</b>
2424

@@ -4423,7 +4423,7 @@ This number, converted to an arbitrary-precision decimal number.
44234423

44244424
public PeterO.Numbers.EInteger ToEInteger();
44254425

4426-
Converts this value to an arbitrary-precision integer. Any fractional part of this value will be discarded when converting to an arbitrary-precision integer. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of memory. Use the ToSizedEInteger method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
4426+
Converts this value to an arbitrary-precision integer. Any fractional part of this value will be discarded when converting to an arbitrary-precision integer. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of system memory. Use the ToSizedEInteger method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
44274427

44284428
<b>Return Value:</b>
44294429

@@ -4441,7 +4441,7 @@ This object's value is infinity or not-a-number (NaN).
44414441

44424442
<b>Obsolete.</b> Renamed to ToEIntegerIfExact.
44434443

4444-
Converts this value to an arbitrary-precision integer, checking whether the value contains a fractional part. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of memory. Use the ToSizedEIntegerIfExact method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
4444+
Converts this value to an arbitrary-precision integer, checking whether the value contains a fractional part. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of system memory. Use the ToSizedEIntegerIfExact method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
44454445

44464446
<b>Return Value:</b>
44474447

@@ -4460,7 +4460,7 @@ This object's value is not an exact integer.
44604460

44614461
public PeterO.Numbers.EInteger ToEIntegerIfExact();
44624462

4463-
Converts this value to an arbitrary-precision integer, checking whether the value contains a fractional part. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of memory. Use the ToSizedEIntegerIfExact method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
4463+
Converts this value to an arbitrary-precision integer, checking whether the value contains a fractional part. Note that depending on the value, especially the exponent, generating the arbitrary-precision integer may require a huge amount of system memory. Use the ToSizedEIntegerIfExact method to convert a number to an EInteger only if the integer fits in a bounded bit range; that method will throw an exception on overflow.
44644464

44654465
<b>Return Value:</b>
44664466

0 commit comments

Comments
 (0)