Recherche sur les Noms des fonctions php/mysql
sqrt()
Définition
Racine carrée - (PHP 4, PHP 5)Description
float sqrt
( float $arg
)
Retourne la racine carrée de arg .
Liste de paramètres
- arg
-
L'argument à traiter
Valeurs de retour
La racine carrée de arg ou la valeur spéciale NAN pour les nombres négatifs.
Exemples
Exemple #1 Exemple avec sqrt()
<?php
// La précision dépend de votre directive precision
echo sqrt(9); // 3
echo sqrt(10); // 3.16227766 ...
?>
Bouts de code utilisant la fonction sqrt()
<?php /* ... */
$repcarré = $nb2_1 * $nb2_1 + $nb2_2 * $nb2_2;
$rep = sqrt($repcarré);
echo
/* ... */ ?>
<?php /* ... */
{
$rep = sqrt($nb);
if($rep == 0) echo
/* ... */ ?>
<?php /* ... */
/* on calcule les parties et on les enregistre à leur place dédiée dans le tableau */
$nombrecomplexe['module'] = sqrt($x*$x + $y*$y); // <strong>sqrt</strong> = square root = racine carrée
if ($x != 0) $nombrecomplexe['argument'] = atan($y/$x); // arctan = tan^(-1)
/* ... */ ?>
<?php /* ... */
));
$d = 2 * atan2(sqrt($a), sqrt(1 - $a));
return ($earth_radius * $d);
/* ... */ ?>
<?php /* ... */
}
$sqrt = sqrt($nb); // Racine carrée de $nb
if($nb%2==0) die("Le nombre $nb est divisible par 2<br />");
/* ... */ ?>
Connexion
Les fonctions
Références
- abs
- acos
- acosh
- asin
- asinh
- atan2
- atan
- atanh
- base_convert
- bindec
- ceil
- cos
- cosh
- decbin
- dechex
- decoct
- deg2rad
- exp
- expm1
- floor
- fmod
- getrandmax
- hexdec
- hypot
- is_finite
- is_infinite
- is_nan
- lcg_value
- log10
- log1p
- log
- max
- min
- mt_getrandmax
- mt_rand
- mt_srand
- octdec
- pi
- pow
- rad2deg
- rand
- round
- sin
- sinh
- sqrt
- srand
- tan
- tanh





