mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 23:14:06 +08:00
33 lines
798 B
HTML
33 lines
798 B
HTML
<h1>数学函数 - hypot</h1>
|
||
|
||
|
||
<p>原型:extern float hypot(float x, float y);</p>
|
||
|
||
<p>用法:#include <math.h></p>
|
||
|
||
<p>功能:对于给定的直角三角形的两个直角边,求其斜边的长度。</p>
|
||
|
||
<p>说明:返回斜边值。</p>
|
||
|
||
举例:<pre><code class="language-c">
|
||
|
||
// hypot.c
|
||
|
||
#include <syslib.h>
|
||
#include <math.h>
|
||
|
||
main()
|
||
{
|
||
clrscr(); // clear screen
|
||
textmode(0x00); // 6 lines per LCD screen
|
||
|
||
printf("3^2+4^2=%.0f^2\n",hypot(3.,4.));
|
||
printf("3.2^2+4.3^2=%.2f^2",hypot(x,y));
|
||
|
||
getchar();
|
||
return 0;
|
||
}
|
||
|
||
</code></pre>相关函数:<a href="frexp.html">frexp</a>,<a href="ldexp.html">ldexp</a>
|
||
|