home > 比較編 > Perl, PHP, Python, Ruby > arithmetic and logic >

ForNext

Only Do What Only You Can Do

039. sqrt -2

VBScript

JScript

Perl

error unless use Math::Complex in effect






PHP

NaN






Python

# raises ValueError:
import math
math.sqrt(-2)

# returns complex float:
import cmath
cmath.sqrt(-2)

Ruby

raises Errno::EDOM






PowerShell

Scala

F#

C

C++

C++Builder

VC++

C#

Java

Objective-C

D

VB

VB.NET

Delphi

Ada

PL/SQL

T-SQL

関数型

inserted by FC2 system