Tilde

Revision as of 12:26, 29 May 2025 by imported>ScottishFinnishRadish (Reverting edit(s) by 66.110.254.14 (talk) to rev. 1291758543 by David Eppstein: No reliable source (UV 0.1.6))
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Template:Short description Template:About Template:Redirect Template:Use dmy dates

Template:Infobox symbol Template:Orthography notation

The tilde (Template:IPAc-en, also Template:IPAc-en)<ref>Template:Cite book</ref> is a grapheme Template:Angbr or Template:Angbr with a number of uses. The name of the character came into English from Spanish Template:Wikt-lang, which in turn came from the Latin Template:Wikt-lang, meaning 'title' or 'superscription'.<ref>Template:Cite American Heritage Dictionary</ref> Its primary use is as a diacritic (accent) in combination with a base letter. Its freestanding form is used in modern texts mainly to indicate approximation.

HistoryEdit

Use by medieval scribesEdit

The tilde was originally one of a variety of marks written over an omitted letter or several letters as a scribal abbreviation (a "mark of contraction").<ref>Martin, Charles Trice (1910). The record interpreter : a collection of abbreviations, Latin words and names used in English historical manuscripts and records (2nd ed.). London, preface, p.5 [1]</ref> Thus, the commonly used words Anno Domini were frequently abbreviated to Ao Dñi, with an elevated terminal with a contraction mark placed over the "n". Such a mark could denote the omission of one letter or several letters. This saved on the expense of the scribe's labor and the cost of vellum and ink. Medieval European charters written in Latin are largely made up of such abbreviated words with contraction marks and other abbreviations; only uncommon words were given in full.

The text of the Domesday Book of 1086, relating for example, to the manor of Molland in Devon (see adjacent picture), is highly abbreviated as indicated by numerous tildes.

The text with abbreviations expanded is as follows:

<templatestyles src="Template:Blockquote/styles.css" />

{{#invoke:Lang|lang}}{{#if:|{{#if:|}}

}}

{{#invoke:Check for unknown parameters|check|unknown=Template:Main other|preview=Page using Template:Blockquote with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | 3 | 4 | 5 | author | by | char | character | cite | class | content | multiline | personquoted | publication | quote | quotesource | quotetext | sign | source | style | text | title | ts }}

Template:Resize

Role of mechanical typewritersEdit

Template:More

File:Olivetti Lettera 32.JPG
An Olivetti Lettera 32 typewriter (Portuguese Model) with tilde (and circumflex) dead-key beside Template:Keypress
File:Idazmakina.jpg
Spanish typewriter (QWERTY keyboard) with dead keys for acute, circumflex, diaeresis and grave accents. Ñ/ñ is present as a precomposed character only.

On typewriters designed for languages that routinely use diacritics (accent marks), there are two possible solutions. Keys can be dedicated to precomposed characters or alternatively a dead key mechanism can be provided. With the latter, a mark is made when a dead key is typed, but unlike normal keys, the paper carriage does not move on and thus the next letter to be typed is printed under that accent. Typewriters for Spanish typically have a dedicated key for Ñ/ñ but, as Portuguese uses Ã/ã and Õ/õ, a single dead-key (rather than take two keys to dedicate) is the most practical solution.

The tilde symbol did not exist independently as a movable type or hot-lead printing character since the type cases for Spanish or Portuguese would include sorts for the accented forms.

The centralized ASCII tilde Edit

Serif: —~—
Sans-serif: —~—
Monospace: —~—
A free-standing tilde between two em dashes
in three font families

The first ASCII standard (X3.64-1963) did not have a tilde.<ref name="Mackenzie_1980">Template:Cite book</ref>Template:Rp Like Portuguese and Spanish, the French, German and Scandinavian languages also needed symbols in excess of the basic 26 needed for English. The ASA worked with and through the CCITT to internationalize the code-set, to meet the basic needs of at least the Western European languages.

<templatestyles src="Template:Blockquote/styles.css" />

It appears to have been at their May 13–15, 1963 meeting that the CCITT decided that the proposed ISO 7-bit code standard would be suitable for their needs if a lower case alphabet and five diacritical marks [...] were added to it.<ref>{{#invoke:citation/CS1|citation

|CitationClass=web }} See Paragraph 3.</ref> At the October 29–31 meeting, then, the ISO subcommittee altered the ISO draft to meet the CCITT requirements, replacing the up-arrow and left-arrow with diacriticals, adding diacritical meanings to the apostrophe and quotation mark, and making the number sign a dualTemplate:Efn for the tilde.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>{{#if:Yucca's free information site (which cites the original sources).<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>|{{#if:|}}

}}

{{#invoke:Check for unknown parameters|check|unknown=Template:Main other|preview=Page using Template:Blockquote with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | 3 | 4 | 5 | author | by | char | character | cite | class | content | multiline | personquoted | publication | quote | quotesource | quotetext | sign | source | style | text | title | ts }}

Thus ISOTemplate:Nbsp646 was born (and the ASCII standard updated to X3.64-1967), providing the tilde and other symbols as optional characters.<ref name="Mackenzie_1980" />Template:RpTemplate:Efn

ISOTemplate:Nbsp646 and ASCII incorporated many of the overprinting lower-case diacritics from typewriters, including tilde. Overprinting was intended to work by putting a backspace code between the codes for letter and diacritic.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }} See paragraph 2</ref> Template:Citation needed span

The free-standing tilde is at code 126 in ASCII, where it was inherited into Unicode as U+007E.

A similar shaped mark (Template:Char) is known in typography and lexicography as a swung dash: these are used in dictionaries to indicate the omission of the entry word.<ref>Template:Citation</ref>

Connection to SpanishEdit

{{#invoke:Labelled list hatnote|labelledList|Main article|Main articles|Main page|Main pages}}

File:Logotipo del Instituto Cervantes.svg
Logo of the Instituto Cervantes

As indicated by the etymological origin of the word "tilde" in English, this symbol has been closely associated with the Spanish language. The connection stems from the use of the tilde above the letter Template:Angbr to form the (different) letter Template:Angbr in Spanish, a feature shared by only a few other languages, most of which are historically connected to Spanish. This peculiarity can help non-native speakers quickly identify a text as being written in Spanish with little chance of error. Particularly during the 1990s, Spanish-speaking intellectuals and news outlets demonstrated support for the language and the culture by defending this letter against globalisation and computerisation trends that threatened to remove it from keyboards and other standardised products and codes.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> The Instituto Cervantes, founded by Spain's government to promote the Spanish language internationally, chose as its logo a highly stylised Template:Char with a large tilde. The 24-hour news channel CNN in the US later adopted a similar strategy on its existing logo for the launch of its Spanish-language version, therefore being written as CN͠N. And similarly to the National Basketball Association (NBA), the Spain men's national basketball team is nicknamed "ÑBA".

In Spanish itself the word {{#invoke:Lang|lang}} is used more generally for diacritics, including the stress-marking acute accent.<ref>Diccionario de la lengua española, Real Academia Española</ref> The diacritic Template:Char is more commonly called {{#invoke:Lang|lang}} or {{#invoke:Lang|lang}}, and is not considered an accent mark in Spanish, but rather simply a part of the letter Template:Char (much like the dot over Template:Char makes an Template:Char character that is familiar to readers of English).

UsageEdit

Common use in EnglishEdit

The English language does not use the tilde as a diacritic, though it is used in some loanwords. The standalone form of the symbol is used more widely. Informally,<ref name=wolfram_tilde /> it means "approximately", "about", or "around", such as "~30 minutes before", meaning "approximately 30 minutes before".<ref name="bymath1"/><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> It may also mean "similar to",<ref name="htmlhelp1">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> including "of the same order of magnitude as",<ref name=wolfram_tilde>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> such as "Template:Math" meaning that Template:Mvar and Template:Mvar are of the same order of magnitude. Another approximation symbol is the double tilde Template:Char, meaning "approximately/almost equal to".<ref name="bymath1" /><ref name="htmlhelp1"/><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> The tilde is also used to indicate congruence of shapes by placing it over an Template:Char symbol, thus Template:Char.

In more recent digital usage, tildes on either side of a word or phrase have sometimes come to convey a particular tone that "let[s] the enclosed words perform both sincerity and irony", which can pre-emptively defuse a negative reaction.<ref name=Bernstein>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> For example, BuzzFeed journalist Joseph Bernstein interprets the tildes in the following tweet:

"in the ~ spirit of the season ~ will now link to some of the (imho) #Bestof2014 sports reads. if you hate nice things, mute that hashtag."

as a way of making it clear that both the author and reader are aware that the enclosed phrase – "spirit of the season" – "is cliche and we know this quality is beneath our author, and we don't want you to think our author is a cliche person generally".<ref name=Bernstein />Template:Efn

Among other uses, the symbol has been used on social media to indicate sarcasm.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> It may also be used online, especially in informal writing such as fanfiction, to convey a cutesy, playful, or flirtatious tone.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Diacritical useEdit

In some languages, the tilde is a diacritic mark placed over a letter to indicate a change in its pronunciation:

PitchEdit

The tilde was firstly used in the polytonic orthography of Ancient Greek, as a variant of the circumflex, representing a rise in pitch followed by a return to standard pitch.<ref>Template:Cite book</ref>

AbbreviationEdit

Later, it was used to make abbreviations in medieval Latin documents. When an Template:Angle bracket or Template:Angle bracket followed a vowel, it was often omitted, and a tilde (physically, a small Template:Angle bracket) was placed over the preceding vowel to indicate the missing letter; this is the origin of the use of tilde to indicate nasalization (compare the development of the umlaut as an abbreviation of Template:Angle bracket.)Template:Citation needed A tilde represented an omitted Template:Angle bracket or a syllable containing it.<ref name="Reimer2015">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> The practice of using the tilde over a vowel to indicate omission of an Template:Angle bracket or Template:Angle bracket continued in printed books in French as a means of reducing text length until the 17th century. It was also used in Portuguese and Spanish.Template:Citation needed

The tilde was also used occasionally to make other abbreviations, such as over the letter Template:Angle bracket, making Template:Char, to signify the word que ("that")Template:Citation needed. It also appears for qua and together with the letter Template:Angle bracket to form Template:Char for pra.<ref name="Reimer2015" />

NasalizationEdit

It is also as a small Template:Angle bracket that the tilde originated when written above other letters, marking a Latin Template:Angle bracket which had been elided in old Galician-Portuguese. In modern Portuguese it indicates nasalization of the base vowel: {{#invoke:Lang|lang}} "hand", from Lat. manu-; {{#invoke:Lang|lang}} "reasons", from Lat. {{#invoke:Lang|lang}}.Template:Citation needed This usage has been adopted in the orthographies of several native languages of South America, such as Guarani and Nheengatu, as well as in the International Phonetic Alphabet (IPA) and many other phonetic alphabets. For example, {{#invoke:IPA|main}} is the IPA transcription of the pronunciation of the French place-name Lyon.

In Breton, the symbol Template:Angle bracket after a vowel means that the letter Template:Angle bracket serves only to give the vowel a nasalised pronunciation, without being itself pronounced, as it normally is. For example, Template:Angle bracket gives the pronunciation {{#invoke:IPA|main}} whereas Template:Angle bracket gives {{#invoke:IPA|main}}.

In the DMG romanization of Tunisian Arabic, the tilde is used for nasal vowels õ and ṏ.

Palatal nEdit

{{#invoke:Labelled list hatnote|labelledList|Main article|Main articles|Main page|Main pages}} The tilded Template:Angle bracket (Template:Angle bracket, Template:Angle bracket) developed from the digraph Template:Angle bracket in Spanish. In this language, Template:Angle bracket is considered a separate letter called eñe ({{#invoke:IPA|main}}), rather than a letter-diacritic combination; it is placed in Spanish dictionaries between the letters Template:Angle bracket and Template:Angle bracket. In Spanish, the word tilde actually refers to diacritics in general, e.g. the acute accent in José,<ref>Template:Cite book</ref> while the diacritic in Template:Angle bracket is called "virgulilla" ({{#invoke:IPA|main}}) (yeísta) or ({{#invoke:IPA|main}}) (non-yeísta).<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> Current languages in which the tilded Template:Angle bracket (Template:Angle bracket) is used for the palatal nasal consonant {{#invoke:IPA|main}} include Template:Div col

Template:Div col end

ToneEdit

In Vietnamese, a tilde over a vowel represents a creaky rising tone (ngã). Letters with the tilde are not considered separate letters of the Vietnamese alphabet.

International Phonetic AlphabetEdit

Template:Uncited section In phonetics, a tilde is used as a diacritic that is placed above a letter, below it or superimposed onto the middle of it:

  • A tilde above a letter indicates nasalization, e.g. {{#invoke:IPA|main}}.
  • A tilde superimposed onto the middle of a letter indicates velarization or pharyngealization, e.g. {{#invoke:IPA|main}}. If no precomposed Unicode character exists, the Unicode character Template:Unichar can be used to generate one.
  • A tilde below a letter indicates laryngealisation, e.g. {{#invoke:IPA|main}}. If no precomposed Unicode character exists, the Unicode character Template:Unichar can be used to generate one.

A tilde between two phonemes indicates optionality, or "alternates with". E.g. Template:Angbr IPA could indicate that the sounds may alternate depending on context (free variation), or that they vary based on region or speaker, or some other variation.

Letter extensionEdit

In Estonian, the symbol Template:Angle bracket stands for the close-mid back unrounded vowel, and it is considered an independent letter.

Other usesEdit

Some languages and alphabets use the tilde for other purposes, such as:

|CitationClass=web }}</ref>

PunctuationEdit

The tilde is used in various ways in punctuation, including:

In some languages (such as in French),Template:Cn a tilde or a tilde-like wave dash (Unicode: Template:Unichar) may be used as a punctuation mark (instead of an unspaced hyphen, en dash or em dash) between two numbers, to indicate a range. Doing so avoids the risk of confusion with subtraction or a hyphenated number (such as a part number or model number). For example, "12~15" means "12 to 15", "~3" means "up to three", and "100~" means "100 and greater".Template:Cn East Asian languages almost always use this convention, but it is sometimes done for clarity in some other languages as well. Chinese uses the wave dash and full-width em dash interchangeably for this purpose. In English, the tilde is often used to express ranges and model numbers in electronics, but rarely in formal grammar or in type-set documents, as a wavy dash preceding a number sometimes represents an approximation (see below).

The range tilde is used for various purposes in French, but only to denote ranges of numbers (e.g., {{#invoke:Lang|lang}}" means "21 to 32 degrees Celsius")Template:Cn

(The symbol Template:Unichar (a double tilde) is also used in French, for example, {{#invoke:Lang|lang}} means "approximately 400 meters"Template:Cn.)

ApproximationEdit

Template:See also Before a number the tilde can mean 'approximately'; '~42' means 'approximately 42'.<ref> {{#invoke:citation/CS1|citation |CitationClass=web }}</ref> When used with currency symbols that precede the number (national conventions differ), the tilde precedes the symbol, thus for example '~$10' means 'about ten dollars'.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>Template:Better source

The symbols (almost equal to) and (approximately equal to) are among the other symbols used to express approximation.

JapaneseEdit

Template:Further

The Template:Nihongo is used for various purposes in Japanese, including to denote ranges of numbers (e.g., 5〜10 means between 5 and 10) in place of dashes or brackets, and to indicate origin. The wave dash is also used to separate a title and a subtitle in the same line, as a colon is used in English.

When used in conversations via email or instant messenger it may be used as a sarcasm mark Template:Citation needed.

The sign is used as a replacement for the Template:Transliteration, katakana character, in Japanese, extending the final syllable.


ChineseEdit

WeChat users frequently replace final punctuations with tildes in messages. An analysis of such "innovative uses" of tildes found that final tildes are most used to make the message friendlier and polite. They make expressives more sincere and directives less abrupt. Less commonly, final tildes imply sounds, i.e. otomatopeas and sound extensions. This use is compared to sajiao (Template:Lang-zh), a child-like acting seen in East Asian cultures that are also vocalized by raising or extending tone.<ref>Template:Cite journal</ref>

MathematicsEdit

As a unary operatorEdit

A tilde in front of a single quantity can mean "approximately", "about"<ref name="bymath1">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> or "of the same order of magnitude as."

In written mathematical logic, the tilde represents negation: "~p" means "not p", where "p" is a proposition. Modern use often replaces the tilde with the negation symbol (¬) for this purpose, to avoid confusion with equivalence relations.

As a relational operatorEdit

In mathematics, the tilde operator (which can be represented by a tilde or the dedicated character Template:Unichar), sometimes called "twiddle", is often used to denote an equivalence relation between two objects. Thus "Template:Math" means "Template:Mvar is equivalent to Template:Mvar". It is a weaker statement than stating that Template:Mvar equals Template:Mvar. The expression "Template:Math" is sometimes read aloud as "Template:Mvar twiddles Template:Mvar", perhaps as an analogue to the verbal expression of "Template:Math".<ref>Template:Citation.</ref>

The tilde can indicate approximate equality in a variety of ways. It can be used to denote the asymptotic equality of two functions. For example, Template:Math means that <math>\lim_{x \to \infty} \frac{f(x)}{g(x)} = 1</math>.<ref name=wolfram_tilde />

A tilde is also used to indicate "approximately equal to" (e.g. 1.902 ~= 2). This usage probably developed as a typed alternative to the libra symbol used for the same purpose in written mathematics, which is an equal sign with the upper bar replaced by a bar with an upward hump, bump, or loop in the middle (︍︍♎︎) or, sometimes, a tilde (≃).Template:Citation needed The symbol "≈" is also used for this purpose.

In physics and astronomy, a tilde can be used between two expressions (e.g. Template:Math) to state that the two are of the same order of magnitude.<ref name=wolfram_tilde />

In statistics and probability theory, the tilde means "is distributed as";<ref name = wolfram_tilde /> see random variable (e.g. Template:Math for a binomial distribution).

A tilde can also be used to represent geometric similarity (e.g. Template:Math, meaning triangle Template:Mvar is similar to Template:Mvar). A triple tilde () is often used to show congruence, an equivalence relation in geometry.Template:Citation needed

In graph theory, the tilde can be used to represent adjacency between vertices. The edge <math>(x,y)</math> connects vertices <math>x</math> and <math>y</math> which can be said to be adjacent, and this adjacency can be denoted <math>x \sim y</math>.

As a diacriticEdit

The symbol "<math>\tilde{f}</math>" is pronounced as "eff tilde" or, informally, as "eff twiddle".<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>Template:Cite book</ref> This can be used to denote the Fourier transform of f, or a lift of f, and can have a variety of other meanings depending on the context.

A tilde placed below a letter in mathematics can represent a vector quantity (e.g. <math>(x_1, x_2, x_3, \ldots, x_n) = \underset{^\sim}{\mathbf x}</math>).

In statistics and probability theory, a tilde placed on top of a variable is sometimes used to represent the median of that variable; thus <math>\tilde{\mathbf y}</math> would indicate the median of the variable <math>\mathbf y</math>. A tilde over the letter n (<math>\tilde{n}</math>) is sometimes used to indicate the harmonic mean.

In machine learning, a tilde may represent a candidate value for a cell state in GRUs or LSTM units. (e.g. c̃)

PhysicsEdit

Often in physics, one can consider an equilibrium solution to an equation, and then a perturbation to that equilibrium. For the variables in the original equation (for instance <math>X</math>) a substitution <math>X\to x+\tilde{x}</math> can be made, where <math>x</math> is the equilibrium part and <math>\tilde{x}</math> is the perturbed part.

A tilde is also used in particle physics to denote the hypothetical supersymmetric partner. For example, an electron is referred to by the letter e, and its superpartner the selectron is written .

In multibody mechanics, the tilde operator maps three-dimensional vectors <math>\boldsymbol{\omega}\in\mathbb{R}^3</math> to skew-symmetrical matrices <math>\tilde{\boldsymbol{\omega}}=\begin{bmatrix}0&-\omega_3& \omega_2\\ \omega_3& 0& -\omega_1\\ -\omega_2&\omega_1&0\end{bmatrix}</math> (see <ref>Template:Cite journal</ref> or <ref>Template:Cite journal</ref>).

EconomicsEdit

For relations involving preference, economists sometimes use the tilde to represent indifference between two or more bundles of goods. For example, to say that a consumer is indifferent between bundles x and y, an economist would write x ~ y.

ElectronicsEdit

It can approximate the sine wave symbol (∿, U+223F), which is used in electronics to indicate alternating current, in place of +, −, or ⎓ for direct current.

LinguisticsEdit

The tilde may indicate alternating allomorphs or morphological alternation, as in {{#invoke:IPA|main}} for kneel~knelt (the plus sign '+' indicates a morpheme boundary).<ref>Collinge (2002) An Encyclopedia of Language, §4.2.</ref><ref>Template:Cite book</ref>

The tilde may represent some sort of phonetic or phonemic variation between two sounds, which might be allophones or in free variation. For example, {{#invoke:IPA|main}} can represent "either {{#invoke:IPA|main}} or {{#invoke:IPA|main}}".

In formal semantics, it is also used as a notation for the squiggle operator which plays a key role in many theories of focus.<ref>Template:Cite book</ref>

In interlinear gloss, a tilde sets off an element added to a word by reduplication; were a hyphen or double hyphen used instead, confusion would arise because that element would be notated in the same way as an independent morpheme requiring an independent gloss.

ComputingEdit

Computer programmers use the tilde in various ways and sometimes call the symbol (as opposed to the diacritic) a squiggle, squiggly, swiggle, or twiddle. According to the Jargon File, other synonyms sometimes used in programming include not, approx, wiggle, enyay (after eñe) and (humorously) sqiggle Template:IPAc-en.<ref name=":0">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Directories and URLsEdit

On Unix-like operating systems (including AIX, BSD, Linux and macOS), tilde normally indicates the current user's home directory. For example, if the current user's home directory is Template:Mono, then the command Template:Mono is equivalent to Template:Mono, Template:Mono, or Template:Mono.<ref name=":0" /> This convention derives from the Lear-Siegler ADM-3A terminal in common use during the 1970s, which happened to have the tilde symbol and the word "Home" (for moving the cursor to the upper left) on the same key.<ref>Template:Cite book</ref> When prepended to a particular username, the tilde indicates that user's home directory (e.g., Template:Mono for the home directory of user Template:Mono, such as Template:Mono).<ref>Template:Citation.</ref>

Used in URLs on the World Wide Web, it often denotes a personal website on a Unix-based server. For example, Template:Mono might be the personal website of John Doe. This mimics the Unix shell usage of the tilde. However, when accessed from the web, file access is usually directed to a subdirectory in the user's home directory, such as Template:Mono or Template:Mono.<ref>Template:Citation.</ref>

In URLs, the characters Template:Mono (or Template:Mono) may substitute for a tilde if an input device lacks a tilde key.Template:Ref RFC Thus, Template:Mono and Template:Mono will behave in the same manner.

Computer languagesEdit

RegexEdit

The tilde is used in the AWK programming language as part of the pattern match operators for regular expressions:<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

  • variable ~ /regex/ returns true if the variable is matched.
  • variable !~ /regex/ returns false if the variable is matched.

The operators are also used in the SQL variant of the database PostgreSQL.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

A variant of this, with the plain tilde replaced with =~, was adopted in Perl<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>. Ruby also uses this variant without the negated operator.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

NegationEdit

In APL<ref name="j303">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>Template:Rp and MATLAB,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> tilde represents the monadic logical function NOT. and in APL it additionally represents the dyadic multiset function without (set difference).<ref name="j303"/>Template:Rp

In C the tilde character is used as bitwise NOT unary operator, following the notation in logic (an ! causes a logical NOT, instead).<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> This is also used by many languages based on or influenced by C, such as C++, C#, D, Java, JavaScript, Perl, PHP, and Python.<ref name="rigaux">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> The MySQL database also use tilde as bitwise invert<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> as does Microsoft's SQL Server Transact-SQL (T-SQL) language.

~~ castEdit

JavaScript also uses tilde as bitwise NOT. Because bitwise operators work on integers, and numbers in JavaScript are 64 bit floating point numbers, the operator converts numbers to a 32-bit signed integer before it performing the negation.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> The conversion truncates the fractional part and most significant bits. This lets two tildes ~~x to be used as a short syntax to cast to integer. However, it is not recommended as use for truncation. In contrast, it does not truncate BigInts, which are arbitrarily large integers.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Other usesEdit

In C++<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> and C#,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> the tilde is also used as the first character in a class's method name (where the rest of the name must be the same name as the class) to indicate a destructor – a special method which is called at the end of the object's life.

In ASP.NET applications, tilde ('~') is used as a shortcut to the root of the application's virtual directory.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

In the CSS stylesheet language, the tilde finds the element selected by the right-hand side that shares the parent with an element selected by the left-hand side.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

In the D programming language, the tilde is used as bitwise not operator, concatenation operator such as those of arrays,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> and to indicate an object destructor.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> Tilde operator can be overloaded for user types,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> and binary tilde operator is mostly used to merging two objects, or adding some objects to set of objects. It was introduced because plus operator can have different meaning in many situations. For example, "120" + "14" may produce "134" (addition of two numbers), "12014" (concatenation of strings), or something else.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> D disallows + operator for arrays (and strings), and provides separate operator for concatenation (similarly PHP programming language solved this problem by using dot operator for concatenation, and + for number addition, which will also work on strings containing numbers).

In Eiffel, the tilde is used for object comparison. If a and b denote objects, the Boolean expression a ~ b has value true if and only if these objects are equal, as defined by the applicable version of the library routine is_equal, which by default denotes field-by-field object equality but can be redefined in any class to support a specific notion of equality.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>Template:Rp If a and b are references, the object equality expression a ~ b is to be contrasted with a = b which denotes reference equality. Unlike the call a.is_equal (b), the expression a ~ b is type-safe even in the presence of covariance.

In the Apache Groovy programming language the tilde character overloaded as a bitwise binary negation operation, and as the "pattern operator" that creates a regular expression pattern object. =~ and ==~ can in Groovy be used to match a regular expression.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

In Haskell, the tilde is used in type constraints to indicate type equality.<ref>Template:Citation.</ref> Also, in pattern-matching, the tilde is used to indicate a lazy pattern match.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

In the Inform 6 programming language, the tilde is used to indicate a quotation mark inside a quoted string. Tilde itself is created by @@126. <ref>Template:Cite book</ref>

In "text mode" of the LaTeX typesetting language a tilde diacritic can be obtained using, e.g., \~{n}, yielding "ñ". A stand-alone tilde can be obtained by using \textasciitilde or \string~. In "math mode" a tilde diacritic can be written as, e.g., \tilde{x}. For a wider tilde \widetilde can be used. The \sim command produce a tilde-like binary relation symbol that is often used in mathematical expressions, and the double-tilde is obtained with \approx.In both text and math mode, a tilde on its own (~) renders a white space with no line breaking.In both text and math mode, a tilde on its own (~) renders a white space with no line breaking.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> The url package also supports entering tildes directly, e.g., \url{http://server/~name}.Template:Citation needed .

In MediaWiki syntax, four tildes are a shortcut for a user's signature. Three and five tildes puts the signature without timestamp and only the timestamp, respectively.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

In Common Lisp, the tilde is used as the prefix for format specifiers in format strings.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

In Max/MSP, MSP objects have names ending with a tilde. MSP objects process at the computer's sampling rate and mainly deal with sound.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

In Standard ML, the tilde is used as the prefix for negative numbers and as the unary negation operator.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

In OCaml, the tilde is used to specify the label for a labeled parameter.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

In R, the tilde operator is used to separate the left- and right-hand sides in a model formula.<ref>The R Reference Index </ref>

In Object REXX, the twiddle is used as a "message send" symbol. For example, Employee.name~lower() would cause the lower() method to act on the object Employee's name attribute, returning the result of the operation. ~~ returns the object that received the method rather than the result produced. Thus, it can be used when the result need not be returned or when cascading methods are to be used. team~~insert("Jane")~~insert("Joe")~~insert("Steve") would send multiple concurrent insert messages, thus invoking the insert method three consecutive times on the team object.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

In Raku, a prefixing tilde converts a value to a string. An infix tilde concatenates strings,<ref name="rakudocs-operators">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> taking place of the dot operator in Perl, as the dot is used for member access instead of <syntaxhighlight lang="text" class="" style="" inline="1">-></syntaxhighlight>.<ref name="rakudocs-perl">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> <syntaxhighlight lang="text" class="" style="" inline="1">~~</syntaxhighlight> is called "the smartmatch operator" and its semantics depend on the type of the right-side argument. Namely, it checks numeric and string equalities, performs regular expression match tests (as opposed to <syntaxhighlight lang="text" class="" style="" inline="1">=~</syntaxhighlight> in Perl<ref name="rakudocs-perl" />), and type checking.<ref name="rakudocs-operators" />

<syntaxhighlight lang="raku"> my $concatResult = "Hello " ~ "world!"; $concatResult ~~ /<|w><[A..Z]><[a..z]>*<|w>/;

say $/; # outputs "Hello"

  1. the $/ variable holds the last regex match result

</syntaxhighlight>

In YAML, the "Core schema," a set of aliases that processors are recommended to use, resolves a tilde as null.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

KeyboardsEdit

Template:See also The presence (or absence) of a tilde engraved on the keyboard depends on the territory where it was sold. In either case, computer's system settings determine the keyboard mapping and the default setting will match the engravings on the keys. Even so, it certainly possible to configure a keyboard for a different locale than that supplied by the retailer. On American and British keyboards, the tilde is a standard keytop and pressing it produces a free-standing "ASCII Tilde". To generate a letter with a tilde diacritic requires the US international or UK extended keyboard setting.

  • With US-international, the Template:Key press key is a dead key: pressing that key and then a letter produces the tilde-accented form of that letter. (For example, Template:Key pressTemplate:NbspTemplate:Key press produces Template:Char.) With this setting active, an ASCII tilde can be inserted with the dead key followed by the space bar, or alternatively by striking the dead key twice in a row.
  • With UK-extended, the key works normally but becomes a 'dead key' when combined with AltGr. Thus Template:Key press followed by a letter produces the accented form of that letter.
  • With a Mac either of the Alt/Option keys function similarly.
  • With Linux, the compose key facility is used.

Instructions for other national languages and keyboards are beyond the scope of this article.

Backup filenamesEdit

The dominant Unix convention for naming backup copies of files is appending a tilde to the original file name. It originated with the Emacs text editor<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> and was adopted by many other editors and some command-line tools.

Emacs also introduced an elaborate numbered backup scheme, with files named Template:Mono, Template:Mono and so on.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> It didn't catch on, as the rise of version control software eliminates the need for this usage.Template:Citation needed

Microsoft filenamesEdit

The tilde was part of Microsoft's filename mangling scheme when it extended the FAT file system standard to support long filenames for Microsoft Windows. Programs written prior to this development could only access filenames in the so-called 8.3 format—the filenames consisted of a maximum of eight characters from a restricted character set (e.g. no spaces), followed by a period, followed by three more characters. In order to permit these legacy programs to access files in the FAT file system, each file had to be given two names—one long, more descriptive one, and one that conformed to the 8.3 format. This was accomplished with a name-mangling scheme in which the first six characters of the filename are followed by a tilde and a digit. For example, "Template:Mono" might become "Template:Mono".<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

The tilde symbol is also often used to prefix hidden temporary files that are created when a document is opened in Windows.Template:Citation needed For example, when a document "Document1.doc" is opened in Word, a file called "~$cument1.doc" is created in the same directory. This file contains information about which user has the file open, to prevent multiple users from attempting to change a document at the same time.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Juggling notationEdit

In the juggling notation system Beatmap, tilde can be added to either "hand" in a pair of fields to say "cross the arms with this hand on top". Mills' Mess is thus represented as (~2x,1)(1,2x)(2x,~1)*.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Unicode encoding Edit

Letters with tilde Edit

Unicode encodes a number of cases of "letter with tilde" as precomposed characters and these are displayed below. In addition, many more symbols may be composed using the combining character facility (Template:Unichar, Template:Unichar and others) that may be used with any letter or other diacritic to create a customised symbol but this does not mean that the result has any real-world application and are not shown in the table. Template:Letters with diacritic/headerTemplate:Hlist Template:Letters with diacritic/footer

A tilde diacritic can be added to almost any character by using a combining tilde. Greek and Cyrillic letters with tilde ([[Α͂|Α͂Template:NNBSPᾶ]], [[Η͂|Η͂Template:NNBSPῆ]], [[Ι͂|Ι͂Template:NNBSPῖ]], ῗ, [[Υ͂|Υ͂Template:NNBSPῦ]], ῧ and [[А̃|А̃Template:NNBSPа̃]], Ә̃ ә̃, [[Е̃|Е̃Template:NNBSPе̃]], [[И̃|И̃Template:NNBSPи̃]], [[О̃|О̃Template:NNBSPо̃]], [[У̃|У̃Template:NNBSPу̃]], [[Ј̃|Ј̃Template:NNBSPj̃]]) are formed using this method.

Unicode and Shift JIS encoding of wave dashEdit

Template:Multiple image In practice the Template:Nihongo (Unicode Template:Unichar), is often used instead of the Template:Nihongo (Unicode Template:Unichar), because the Shift JIS code for the wave dash, 0x8160, which should be mapped to U+301C,<ref>Template:Citation.</ref><ref>Template:Citation.</ref> is instead mapped to U+FF5E<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> in Windows code page 932 (Microsoft's code page for Japanese), a widely used extension of Shift JIS.

This decision avoided a shape definition error in the original (6.2) Unicode code charts:<ref name="U6.2">Template:Citation.</ref> the wave dash reference glyph in JIS / Shift JIS<ref>Template:Cite iso-ir</ref><ref name="jisplane1">Template:Cite iso-ir</ref> matches the Unicode reference glyph for U+FF5E Template:Resize,<ref>Template:Citation.</ref> while the original reference glyph for U+301C<ref name="U6.2" /> was reflected, incorrectly,<ref name="errata8">Template:Citation</ref> when Unicode imported the JIS wave dash. In other platforms such as the classic Mac OS and macOS, 0x8160 is correctly mapped to U+301C. It is generally difficult, if not impossible, for users of Japanese Windows to type U+301C, especially in legacy, non-Unicode applications.

A similar situation exists regarding the Korean KS X 1001 character set, in which Microsoft maps the EUC-KR or UHC code for the wave dash (0xA1AD) to Template:Unichar,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref name="mskrtilde">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> while IBM and Apple map it to U+301C.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref name="applekrtilde">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> Microsoft also uses U+FF5E to map the KS X 1001 raised tilde (0xA2A6),<ref name="mskrtilde" /> while Apple uses Template:Unichar.<ref name="applekrtilde" />

The current Unicode reference glyph for U+301C has been corrected<ref name="errata8"/> to match the JIS standard<ref>Template:Citation</ref> in response to a 2014 proposal, which noted that while the existing Unicode reference glyph had been matched by fonts from the discontinued Windows XP, all other major platforms including later versions of Microsoft Windows shipped with fonts matching the JIS reference glyph for U+301C.<ref>Template:Citation</ref>

The JIS / Shift JIS wave dash is still formally mapped to U+301C as of JIS X 0213,<ref>Template:Citation</ref> whereas the WHATWG Encoding Standard used by HTML5 follows Microsoft in mapping 0x8160 to U+FF5E.<ref>Template:Citation</ref> These two code points have a similar or identical glyph in several computer fonts, reducing the confusion and incompatibility.

See alsoEdit

NotesEdit

Template:Notelist

ReferencesEdit

Template:Reflist

External linksEdit

Template:For

Template:Latin script Template:Common logical symbols Template:Navbox punctuation