ROUND/de
From MCS Wiki AVR
				
								
				< ROUND(Difference between revisions)
				
																
				
				
								
				 (Created page with "= <span class="f_Header">Action</span> =  Returns a value rounded to the nearest value.  <span style="font-family: Arial;"> </span>  <span style="font-family: Arial;">&nb...")  | 
		 (→Example)  | 
		||
| (4 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| − | + | = <span class="f_Header">Funktion</span> =  | |
| − | + | Gibt den gerundeten Wert zurück.  | |
<span style="font-family: Arial;"> </span>  | <span style="font-family: Arial;"> </span>  | ||
| Line 15: | Line 15: | ||
<span style="font-family: Arial;"> </span>  | <span style="font-family: Arial;"> </span>  | ||
| − | = <span class="f_Header">  | + | = <span class="f_Header">Anmerkungen</span> =  | 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">  | <div style="padding: 0px; margin: 0px 0px 0px 4px;">  | ||
{| width="539" cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;"  | {| width="539" cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;"  | ||
|- style="vertical-align: top;"  | |- style="vertical-align: top;"  | ||
| valign="top" width="11%" style="width: 56px; border: 1px solid rgb(0, 0, 0);" |    | | valign="top" width="11%" style="width: 56px; border: 1px solid rgb(0, 0, 0);" |    | ||
| − | + | var  | |
| valign="top" width="94%" style="width: 474px; border: 1px solid rgb(0, 0, 0);" |    | | valign="top" width="94%" style="width: 474px; border: 1px solid rgb(0, 0, 0);" |    | ||
| − | + | Single oder Double Variable der der gerundete Wert von x zugewiesen wird.  | |
|- style="vertical-align: top;"  | |- style="vertical-align: top;"  | ||
| valign="top" width="11%" style="width: 56px; border: 1px solid rgb(0, 0, 0);" |    | | valign="top" width="11%" style="width: 56px; border: 1px solid rgb(0, 0, 0);" |    | ||
| − | + | x  | |
| valign="top" width="94%" style="width: 474px; border: 1px solid rgb(0, 0, 0);" |    | | valign="top" width="94%" style="width: 474px; border: 1px solid rgb(0, 0, 0);" |    | ||
| − | + | Single oder Double Zahl die gerundet werden soll.  | |
|}  | |}  | ||
| Line 44: | Line 44: | ||
<span style="font-family: Arial;"> </span>  | <span style="font-family: Arial;"> </span>  | ||
| − | = <span class="f_Header">  | + | = <span class="f_Header">Siehe auch</span> =  | 
[[INT]] , [[FIX]] , [[SGN]]  | [[INT]] , [[FIX]] , [[SGN]]  | ||
| Line 52: | Line 52: | ||
<span style="font-family: Arial;"> </span>  | <span style="font-family: Arial;"> </span>  | ||
| − | = <span class="f_Header">  | + | = <span class="f_Header">Beispiel</span> =  | 
<br/><source lang="bascomavr">  | <br/><source lang="bascomavr">  | ||
| Line 65: | Line 65: | ||
$regfile = "m48def.dat" ' specify the used micro  | $regfile = "m48def.dat" ' specify the used micro  | ||
| − | $crystal = 4000000 '   | + | $crystal = 4000000 ' Taktfrequenz  | 
| − | $baud = 19200 '   | + | $baud = 19200 ' Baudrate  | 
$hwstack = 32 ' default use 32 for the hardware stack  | $hwstack = 32 ' default use 32 for the hardware stack  | ||
$swstack = 10 ' default use 10 for the SW stack  | $swstack = 10 ' default use 10 for the SW stack  | ||
Latest revision as of 21:57, 2 March 2013
Contents | 
Funktion
Gibt den gerundeten Wert zurück.
Syntax
var = ROUND( x )
Anmerkungen
| 
 var  | 
 Single oder Double Variable der der gerundete Wert von x zugewiesen wird.  | 
| 
 x  | 
 Single oder Double Zahl die gerundet werden soll.  | 
Round(2.3) = 2 , Round(2.8) = 3
Round(-2.3) = -2 , Round(-2.8) = -3
Siehe auch
Beispiel
'----------------------------------------------------------------------------------------- 'name : round_fix_int.bas 'copyright : (c) 1995-2005, MCS Electronics 'purpose : demo : ROUND,FIX 'micro : Mega48 'suited for demo : yes 'commercial addon needed : no '----------------------------------------------------------------------------------------- $regfile = "m48def.dat" ' specify the used micro $crystal = 4000000 ' Taktfrequenz $baud = 19200 ' Baudrate $hwstack = 32 ' default use 32 for the hardware stack $swstack = 10 ' default use 10 for the SW stack $framesize = 40 ' default use 40 for the frame space Dim S As Single , Z As Single For S = -10 To 10 Step 0.5 Print S ; Spc(3) ; Round(s) ; Spc(3) ; Fix(s) ; Spc(3) ; Int(s) Next End
| Languages | English • Deutsch | 
|---|