Home

sqrtR2

sqrtr2 is an informal label used in some programming contexts and educational materials to denote the square root of 2. It is not a standardized function name in major languages, but rather a shorthand that may appear in examples, pseudo-code, or as a named constant in specific codebases. The value associated with sqrtr2 is the positive real number that satisfies x^2 = 2, commonly written as sqrt(2) or √2, and numerically about 1.4142135623730951.

Mathematically, sqrt(2) is irrational, meaning it cannot be expressed as a ratio of integers. It is the

In code, sqrtr2 may be defined once and reused as a constant. Examples (illustrative and language-agnostic) include

See also: sqrt, irrational number, diagonal of a unit square, mathematical constants.

length
of
the
diagonal
of
a
unit
square,
derived
from
the
Pythagorean
theorem.
In
practice,
this
constant
appears
in
normalization
procedures,
geometric
computations,
and
various
algorithms
that
involve
Euclidean
distances
or
plane
geometry.
assigning
the
value
1.4142135623730951
to
a
variable
named
sqrtr2
or
computing
it
as
sqrt(2)
at
runtime.
Some
languages
or
libraries
provide
built-in
constants
for
the
square
root
of
2
(for
example,
Math.SQRT2
in
JavaScript),
which
can
be
preferable
to
hard-coded
literals.
When
naming
conventions
are
considered,
sqrtr2
is
often
discouraged
in
favor
of
clearer
identifiers
such
as
sqrt2,
sqrt(2),
or
M_SQRT2
to
improve
readability
and
portability.