function rondaf(temp2)

{	// window.alert(temp2);
	if(document.mijn_form.decimalen.value == -1)	// wetenschappelijke notatie gebruiken

// begin scientific

	{	temp2 = Math.round((eval(temp2)*Math.round(Math.exp((temp2.lastIndexOf("0")+len+2)*Math.log(10)))))/Math.round(Math.exp((temp2.lastIndexOf("0")+len+2)*Math.log(10)));
		temp2 = temp2.toString();
		// window.alert('binnenkomst  '+temp2);
		if(temp2 >=1)				// Deze functie doet het goed
		{	if (temp2.indexOf(".") == -1)
			{	len2 = temp2.length;
				// window.alert(Math.round(Math.exp(temp2.length*Math.log(10))));
				temp2 = temp2/Math.round(Math.exp(temp2.length*Math.log(10)));  // hier gaat het fout wordt niet gedeeld
				temp2 = Math.round((temp2*Math.round(Math.exp((len)*Math.log(10)))))/Math.round(Math.exp((len)*Math.log(10)));
				temp2 = temp2.toString();
				// window.alert("getal na delen  "+temp2);
				if (temp2.substring(0,1) == ".")
				{	temp2 = '0' + temp2}
				len3 = temp2.length - 2;
				// window.alert(temp2+'  zonder . & >= 1 origineel(len)  '+len+'   later(len2)  '+len2+'  over(len3)  '+len3);  // len2 = len = goed
				if (len > len3)				// is nu goed
				{	for (i=1; i<=(len-len3); i++)
					{	temp2 = temp2 + '0'}
				}
				temp2 = temp2+'E'+len2; 
			}
			else
			{	nPos = temp2.indexOf(".");
				beforepoint = temp2.substring(0,nPos);
				afterpoint  = temp2.substring(nPos+1);
				len2 = beforepoint.length;
				// beforepoint = beforepoint/Math.round(Math.exp(beforepoint.length*Math.log(10)));
				// beforepoint = '0.'+beforepoint;
				temp2 = '0.' + beforepoint + afterpoint;
				temp2 = Math.round((eval(temp2)*Math.round(Math.exp((len)*Math.log(10)))))/Math.round(Math.exp((len)*Math.log(10)));
				temp2 = temp2.toString();
				if (temp2.substring(0,1) == ".")
				{	temp2 = '0' + temp2}
				len3 = temp2.length - 2;
				// window.alert(temp2+'   '+len3);
				// window.alert(temp2+'  met . & < 1 origineel(len)  '+len+'   later(len2)  '+len2+'  over(len3)  '+len3);  // len2 = len = goed
				if (len > len3)				// is nu goed
				{	for (i=1; i<=(len-len3); i++)
					{	temp2 = temp2 + '0'}
				}
				temp2 = temp2+'E'+len2;
				

			}

			return temp2
		}
		else
		{	i=0;
			aantalnullen = 0;			// is het aantal nullen achter de comma
			if (temp2.substring(0,1) == ".")
			{	temp2 = '0'+temp2}
			len2 = temp2.length;
			for (i=2; i<len2; i++)
			{	hulp = temp2.substring(i,i+1)
				if (temp2.substring(i,i+1) != 0)
				{	aantalnullen = i-2;
					break
				}
			}
			if (temp2.substring(1,2) == ".")			// waarom doe ik dit ????
			{	
				temp2='0.'+temp2.substring(i,len2);
			}
			else
			{
				temp2='0.'+temp2.substring(i,len2);
			}
			if (aantalnullen == 0)
			{
				temp2 = Math.round((eval(temp2)*Math.round(Math.exp((len)*Math.log(10)))))/Math.round(Math.exp((len)*Math.log(10)));
				temp2 = temp2.toString();		
				if (temp2.substring(0,1) == ".")	
				{	temp2 = '0' + temp2}
				len3 = temp2.length - 2;
				// window.alert(temp2+'   < 1 origineel(len)  '+len+'   later(len2)  '+len2+'  over(len3)  '+len3);  // len2 = len = goed
				if (len > len3)				// is nu goed
				{	for (i=1; i<=(len-len3); i++)		// moet hier staan <= (len - len3)
					{	temp2 = temp2 + '0'}
				}
	
			}
			else
			{
				temp2 = Math.round((eval(temp2)*Math.round(Math.exp((len)*Math.log(10)))))/Math.round(Math.exp((len)*Math.log(10)));
				temp2 = temp2.toString();
				if (temp2.substring(0,1) == ".")	// staat er 0.123 of .123 
				{	temp2 = '0' + temp2}
				len3 = temp2.length - 2;
				// window.alert(temp2+'   < 1 origineel(len)  '+len+'   later(len2)  '+len2+'  over(len3)  '+len3);  // len2 = len = goed
				if (len > len3)				// is nu goed
				{	for (i=1; i<=(len-len3); i++)
					{	temp2 = temp2 + '0'}
				}
				temp2 = temp2+'E-'+aantalnullen;	// exponent toevoegen
			}
			return temp2
		}
	}
//einde scientific

	else

// beginvaste afrond waarde

	{	
		return Math.round(eval(temp2)*eval(document.mijn_form.decimalen.value))/eval(document.mijn_form.decimalen.value);
	}
}

// einde vaste afrond waarde


