From cac7f3e868e98281f9f2b841101b09f02cf664fd Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Sat, 13 Sep 2025 00:53:47 +0200 Subject: Ajout du scripts bin_to_hex --- .../1- Repr\303\251sentation de l'information.md" | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'semestre 3/architecture des ordinateurs/1- Représentation de l'information.md') diff --git "a/semestre 3/architecture des ordinateurs/1- Repr\303\251sentation de l'information.md" "b/semestre 3/architecture des ordinateurs/1- Repr\303\251sentation de l'information.md" index 9545578..ee2a51c 100644 --- "a/semestre 3/architecture des ordinateurs/1- Repr\303\251sentation de l'information.md" +++ "b/semestre 3/architecture des ordinateurs/1- Repr\303\251sentation de l'information.md" @@ -240,21 +240,7 @@ def bin_to_hex(b): return hex ``` -```elixir -def bin_to_hex(b) do - bin_to_hex_rec(b, []) -end - -defp bin_to_hex_rec(before, after) when before != "" do - {b, a} = String.split_at(before, -4) - #TODO: convert algo - bin_to_hex_rec(b, [a | after]) -end - -defp bin_to_hex_rec("", after) do - after -end -``` +Voir le dossier `scripts` pour la version elixir. Pour réaliser une addition en binaire, on a besoin que les deux mots fassent la même taille @@ -290,4 +276,4 @@ $$ = \mathrm{0b}1\ldots1 = -1 $$ Donc, on a que $\bar N$ doit être décalé de 1, d'où le plus 1 |> cela est dû au fait que l'intervalle ne soit pas symétrique -Voir le moodle pour la suite \ No newline at end of file +Voir le moodle pour la suite -- cgit v1.2.3