LOG Transformer

[Total: 0    Average: 0/5]

At the time of writing, javascript does not provide a method to calculate logarithms at all base levels.

Body Code:

<script language="javascript">
<!--
/*This script can be used by anyone as long as the following copyright note is not removed from this section: Written by Dr. E. Garcia; Copyright 2002 Mi Islita.com All Rights Reserved*/

function logit()
{
v = eval("document.myform");
Q = v.Q.value;
b = v.b.value;
dp =v.dp.value;
L = Math.round((Math.log(Q)/Math.log(b))*(Math.pow(10, dp)))/(Math.pow(10, dp));
document.myform.L.value = Math.round((Math.log(Q)/Math.log(b))*(Math.pow(10, dp)))/(Math.pow(10, dp));
v.en.value = Q + " = " +  b + "^" + L;
}

var text = '';
text += '<center>';
text += '<form name=myform>';
text += '<table border=0 bgcolor=#cceeee width=*><tr>';
text += '<td align=right><font style=font-family:arial;font-size:14;>';

text += '<center><b>LogIt!: A Log Transformer</b></center><br>';

text += 'Original Quantity, Q = <input type=text name=Q value=""><br>';
text += 'Base, b = <input type=text name=b value=""><br>';
text += 'Decimal Places, dp = <input type=text name=dp value=""><br>';

text += '<center><b><a href="#" onclick=reset();>Reset</a> | ';
text += '<a href="#" onclick=logit();>LogIt!</a></b></center>';
text += 'Log<sub>b</sub>Q = <input type=text name=L value=""><br>';
text += 'Q in Exponential Notation, en = <input type=text name=en value="">';

text += '</font></td></tr></table>';
text += '</form>';
text += '</center>';
document.write(text);
//-->
</script>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *