Square Root

From SwiftAPI

(Redirected from Perl sqrt)
Jump to: navigation, search

Find the square root of a number.

Contents

C/C++

#include <math.h>
 
double a = 16;
double b = sqrt(a);
// b == 4.0

Java

java.lang.Math : public static double sqrt(double a)
double a = 16;
double b = Math.sqrt(a);
// b == 4.0

JavaScript

Mozilla msdn

var a = 16;
var b = Math.sqrt(a);
// b == 4

Perl

perldoc.perl.org

sqrt EXPR
$a = 16;
$b = sqrt($a);
# $b == 4

PHP

php.net

float sqrt ( float $arg )
$a = 16;
$b = sqrt($a);
// $b == 4

Python

docs.python.org

import math
a = 16
b = math.sqrt(a)
# b == 4.0

Ruby

ruby-doc.org

a = 16
b = Math.sqrt(a)
# b == 4.0
Personal tools