pif_LongInt

by Popisfizzy
Double, triple, and quadruple-precision integers, both signed and unsigned.
ID:2078649
 
pif_LongInt version b1.1.20160502 is (finally) available! Took me longer than I had expected it to, but I kinda fell off doing any programming at all for a bit and then just worked slowly at it. The big news is that the SignedDouble class is finally finished and implemented and hopefully bug-free. At the very least, it passed the tests I gave it. We'll see what happens if and when people use the library.

Another big change is with argument formats, which are used all over the place in performing operations on objects. The two biggest changes are that pif_LongInt now supports string arguments and numeric arguments larger than 65535. For example,
var/pif_LongInt
SignedDouble
A = new(10)
B = new(15432123)
C = new(-16777215)
D = new("-1985229328")
E = new("0xC0FFEE")
F = new("-0b100101101011010000111")

UnsignedDouble
G = new("0xDEADBEEF")
H = new("0b101010")
I = new(1234567)
J = new("250")

world << A.Print()
world << B.Print()
world << C.Print()
world << D.Print()
world << E.Print()
world << F.Print()

world << G.Print()
world << H.Print()
world << I.Print()
world << J.Print()

and we get the following output
10
15432123
-16777215
-1985229328
12648430
-1234567
3735928559
42
1234567
250

which are each what we expect.

This should hopefully make working with the library easier, rather than having to pass a bitstring every time just to make things work.

Two other changes that impact the library. First is that the library is now licensed under the MIT license, whose text will be provided at the end of this post if you're interested in reading it. The second is that this library is now available on GitHub. You can keep track of updates to the library if you're really interested, or fork it, or whatever else you want to do (the MIT license is quite liberal in that regard).

Changelog:
pif_LongInt b1.1.20160502
  • Fixed several errors in computing remainders and quotients in division in the UnsignedDouble class.
  • Added more documentation to functions.
  • Made additions and modifications to the pif_Arithmetic protocol. Refer to below to see these changes.
  • Made rewrites to /UnsignedDouble.Remainder() and /UnsignedDouble.Divide(), significantly increasing their speeed. These modifications will "bubble" through to all other classes in the library, so the rewrite is highly-significant.
  • Implemented the SignedDouble class.
  • Fixed an oversight in Quotient() and Divide() that could sometimes result in the second block of a SignedDouble or UnsignedDouble from being overwritten when the object was not in NEW_OBJECT mode.

pif_Arithmetic protocol b1.1.20160502
  • Added Release Notes and To Do sections to pif_Arithmetic.
  • Added FirstFirstSet() and FindLastSet() methods.
  • Changed Highest() and Lowest() to Maximum() and Minumum(), respectively.
  • Clarified the behavior of the PrintBinary(), PrintDecimal(), and PrintHexadecimal() methods.
  • Added notes about the relationship between Quotient() and Remainder().
  • Added note about the legal output values of Remainder().
  • Added a note about restrictions on the output of Divide().
  • Added notes on how the comparison methods should handle incoming data when it is "distinct" from the source object. Refer to those methods in the pif_Arithmetic protocol file for details.
  • Added a note on the behavior of Negate() for signed integer objects, and more specifically the largest negative number representable for a fixed-width signed integer.
  • Added the Zero() "static" method.
  • Added a /pif_Arithmetic/ProtocolNonConformingObjectException exception as well as a note where to use it in the GAAF format.
  • Added a /pif_Arithmetic/NonNumericInvalidPositionException exception as well as a note where to use it in the GAAF format.
  • Updated the GAAF format to provide more details on how a list of integers should interpreted, and especially a list of one integer.

The MIT License
Copyright (c) 2016 Timothy "popisfizzy" Reilly

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.