Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Misc > Re: Trig Functi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 1414 of 1492
Post > Topic >>

Re: Trig Functions In Basic

by "Judson McClendon" <judmc@[EMAIL PROTECTED] > Jan 10, 2008 at 08:09 AM

"SomOne" <SomeOne@[EMAIL PROTECTED]
> wrote:
>
> I am looking for a compiled "Basic" that has the following functions:
>
> COS
> SIN
> TAN
> ARCOS
> ARCSIN
> ARCTAN
> DEG
> RAD
> ...
> Now I know that you can write a DefFN for ARCOS, ARCSIN, DEG, and RAD;
> however, you wind up loosing a point of precision and that I really
can't
> afford.
> ...
> Don't want to get into a phil disc on how to build a compiler, just want
> to find a basic that I can use to test some logic.

You say you can't afford to lose that precision. Such a statement can only
make sense in context of what precision you need vs. what precision the
BASIC provides. I.e. If your project needs 14 significant digits and the
BASIC provides 16, why would you care if the implementation of the trig
functions only gives you 15? The cir***ference of the earth in millimeters
is roughly 4x10^10. It's pretty hard to see why you would need more than
5 extra digits of precision. :-)

That said, there is a BASIC that has all the trig functions you list,
except for DEG and RAD, which are very easy to do yourself. It was
specifically designed for scientific work and has arbitrary precision up
to thousands of digits. However, it's an interpreter, not a compiler,
and it uses a more primitive BASIC dialect, using line numbers and does
not sup****t more modern structured constructs such as formal subroutines
and multi-line functions. It's called UBASIC, written by a Japanese
scientist. UBASIC is a calculating engine, with BASIC provided as an
algorithming tool to use the engine. You can download it for a number of
platforms from this page (it's Japanese, but the download links at the
top are clear enough to an English speaker, or use Google translate):

    http://www.rkmath.rikkyo.ac.jp/~kida/ubasic.htm

Here's a help file (you can download and save it):

    http://ed-thelen.org/bab/bab-ubhelp.html

For DEG and RAD, you need sufficiently accurate values of pi/180 and
180/pi, and below are they to 100+ digits. If you need more (hard to
imagine, since the volume of the universe in cubic microns is ~10^94),
download BIGCALC from my website (http://sunvaley.com).
It is a RPN
calculator program and can easily calculate these values (or any other
calculations you like; BIGCALC has pi and e as constants, and does sin,
cos, tan, acos, asin, atan and common and natural logs and anti-logs)
to any precision up to 1075 digits.

pi/180: 0.01745 32925 19943 29576 92369 07684 88612 71344 28718 88541
72545 60971 91440 17100 91146 03449 44368 22415 69634 50948 22

180/pi: 57.29577 95130 82320 87679 81548 14105 17033 24054 72466 56432
15491 60243 86120 28471 48321 55263 24409 68995 85111 09441 
86

Personally, I would simply use a convenient BASIC compiler with double
precision (64 bit) trig functions and write functions for what it didn't
have. Unless you're dealing with a flat earth the size of the orbit of
Neptune, or want to calculate the world coordinates of molecules, that
should be sufficient.

Hope this helps. :-)
-- 
Judson McClendon       judmc@[EMAIL PROTECTED]
 (remove zero)
Sun Valley Systems     http://sunvaley.com
"For God so loved the world that He gave His only begotten Son, that
whoever believes in Him should not perish but have everlasting life."
 




 2 Posts in Topic:
Trig Functions In Basic
"SomOne" <So  2008-01-09 23:28:41 
Re: Trig Functions In Basic
"Judson McClendon&qu  2008-01-10 08:09:33 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 20 15:12:15 CDT 2008.