numeration.py

Created by slowzuu1

Created on December 18, 2025

1.78 KB


# 1) Nombre positif de départ
# 37(10) = 00100101(2)   (8 bits)

# 2) Complément à 1
# On inverse tous les bits
# 00100101 → 11011010

# 3) Complément à 2
# C2 = C1 + 1
# 11011010 + 1 = 11011011

# Résultat final :
# -37(10) en C1 = 11011010
# -37(10) en C2 = 11011011

----------------------------------
# 1) Nombre de départ
# Décimal : -12.5
# Signe : négatif → S = 1

# 2) Passage en binaire
# 12(10)  = 1100(2)
# 0.5(10) = .1(2)
# Donc -12.5 → -1100.1(2)

# 3) Normalisation
# 1100.1 = 1.1001 × 2^3
# (on a déplacé la virgule de 3 positions)

# 4) Exposant biaisé
# Exposant réel = 3
# biais IEEE = 3 + 127 = 130
# 130(10) = 10000010(2)
# → Exposant = 10000010

# 5) Mantisse (fraction)
# On prend ce qu'il y a après "1."
# 1.1001 → mantisse = 10010000000000000000000  (23 bits)

# 6) Assemblage final
# S | exposant | mantisse
# 1 | 10000010 | 10010000000000000000000

# Résultat IEEE-754 :
# 1 10000010 10010000000000000000000
-------------------------------------------------------
# 1) Nombre de départ
# Décimal : 33.75
# Signe : positif → S = 0

# 2) Passage en binaire
# 33(10)  = 100001(2)
# 0.75(10)= .11(2)  (car 0.75 = 1/2 + 1/4)
# Donc 33.75 = 100001.11(2)

# 3) Normalisation
# On doit écrire sous la forme : 1.xxxxx × 2^e
# 100001.11(2) → 1.0000111 × 2^5
# (on a déplacé la virgule de 5 positions vers la gauche)

# 4) Exposant biaisé
# Exposant réel = 5
# IEEE754 stocke : exposant + 127
# 5 + 127 = 132
# 132(10) = 10000100(2)
# → Exposant = 10000100

# 5) Mantisse (fraction)
# On prend ce qu'il y a après le "1."
# 1.0000111 → mantisse = 00001110000000000000000
# (23 bits remplis avec des zéros)

# 6) Assemblage final IEEE754 (32 bits)
# S | Exposant | Mantisse
# 0 | 10000100 | 00001110000000000000000

# Résultat final :
# 0 10000100 00001110000000000000000

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.