Inspiration

I am actually on a project that is now experiencing a significant number of rounding errors and difficulties with several programming languages of external systems, how they all treat and manipulate and display numbers differently. It would be better if we had 1 system in charge of the math and only sent Text results to the others. Just display the text that has already been calculated and doesn't need to be calculated again.

What it does

The functions included in this library receive Text, which has arbitrary length, as inputs and performs arithmetic using recursion to arrive at an answer with arbitrary precision also stored as Text. It performs long addition, subtraction, and multiplication just like you learned to do in grade school, only in larger chunks to improve speed. These functions are admittedly slower than the standard mathematical operators, but the sacrifice in speed allows for an accurate answer with a virtually unlimited number of figures. You can multiply 12345678909999999999999999999999999122234985.10000450686048932334633 times 122333444455555666666777777788888888999999999 and get the 113 digit answer with no rounding if you chose.

Operations: Addition, Subtraction, Multiplication, Division, Reciprocal (1 divided by the number), Exponentiation, Logarithm

AP Math includes a calculator app that demonstrates all of the features of AP Math Library and can be utilized by anyone needing excessively precise calculations at their fingertips, as well as some helpful features specifically for Appian developers.

While on the subject of using math to manipulate Text, OP Math Library also features a few handy features for altering text mathematically including an Emojidex for isolating the right input for the char() function to get the Unicode icon you're looking for and a Fancy Text function for converting your text into a different font in Appian, as well as conversions of impressively large numbers to words or Roman Numerals.

How I built it

Exclusively in Appian

Challenges I ran into

Division is actually exceptionally hard. Unlike addition, subtraction, and multiplication, it can't be easily broken into chunks, and the actual solution to do within a reasonable time involves Calculus. Who knew calculus was easier than division?

Server crashed in the middle of Hackathon on a weekend.

Accomplishments that I'm proud of

Multiplication returns a 100 digit answer in under 1/100th of a second.

What I learned

All kinds of fun math, and plenty of not so fun math

What's next for AP Math Library

Implementation of other potentially important functions such as the trigonometric functions to arbitrary level of precision

Built With

  • appian
Share this project:

Updates