Real constants and functions: Difference between revisions
Content added Content deleted
(PascalABC.NET) |
|||
Line 2,638: | Line 2,638: | ||
<tt>Exp</tt>, <tt>sqrt</tt>, <tt>ln</tt>, and <tt>exp</tt> return <tt>real</tt> values, but a <tt>complex</tt> value if supplied with a <tt>complex</tt> value. |
<tt>Exp</tt>, <tt>sqrt</tt>, <tt>ln</tt>, and <tt>exp</tt> return <tt>real</tt> values, but a <tt>complex</tt> value if supplied with a <tt>complex</tt> value. |
||
<tt>Abs</tt> returns an <tt>integer</tt> value if supplied with an <tt>integer</tt>, otherwise a <tt>real</tt> value. |
<tt>Abs</tt> returns an <tt>integer</tt> value if supplied with an <tt>integer</tt>, otherwise a <tt>real</tt> value. |
||
=={{header|PascalABC.NET}}== |
|||
<syntaxhighlight lang="delphi"> |
|||
## |
|||
Println(E); |
|||
Println(Pi); |
|||
var x := 2.5; |
|||
Println(Sqrt(x)); |
|||
Println(Ln(x)); // natural logarithm |
|||
Println(LogN(10,x)); // logarithm with base |
|||
Println(Exp(x)); |
|||
Println(Abs(-x)); |
|||
Println(Floor(x)); |
|||
Println(Ceil(x)); |
|||
var y := 4.1; |
|||
Println(x ** y); |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre>2.71828182845905 |
|||
3.14159265358979 |
|||
1.58113883008419 |
|||
0.916290731874155 |
|||
0.397940008672038 |
|||
12.1824939607035 |
|||
2.5 |
|||
2 |
|||
3 |
|||
42.8108682181725 |
|||
</pre> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |