Fundamentos de Programación

Fixed-Point Arithmetic

A method of representing fractional numbers using integers with an implicit decimal point at a fixed position, avoiding floating-point imprecision. On Solana, all token amounts use fixed-point: SPL tokens have a configurable decimals field (e.g., USDC uses 6 decimals, so 1 USDC = 1,000,000 smallest units). DeFi protocols use basis points (1/10,000), scaled integers, or WAD/RAY notation (10^18/10^27) for precise rate calculations without floating-point types.

IDfixed-point-arithmetic

Lectura rápida

Empieza por la explicación más corta y útil antes de profundizar.

A method of representing fractional numbers using integers with an implicit decimal point at a fixed position, avoiding floating-point imprecision. On Solana, all token amounts use fixed-point: SPL tokens have a configurable decimals field (e.g., USDC uses 6 decimals, so 1 USDC = 1,000,000 smallest units). DeFi protocols use basis points (1/10,000), scaled integers, or WAD/RAY notation (10^18/10^27) for precise rate calculations without floating-point types.

Modelo mental

Usa primero la analogía corta para razonar mejor sobre el término cuando aparezca en código, docs o prompts.

Piensa en esto como un bloque de construcción que conecta una definición aislada con el sistema mayor donde vive.

Contexto técnico

Ubica el término dentro de la capa de Solana en la que vive para razonar mejor sobre él.

Serialización, memoria, estructuras de datos y bases de ingeniería.

Por qué le importa a un builder

Convierte el término de vocabulario en algo operacional para producto e ingeniería.

Este término desbloquea conceptos adyacentes rápido, así que funciona mejor cuando lo tratas como un punto de conexión y no como una definición aislada.

Handoff para IA

Handoff para IA

Usa este bloque compacto cuando quieras dar contexto sólido a un agente o asistente sin volcar toda la página.

Fixed-Point Arithmetic (fixed-point-arithmetic)
Categoría: Fundamentos de Programación
Definición: A method of representing fractional numbers using integers with an implicit decimal point at a fixed position, avoiding floating-point imprecision. On Solana, all token amounts use fixed-point: SPL tokens have a configurable decimals field (e.g., USDC uses 6 decimals, so 1 USDC = 1,000,000 smallest units). DeFi protocols use basis points (1/10,000), scaled integers, or WAD/RAY notation (10^18/10^27) for precise rate calculations without floating-point types.
Relacionados: Precision Loss / Rounding Errors, Checked Math, Programa SPL Token
Glossary Copilot

Haz preguntas de Solana con contexto aterrizado sin salir del glosario.

Usa contexto del glosario, relaciones entre términos, modelos mentales y builder paths para recibir respuestas estructuradas en vez de output genérico.

Abrir workspace completa del Copilot
Explicar este código

Opcional: pega código Anchor, Solana o Rust para que el Copilot mapee primitivas de vuelta al glosario.

Haz una pregunta aterrizada en el glosario

Haz una pregunta aterrizada en el glosario

El Copilot responderá usando el término actual, conceptos relacionados, modelos mentales y el grafo alrededor del glosario.

Grafo conceptual

Ve el término como parte de una red, no como una definición aislada.

Estas ramas muestran qué conceptos toca este término directamente y qué existe una capa más allá de ellos.

Rama

Precision Loss / Rounding Errors

A class of numerical vulnerability where integer division discards fractional remainders, causing systematic under-accounting of fees, interest, or token amounts that an attacker can exploit through repeated small transactions to drain protocol funds or receive more than entitled. Because Solana programs use integer arithmetic exclusively (no native floating point in on-chain code), division operations like amount / price always truncate toward zero, and protocols must decide whether to round in favor of the protocol (ceiling division for fees collected, floor division for tokens distributed) using formulas such as (numerator + denominator - 1) / denominator. Precision errors can also compound across fixed-point representations, so high-precision intermediate scaling (e.g., multiplying by 10^9 before dividing) is a common mitigation.

Rama

Checked Math

A family of Rust arithmetic methods — including checked_add, checked_sub, checked_mul, checked_div, and their saturating_* counterparts — that return an Option<T> (None on overflow/underflow) instead of silently wrapping, allowing Solana programs to propagate an error rather than continue with corrupted values. Because Rust's default integer arithmetic panics on overflow only in debug builds and wraps silently in release builds (the mode used for on-chain deployments), all financial and security-sensitive arithmetic in Solana programs should use these methods. Anchor's declare_program! macro and many audit checklists explicitly require checked math on all token amount calculations.

Rama

Programa SPL Token

The original Solana Program Library token program (TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA) that implements fungible and non-fungible token operations. It manages mints (token definitions) and token accounts (balances). Core instructions include InitializeMint, MintTo, Transfer, Burn, Approve (delegation), and Revoke. All SPL tokens on mainnet before Token-2022 use this program.

Siguientes conceptos para explorar

Mantén la cadena de aprendizaje en movimiento en lugar de parar en una sola definición.

Estos son los siguientes conceptos que vale la pena abrir si quieres que este término tenga más sentido dentro de un workflow real de Solana.

Seguridad

Precision Loss / Rounding Errors

