> 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/6.-aritmetica/aritmetica-em-modo-misto.md).

# Aritmética em Modo Misto

Misturar inteiros e números de ponto flutuante em uma operação aritmética básica converte automaticamente os inteiros para ponto flutuante. Na maioria dos casos, isso dá exatamente os resultados desejados. Mas, às vezes, importa exatamente onde a conversão ocorre.

Se `i` e `j` são inteiros, `(i + j) * 2.0` os adiciona como inteiros e, em seguida, converte a soma para ponto flutuante para a multiplicação. Se a adição causar um estouro, isso não é equivalente a converter cada inteiro para ponto flutuante e, em seguida, somar os dois números de ponto flutuante. Você pode obter este último resultado convertendo explicitamente os inteiros, como em `((double) i + (double) j) * 2.0`. Veja [Conversão Explícita de Tipo](#user-content-fn-1)[^1].

Somar ou multiplicar vários valores, incluindo alguns inteiros e alguns de ponto flutuante, realiza as operações da esquerda para a direita. Assim, `3.0 + i + j` converte `i` para ponto flutuante, depois adiciona `3.0`, depois converte `j` para ponto flutuante e adiciona isso. Você pode especificar uma ordem diferente usando parênteses: `3.0 + (i + j)` soma `i` e `j` primeiro e depois adiciona essa soma (convertida para ponto flutuante) a `3.0`. Nesse aspecto, C difere de outras linguagens, como Fortran.

[^1]: Capítulo pendente de tradução


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mentebinaria.gitbook.io/manual-da-linguagem-gnu-c/6.-aritmetica/aritmetica-em-modo-misto.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
