Programming Languages

techBASIC_Icon.jpg Desktop Computing Power
techBASIC brings the power of a desktop computer to your iPhone/iPad for programming, collecting and analyzing data, and visualizing and manipulating stunning 3D graphics. It’s a full implementation of the famously easy to use BASIC Programming Language with specialized array and matrix commands built in.

During the time I was learning and developing programs in SmartBASIC, I ran into problems when working on papers and research in my cosmolbou fields. If I tried to expand the exponent of the mass of the Sun, for example, 2*10^30, I should get 2 followed by 30 zeroes.

Instead, in SmartBASIC, as is in the language it is written in, C/C++, it uses the 8-11-53 mantassia method of precision for all number less than 2^53-1, or 9,007,199,254,740,992 (or just more than 9 Quadrillion).

For most business applications, this is perfectly fine. Our currency is based on the debt sytem, according to the Federal Reserve’s own document, and we are $20 trillion in debt today (as of Jan 25, 2017). That is 2 followed by 12 zeroes, well within the precision computational powers of SmartBASIC.

What happens when you need to calculate the temperature of a black hole 30 times the mass of the Sun, or (2*10^30)*30?

First, when you convert in SmartBASIC your exponent of 2E+30 into a long string, you expect to see 2,000,000,000,000,000,000,000,000,000,000 ( or 2 Nonillion). But SmartBASIC, since it only represents numbers upt to 2^53 with precision, you get:


Where did 39,769,249,677,312 come from? They are all supposed to be zeroes. All I did was expand the exponent into a long string.

I was told that the mantissa was only accurate to seven numbers, and that the rest was due to the unprecise way SmarBASIC, or C/C++ or the hardware math chip handles large numbers.

So in looking for an alternative, I, with the help of a friend, found techBASIC, and I was hooked when a scientist said it worked great with large numbers and it is calculus ready. so I decided to do a small experiment, as I never worked with a programming language that had such a low threshold for precision numbers, and all my calculations were wrong!

However, even TechBASIC has its limitations, and unless you program in “R” language, which is what I used to verify which results were correct, we wrote our own large number math functions, that can calcuate digits and decimals accurately too 100 digits and 100 decimal places, or greater. The division function was the most difficult, which I had to take a new approach to it, and I am glad to report that it is working and will be made available to SmartBASIC and TechBASIC by December, and to PowerBASIC in the first quarter of 2018. QB64 will have its functions ready by mid-2018.

Page last updated on October 21 at 2:10pm
Copyright ©2016 by George McGinn. All rights reserved.


This page has the following sub pages.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s