A class of numerical vulnerability where integer division discards fractional remainders, causing systematic under-accounting of fees, interest, or token amounts that an attacker can exploit through repeated small transactions to drain protocol funds or receive more than entitled. Because Solana programs use integer arithmetic exclusively (no native floating point in on-chain code), division operations like amount / price always truncate toward zero, and protocols must decide whether to round in favor of the protocol (ceiling division for fees collected, floor division for tokens distributed) using formulas such as (numerator + denominator - 1) / denominator. Precision errors can also compound across fixed-point representations, so high-precision intermediate scaling (e.g., multiplying by 10^9 before dividing) is a common mitigation.

Seguridad

Checked Math

A family of Rust arithmetic methods — including checked_add, checked_sub, checked_mul, checked_div, and their saturating_* counterparts — that return an Option<T> (None on overflow/underflow) instead of silently wrapping, allowing Solana programs to propagate an error rather than continue with corrupted values. Because Rust's default integer arithmetic panics on overflow only in debug builds and wraps silently in release builds (the mode used for on-chain deployments), all financial and security-sensitive arithmetic in Solana programs should use these methods. Anchor's declare_program! macro and many audit checklists explicitly require checked math on all token amount calculations.

Ecosistema de Tokens

Programa SPL Token

The original Solana Program Library token program (TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA) that implements fungible and non-fungible token operations. It manages mints (token definitions) and token accounts (balances). Core instructions include InitializeMint, MintTo, Transfer, Burn, Approve (delegation), and Revoke. All SPL tokens on mainnet before Token-2022 use this program.

Fundamentos de Programación

Git

A distributed version control system for tracking code changes across development teams. Essential for Solana development workflows: feature branches for program changes, pull requests for code review, tags for release versions. Solana Verify uses git repos to verify on-chain programs match public source. GitHub hosts most Solana ecosystem repositories.

Términos relacionados

Sigue los conceptos que realmente le dan contexto a este término.

Las entradas del glosario se vuelven útiles cuando están conectadas. Estos enlaces son el camino más corto hacia ideas adyacentes.

Seguridadprecision-loss

Precision Loss / Rounding Errors

A class of numerical vulnerability where integer division discards fractional remainders, causing systematic under-accounting of fees, interest, or token amounts that an attacker can exploit through repeated small transactions to drain protocol funds or receive more than entitled. Because Solana programs use integer arithmetic exclusively (no native floating point in on-chain code), division operations like amount / price always truncate toward zero, and protocols must decide whether to round in favor of the protocol (ceiling division for fees collected, floor division for tokens distributed) using formulas such as (numerator + denominator - 1) / denominator. Precision errors can also compound across fixed-point representations, so high-precision intermediate scaling (e.g., multiplying by 10^9 before dividing) is a common mitigation.

Seguridadchecked-math

Checked Math

A family of Rust arithmetic methods — including checked_add, checked_sub, checked_mul, checked_div, and their saturating_* counterparts — that return an Option<T> (None on overflow/underflow) instead of silently wrapping, allowing Solana programs to propagate an error rather than continue with corrupted values. Because Rust's default integer arithmetic panics on overflow only in debug builds and wraps silently in release builds (the mode used for on-chain deployments), all financial and security-sensitive arithmetic in Solana programs should use these methods. Anchor's declare_program! macro and many audit checklists explicitly require checked math on all token amount calculations.

Ecosistema de Tokensspl-token

Programa SPL Token

The original Solana Program Library token program (TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA) that implements fungible and non-fungible token operations. It manages mints (token definitions) and token accounts (balances). Core instructions include InitializeMint, MintTo, Transfer, Burn, Approve (delegation), and Revoke. All SPL tokens on mainnet before Token-2022 use this program.

Más en la categoría

Quédate en la misma capa y sigue construyendo contexto.

Estas entradas viven junto al término actual y ayudan a que la página se sienta parte de un grafo de conocimiento más amplio en lugar de un callejón sin salida.

Fundamentos de Programación

Rust

A systems programming language emphasizing memory safety, zero-cost abstractions, and concurrency without a garbage collector. Rust uses an ownership model with borrow checking at compile time to prevent data races and null pointer bugs. It is the primary language for Solana program development (via Anchor or native solana-program crate) and the Agave validator client.

Fundamentos de Programación

TypeScript

A statically typed superset of JavaScript that compiles to plain JavaScript. TypeScript adds type annotations, interfaces, generics, and enums to catch errors at compile time. It is the standard language for Solana client-side development—wallet adapters, dApp frontends, test suites, and SDK interactions (web3.js, Anchor client) are typically written in TypeScript.

Fundamentos de Programación

JavaScript

The ubiquitous scripting language for web development, running in browsers and Node.js. JavaScript is dynamically typed and event-driven. Most Solana dApp frontends and scripts use JavaScript/TypeScript with libraries like @solana/web3.js. Node.js enables server-side JS for backend services, indexers, and bot development.

Fundamentos de Programación

Node.js

A JavaScript runtime built on Chrome's V8 engine that enables server-side JavaScript execution. Node.js uses an event-driven, non-blocking I/O model. In the Solana ecosystem, Node.js is used for: running Anchor tests (Mocha/Jest), backend services, transaction bots, indexers, and CLI tools. npm/yarn/pnpm manage JavaScript package dependencies.