Just devide the number by the number of digits in the truncated number minus one, multiplied by ten.
put (n/(((the number of chars in (trunc(n)))-1)*10)&&"x 10^"&((the number of chars in (trunc(n)))-1) -----Original Message----- From: "James Hurley" <[email protected]> To: [email protected] Sent: 4/20/2009 11:18 PM Subject: Re:convert to scientific notation > > Message: 3 > Date: Mon, 20 Apr 2009 16:53:05 -0700 > From: Randall Lee Reetz <[email protected]> > Subject: convert to scientific notation > To: How to use Revolution <[email protected]> > Message-ID: <[email protected]> > Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed > > I can't remember how to use power function "^" to find the nth root > of a number. To find the 2ndth root of a number we can use the "sqrt > ()" function. But to find the nth root???? > > For instance, lets say I want to convert a number to scientific > notation (the 10th root of that number)... I used to know how to use > the power function to do this. Anyone remember how to do it? > > I tried to get the 10th root (scientific notation) of 100 (which > should = 2) by: 100^(1/10) ... but that isn't it. > > Any ideas? I feel brain dead. > > Randall > Randall, Here is the function I have always used--see Turtle Graphics function sci tNum,sigFigures if tNum < 0 then put "-" into sign else put empty into sign put abs(tNum) into tNum if sigFigures is empty then put 3 into sigFigures --Default significant figures. put 0 into count if tNum >= 1 then repeat until tNum < 10 divide tNum by 10 add 1 to count end repeat put round((10^(sigFigures-1))*tNum)/10^(sigFigures-1) into tNum return sign & (char 1 to sigFigures + 1 of tNum) &"*10^" & count end if if tNum < 1 then repeat until tNum >= 1 multiply tNum by 10 add 1 to count end repeat end if return sign & (char 1 to sigFigures + 1 of tNum) & "*10^-" & count end sci For example: put sci(23346.445443,4) gives 2.335*10^4 Brute force, but functional. Jim Hurley [truncated by sender] _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
