PHP Velho Oeste 2024

bcsqrt

(PHP 4, PHP 5, PHP 7)

bcsqrt임의 정밀도 수의 제곱근을 구합니다

설명

string bcsqrt ( string $operand [, int $scale ] )

operand의 제곱근을 반환합니다.

인수

operand

연산수, 문자열.

scale

이 선택적인 인수는 소수점 아래 자리수를 설정합니다. bcscale()을 사용하여 모든 함수에 대한 전역 기본값을 설정할 수 있습니다.

반환값

제곱근을 문자열로 반환하거나, operand가 음수이면 NULL을 반환합니다.

예제

Example #1 bcsqrt() 예제

<?php

echo bcsqrt('2'3); // 1.414

?>

참고

  • bcpow() - 임의 정밀도 수 거듭제곱

add a note add a note

User Contributed Notes 1 note

up
1
markogrady18 at gmail dot com
9 years ago
The bcsqrt function is very handy for finding the square root of numbers in the form of strings.

//EXAMPLE:
   
<?php

$arr
= array(
       
"one" => "20",
        
"two" => "12"
   
);

echo
bcsqrt($arr["one"], 3);

//OUTPUT: 4.472
To Top