Saltar al contenido principal
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
LibreTexts Español

3.4: Números racionales y complejos

( \newcommand{\kernel}{\mathrm{null}\,}\)

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

2//3
-4//7
178//11
8//18
2//3
-4//7
178//11
8//18
 

Una ventaja que tienen es que el numerador y el denominador se almacenan como enteros (64 bits por defecto) y no están sujetos a errores de redondez que son los puntos flotantes. Las operaciones estándar +, −, ·, ÷ entre los racionales resulta en una racional y como veremos en este curso, hay ventajas al usar racionales en lugar de puntos flotantes.

Ejercicio

  • 12+23

  • 1223

  • 2335
  • 23÷35

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

# insert your code here.
# insert your code here.
 

El tipo racional

Si ingresas

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

typeof(1//2)
typeof(1//2)
 

se llama Tipo Composite Paramétrico, del que se hablará más adelante. En este caso particular, se trata de un tipo racional, pero dentro de él (el numerador y denominador), son de tipo Int64.

Por ejemplo, para hacer un tipo diferente de racional es necesario declarar un tipo entero diferente en su interior, ingrese

Login with LibreOne to run this code cell interactively.

If you have already signed in, please refresh the page.

Int16(1)//Int16(3)
Int16(1)//Int16(3)
 

3.4: Números racionales y complejos is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.

Support Center

How can we help?