Re: what am i doing wrong here.
- Posted by "Hayden McKay" <hmck1 at dodo.com.au> Dec 16, 2003
- 474 views
I found another way to get the any root of a number to 100% accuracy. (below) -- atom = root(atom digit, integer factor) -- Calculate the root of a digit. -- Returns the desired root. global function root(atom a,integer n) a = power(a,(1/n)) return a end function ----- Original Message ----- From: "Pete Lomax" <petelomax at blueyonder.co.uk> To: <EUforum at topica.com> Sent: Tuesday, December 16, 2003 10:46 PM Subject: Re: what am i doing wrong here. > > > On Tue, 16 Dec 2003 17:05:38 +1100, Hayden McKay <hmck1 at dodo.com.au> > wrote: > > >x = 86.0001776 - d -- x = 0.0001776 > >x = i - d -------------- x = 1.776461434e-005 -- why? > > Those two numbers are the same, just printed differently. > > Try using printf(1,"%1.7f\n",{x}) instead. > > >I'm trying to do this so I can get the root of x > >and subtract it from c so that > >c powerd again will equal ~exactly 86. > > This might be what you're after: > > function root(atom r, integer x) > return power(2.718281828,log(r)/x) > end function > > Any non-rational numbers will always be ~e-14 off. > > > > TOPICA - Start your own email discussion group. FREE! > > > -- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.551 / Virus Database: 343 - Release Date: 12/12/03 > --- --