Re: what am i doing wrong here.

new topic     » goto parent     » topic index » view thread      » older message » newer message

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.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu