> For the complete documentation index, see [llms.txt](https://mentebinaria.gitbook.io/manual-da-linguagem-gnu-c/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mentebinaria.gitbook.io/manual-da-linguagem-gnu-c/12.-constantes/constantes-de-numeros-imaginarios.md).

# Constantes de Números Imaginários

Um número complexo consiste em uma parte real mais uma parte imaginária. (Você pode omitir uma das partes se ela for zero.) Esta seção explica como escrever constantes numéricas com valores imaginários. Ao adicionar essas constantes a constantes numéricas de valor real ordinário, podemos criar constantes com valores complexos.

A forma simples de escrever uma constante numérica imaginária é anexar o sufixo ‘i’ ou ‘I’, ou ‘j’ ou ‘J’, a uma constante inteira ou de ponto flutuante. Por exemplo, `2.5fi` tem o tipo `_Complex float` e `3i` tem o tipo `_Complex int`. As quatro letras de sufixo alternativas são todas equivalentes.

A outra maneira de escrever uma constante imaginária é multiplicar uma constante real por `_Complex_I`, que representa o número imaginário `i`. O padrão C não suporta sufixos com ‘i’ ou ‘j’, então este método mais trabalhoso é necessário.

Para escrever uma constante complexa com uma parte real não nula e uma parte imaginária não nula, escreva as duas separadamente e as some, assim:

```c
4.0 + 3.0i
```

Isso dá o valor `4 + 3i`, com o tipo `_Complex double`.

Essa soma pode incluir várias constantes reais, ou nenhuma. Da mesma forma, pode incluir várias constantes imaginárias, ou nenhuma. Por exemplo:

```c
_Complex double foo, bar, quux;

foo = 2.0i + 4.0 + 3.0i; /* A parte imaginária é 5.0. */
bar = 4.0 + 12.0; /* A parte imaginária é 0.0. */
quux = 3.0i + 15.0i; /* A parte real é 0.0. */
```

Veja [*Tipos de Dados Complexos*](/manual-da-linguagem-gnu-c/11.-tipos-primitivos/tipos-de-dados-complexos.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://mentebinaria.gitbook.io/manual-da-linguagem-gnu-c/12.-constantes/constantes-de-numeros-imaginarios.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
