# Critique for my first (potential) Rosetta Code Task: Angles Geometric Normalization and Conversion

**URL:** https://forum.ada-lang.io/t/critique-for-my-first-potential-rosetta-code-task-angles-geometric-normalization-and-conversion/993
**Category:** General
**Created:** [July 17, 2024, 5:38am UTC](https://forum.ada-lang.io/t/critique-for-my-first-potential-rosetta-code-task-angles-geometric-normalization-and-conversion/993 "2024-07-17T05:38:00Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Ret\_Build\_Engineer](https://forum.ada-lang.io/letter_avatar_proxy/v4/letter/r/ccd318/32.png) [@Ret\_Build\_Engineer](https://forum.ada-lang.io/u/Ret_Build_Engineer)
#### Post date: [July 17, 2024, 5:38am UTC](https://forum.ada-lang.io/t/critique-for-my-first-potential-rosetta-code-task-angles-geometric-normalization-and-conversion/993/1 "2024-07-17T05:38:00Z")

</div>

Hi;

Do I need to have a GitHub account (or something similar) or can I post code here for constructive criticism? I guess I have a GitHub account (for use with creatingbug reports for MacPorts) but I have never used it to create code projects.

Since my code is only 223 lines, I’ll post it here unless there are complaints about it being too large for posting.

I have translated from C and Lua an unimplemented Rosetta Code Task.

> **[Angles (geometric), normalization and conversion - Rosetta Code](https://rosettacode.org/wiki/Angles_(geometric),_normalization_and_conversion)**
>
> This task is about the normalization and/or conversion of (geometric) angles using some common scales. The angular scales that will be used in this task are:...

Three questions…

I’m using literal whitespace for column alignment for the table; this looks like it would be hard to maintain. Is there are better way to format for alignment?

I did not specify a particular float type or precision; I think that I should try to aim for double precision if I am to follow the C example.

The Lua example was much more compact as it leveraged the unit name as data (?); is there a way to make the table like a template and fill it in as needed? This would make the code much easier to maintain.

I wrote two versions, one with descriptive function names and the second one using very minimal naming as suggested in the task description.

The C solution normalized negative data towards non-negative values; I inconsistently followed the task specification more closely and preserved the sign of the specific test data for degree units only. Do people use negative rads, grads and mils? I guess so if one is being relative insread of absolute…

* * *

– Rosetta Code Task written in Ada  
– Angles (geometric), normalization and conversion  
– [Angles (geometric), normalization and conversion - Rosetta Code](https://rosettacode.org/wiki/Angles_(geometric),_normalization_and_conversion)  
– translation from C (conversion functions) and (loosely) Lua (output table formatting)  
– July 2024, R. B. E.

– To Do:  
– Specific float format/precision rather than generic?

with Ada.Text\_IO; use Ada.Text\_IO;  
with Ada.Integer\_Text\_IO; use Ada.Integer\_Text\_IO;  
with Ada.Float\_Text\_IO; use Ada.Float\_Text\_IO;  
with Ada.Numerics;

procedure Angles\_Geometric\_Normalization\_and\_Conversion is  
Pi : constant := Ada.Numerics.Pi;  
Two\_Pi : constant := 2.0 \* Ada.Numerics.Pi;

function Normalize\_to\_Deg (a : Float) return Float is  
tmp : Float := a;  
begin  
– while (tmp \< 0.0) loop  
while (tmp \< -360.0) loop  
tmp := tmp + 360.0;  
end loop;  
while (tmp \>= 360.0) loop  
tmp := tmp - 360.0;  
end loop;  
return tmp;  
end Normalize\_to\_Deg;

function Normalize\_to\_Grad (a : Float) return Float is  
tmp : Float := a;  
begin  
while (tmp \< 0.0) loop  
tmp := tmp + 400.0;  
end loop;  
while (tmp \>= 400.0) loop  
tmp := tmp - 400.0;  
end loop;  
return tmp;  
end Normalize\_to\_Grad;

function Normalize\_to\_Mil (a : Float) return Float is  
tmp : Float := a;  
begin  
while (tmp \< 0.0) loop  
tmp := tmp + 6400.0;  
end loop;  
while (tmp \>= 6400.0) loop  
tmp := tmp - 6400.0;  
end loop;  
return tmp;  
end Normalize\_to\_Mil;

function Normalize\_to\_Rad (a : Float) return Float is  
tmp : Float := a;  
begin  
while (tmp \< 0.0) loop  
tmp := tmp + Two\_Pi;  
end loop;  
while (tmp \>= Two\_Pi) loop  
tmp := tmp - Two\_Pi;  
end loop;  
return tmp;  
end Normalize\_to\_Rad;

function Deg\_to\_Grad (a : Float) return Float is  
tmp : Float := a;  
begin  
tmp := a \* (10.0 / 9.0);  
return tmp;  
end Deg\_to\_Grad;

function Deg\_to\_Mil (a : Float) return Float is  
tmp : Float := a;  
begin  
tmp := a \* (160.0 / 9.0);  
return tmp;  
end Deg\_to\_Mil;

function Deg\_to\_Rad (a : Float) return Float is  
tmp : Float := a;  
begin  
tmp := a \* (Pi / 180.0);  
return tmp;  
end Deg\_to\_Rad;

function Grad\_to\_Deg (a : Float) return Float is  
tmp : Float := a;  
begin  
tmp := a \* (9.0 / 10.0);  
return tmp;  
end Grad\_to\_Deg;

function Grad\_to\_Mil (a : Float) return Float is  
tmp : Float := a;  
begin  
tmp := a \* 16.0;  
return tmp;  
end Grad\_to\_Mil;

function Grad\_to\_Rad (a : Float) return Float is  
tmp : Float := a;  
begin  
tmp := a \* (Pi / 200.0);  
return tmp;  
end Grad\_to\_Rad;

function Mil\_to\_Deg (a : Float) return Float is  
tmp : Float := a;  
begin  
tmp := a \* (9.0 / 160.0);  
return tmp;  
end Mil\_to\_Deg;

function Mil\_to\_Grad (a : Float) return Float is  
tmp : Float := a;  
begin  
tmp := a / 16.0;  
return tmp;  
end Mil\_to\_Grad;

function Mil\_to\_Rad (a : Float) return Float is  
tmp : Float := a;  
begin  
tmp := a \* (Pi / 3200.0);  
return tmp;  
end Mil\_to\_Rad;

function Rad\_to\_Deg (a : Float) return Float is  
tmp : Float := a;  
begin  
tmp := a \* (180.0 / Pi);  
return tmp;  
end Rad\_to\_Deg;

function Rad\_to\_Grad (a : Float) return Float is  
tmp : Float := a;  
begin  
tmp := a \* (200.0 / Pi);  
return tmp;  
end Rad\_to\_Grad;

function Rad\_to\_Mil (a : Float) return Float is  
tmp : Float := a;  
begin  
tmp := a \* (3200.0 / Pi);  
return tmp;  
end Rad\_to\_Mil;

type Index is range 1 .. 12;  
type Test\_Values\_Array is array (Index) of Float;  
Test\_Values : Test\_Values\_Array :=  
(Float (-2), Float (-1), Float (0), Float (1), Float (2),  
6.2831853, Float (16), 57.2957795, Float (359),  
Float (399), Float (6399), Float (1000000));

begin  
Put\_Line (" DEGREES GRADIANS MILS RADIANS");  
Put\_Line (" TEST VALUE Normalized Converted Converted Converted");  
for I in Index loop  
Put (Test\_Values (I), Exp =\> 0, Aft =\> 8, Fore =\> 8);  
Put (" “);  
Put (Normalize\_to\_Deg (Test\_Values (I)), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
Put (” “);  
Put (Deg\_to\_Grad (Normalize\_to\_Deg (Test\_Values (I))), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
Put (” “);  
Put (Deg\_to\_Mil (Normalize\_to\_Deg (Test\_Values (I))), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
Put (” ");  
Put (Deg\_to\_Rad (Normalize\_to\_Deg (Test\_Values (I))), Exp =\> 0, Aft =\> 8, Fore =\> 2);  
New\_Line;  
end loop;

New\_Line;  
Put\_Line (" GRADIANS MILS RADIANS DEGREES");  
Put\_Line (" TEST VALUE Normalized Converted Converted Converted");  
for I in Index loop  
Put (Test\_Values (I), Exp =\> 0, Aft =\> 8, Fore =\> 8);  
Put (" “);  
Put (Normalize\_to\_Grad (Test\_Values (I)), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
Put (” “);  
Put (Grad\_to\_Mil (Normalize\_to\_Grad (Test\_Values (I))), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
Put (” “);  
Put (Grad\_to\_Rad (Normalize\_to\_Grad (Test\_Values (I))), Exp =\> 0, Aft =\> 8, Fore =\> 2);  
Put (” ");  
Put (Grad\_to\_Deg (Normalize\_to\_Grad (Test\_Values (I))), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
New\_Line;  
end loop;

New\_Line;  
Put\_Line (" MILS RADIANS DEGREES GRADIANS");  
Put\_Line (" TEST VALUE Normalized Converted Converted Converted");  
for I in Index loop  
Put (Test\_Values (I), Exp =\> 0, Aft =\> 8, Fore =\> 8);  
Put (" “);  
Put (Normalize\_to\_Mil (Test\_Values (I)), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
Put (” “);  
Put (Mil\_to\_Rad (Normalize\_to\_Mil (Test\_Values (I))), Exp =\> 0, Aft =\> 8, Fore =\> 2);  
Put (” “);  
Put (Mil\_to\_Deg (Normalize\_to\_Mil (Test\_Values (I))), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
Put (” ");  
Put (Mil\_to\_Grad (Normalize\_to\_Mil (Test\_Values (I))), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
New\_Line;  
end loop;

New\_Line;  
Put\_Line (" RADIANS DEGREES GRADIANS MILS");  
Put\_Line (" TEST VALUE Normalized Converted Converted Converted");  
for I in Index loop  
Put (Test\_Values (I), Exp =\> 0, Aft =\> 8, Fore =\> 8);  
Put (" “);  
Put (Normalize\_to\_Rad (Test\_Values (I)), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
Put (” “);  
Put (Rad\_to\_Deg (Normalize\_to\_Rad (Test\_Values (I))), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
Put (” “);  
Put (Rad\_to\_Grad (Normalize\_to\_Rad (Test\_Values (I))), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
Put (” ");  
Put (Rad\_to\_Mil (Normalize\_to\_Rad (Test\_Values (I))), Exp =\> 0, Aft =\> 8, Fore =\> 4);  
New\_Line;  
end loop;

## end Angles\_Geometric\_Normalization\_and\_Conversion;

Thanks,  
Retired\_Build\_Engineer

---

<div class="post-metadata">

### Author: ![DrPi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/drpi/32/225_2.png) [@DrPi](https://forum.ada-lang.io/u/DrPi)
#### Post date: [July 17, 2024, 7:30am UTC](https://forum.ada-lang.io/t/critique-for-my-first-potential-rosetta-code-task-angles-geometric-normalization-and-conversion/993/2 "2024-07-17T07:30:36Z")

</div>

Your code is hard to read as it is not correctly formatted.  
To format it correctly please enclose it with 3 backticks followed by _ada_ at the beginning, like this…

````ada
```ada

````

…and 3 backticks at the end of your code.

---

<div class="post-metadata">

### Author: ![Ret\_Build\_Engineer](https://forum.ada-lang.io/letter_avatar_proxy/v4/letter/r/ccd318/32.png) [@Ret\_Build\_Engineer](https://forum.ada-lang.io/u/Ret_Build_Engineer)
#### Post date: [July 17, 2024, 7:36am UTC](https://forum.ada-lang.io/t/critique-for-my-first-potential-rosetta-code-task-angles-geometric-normalization-and-conversion/993/3 "2024-07-17T07:36:18Z")

</div>

```ada
-- Rosetta Code Task written in Ada
-- Angles (geometric), normalization and conversion
-- https://rosettacode.org/wiki/Angles_(geometric),_normalization_and_conversion
-- translation from C (conversion functions) and (loosely) Lua (output table formatting)
-- July 2024, R. B. E.

-- To Do:
-- Specific float format/precision rather than generic?

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Numerics;

procedure Angles_Geometric_Normalization_and_Conversion is
  Pi : constant := Ada.Numerics.Pi;
  Two_Pi : constant := 2.0 * Ada.Numerics.Pi;

  function Normalize_to_Deg (a : Float) return Float is 
    tmp : Float := a;
  begin
-- while (tmp < 0.0) loop
    while (tmp < -360.0) loop
      tmp := tmp + 360.0;
    end loop;
    while (tmp >= 360.0) loop
      tmp := tmp - 360.0;
    end loop;
    return tmp;    
  end Normalize_to_Deg;

  function Normalize_to_Grad (a : Float) return Float is 
    tmp : Float := a;
  begin
    while (tmp < 0.0) loop
      tmp := tmp + 400.0;
    end loop;
    while (tmp >= 400.0) loop
      tmp := tmp - 400.0;
    end loop;
    return tmp;    
  end Normalize_to_Grad;

  function Normalize_to_Mil (a : Float) return Float is 
    tmp : Float := a;
  begin
    while (tmp < 0.0) loop
      tmp := tmp + 6400.0;
    end loop;
    while (tmp >= 6400.0) loop
      tmp := tmp - 6400.0;
    end loop;
    return tmp;    
  end Normalize_to_Mil;

  function Normalize_to_Rad (a : Float) return Float is 
    tmp : Float := a;
  begin
    while (tmp < 0.0) loop
      tmp := tmp + Two_Pi;
    end loop;
    while (tmp >= Two_Pi) loop
      tmp := tmp - Two_Pi;
    end loop;
    return tmp;    
  end Normalize_to_Rad;

  function Deg_to_Grad (a : Float) return Float is
    tmp : Float := a;
  begin
    tmp := a * (10.0 / 9.0);
    return tmp;
  end Deg_to_Grad;

  function Deg_to_Mil (a : Float) return Float is
    tmp : Float := a;
  begin
    tmp := a * (160.0 / 9.0);
    return tmp;
  end Deg_to_Mil;

  function Deg_to_Rad (a : Float) return Float is
    tmp : Float := a;
  begin
    tmp := a * (Pi / 180.0);
    return tmp;
  end Deg_to_Rad;

  function Grad_to_Deg (a : Float) return Float is
    tmp : Float := a;
  begin
    tmp := a * (9.0 / 10.0);
    return tmp;
  end Grad_to_Deg;

  function Grad_to_Mil (a : Float) return Float is
    tmp : Float := a;
  begin
    tmp := a * 16.0;
    return tmp;
  end Grad_to_Mil;

  function Grad_to_Rad (a : Float) return Float is
    tmp : Float := a;
  begin
    tmp := a * (Pi / 200.0);
    return tmp;
  end Grad_to_Rad;

  function Mil_to_Deg (a : Float) return Float is
    tmp : Float := a;
  begin
    tmp := a * (9.0 / 160.0);
    return tmp;
  end Mil_to_Deg;

  function Mil_to_Grad (a : Float) return Float is
    tmp : Float := a;
  begin
    tmp := a / 16.0;
    return tmp;
  end Mil_to_Grad;

  function Mil_to_Rad (a : Float) return Float is
    tmp : Float := a;
  begin
    tmp := a * (Pi / 3200.0);
    return tmp;
  end Mil_to_Rad;

  function Rad_to_Deg (a : Float) return Float is
    tmp : Float := a;
  begin
    tmp := a * (180.0 / Pi);
    return tmp;
  end Rad_to_Deg;

  function Rad_to_Grad (a : Float) return Float is
    tmp : Float := a;
  begin
    tmp := a * (200.0 / Pi);
    return tmp;
  end Rad_to_Grad;

  function Rad_to_Mil (a : Float) return Float is
    tmp : Float := a;
  begin
    tmp := a * (3200.0 / Pi);
    return tmp;
  end Rad_to_Mil;

  type Index is range 1 .. 12;
  type Test_Values_Array is array (Index) of Float;
  Test_Values : Test_Values_Array :=
    (Float (-2), Float (-1), Float (0), Float (1), Float (2),
     6.2831853, Float (16), 57.2957795, Float (359),
     Float (399), Float (6399), Float (1000000));

begin
  Put_Line (" DEGREES GRADIANS MILS RADIANS");
  Put_Line (" TEST VALUE Normalized Converted Converted Converted");
  for I in Index loop
    Put (Test_Values (I), Exp => 0, Aft => 8, Fore => 8);
    Put (" ");
    Put (Normalize_to_Deg (Test_Values (I)), Exp => 0, Aft => 8, Fore => 4);
    Put (" ");
    Put (Deg_to_Grad (Normalize_to_Deg (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
    Put (" ");
    Put (Deg_to_Mil (Normalize_to_Deg (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
    Put (" ");
    Put (Deg_to_Rad (Normalize_to_Deg (Test_Values (I))), Exp => 0, Aft => 8, Fore => 2);
    New_Line;
  end loop;

  New_Line;
  Put_Line (" GRADIANS MILS RADIANS DEGREES");
  Put_Line (" TEST VALUE Normalized Converted Converted Converted");
  for I in Index loop
    Put (Test_Values (I), Exp => 0, Aft => 8, Fore => 8);
    Put (" ");
    Put (Normalize_to_Grad (Test_Values (I)), Exp => 0, Aft => 8, Fore => 4);
    Put (" ");
    Put (Grad_to_Mil (Normalize_to_Grad (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
    Put (" ");
    Put (Grad_to_Rad (Normalize_to_Grad (Test_Values (I))), Exp => 0, Aft => 8, Fore => 2);
    Put (" ");
    Put (Grad_to_Deg (Normalize_to_Grad (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
    New_Line;
  end loop;

  New_Line;
  Put_Line (" MILS RADIANS DEGREES GRADIANS");
  Put_Line (" TEST VALUE Normalized Converted Converted Converted");
  for I in Index loop
    Put (Test_Values (I), Exp => 0, Aft => 8, Fore => 8);
    Put (" ");
    Put (Normalize_to_Mil (Test_Values (I)), Exp => 0, Aft => 8, Fore => 4);
    Put (" ");
    Put (Mil_to_Rad (Normalize_to_Mil (Test_Values (I))), Exp => 0, Aft => 8, Fore => 2);
    Put (" ");
    Put (Mil_to_Deg (Normalize_to_Mil (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
    Put (" ");
    Put (Mil_to_Grad (Normalize_to_Mil (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
    New_Line;
  end loop;

  New_Line;
  Put_Line (" RADIANS DEGREES GRADIANS MILS");
  Put_Line (" TEST VALUE Normalized Converted Converted Converted");
  for I in Index loop
    Put (Test_Values (I), Exp => 0, Aft => 8, Fore => 8);
    Put (" ");
    Put (Normalize_to_Rad (Test_Values (I)), Exp => 0, Aft => 8, Fore => 4);
    Put (" ");
    Put (Rad_to_Deg (Normalize_to_Rad (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
    Put (" ");
    Put (Rad_to_Grad (Normalize_to_Rad (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
    Put (" ");
    Put (Rad_to_Mil (Normalize_to_Rad (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
    New_Line;
  end loop;

end Angles_Geometric_Normalization_and_Conversion;

```

---

<div class="post-metadata">

### Author: ![anuj-seth](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/anuj-seth/32/48_2.png) [@anuj-seth](https://forum.ada-lang.io/u/anuj-seth)
#### Post date: [July 17, 2024, 12:32pm UTC](https://forum.ada-lang.io/t/critique-for-my-first-potential-rosetta-code-task-angles-geometric-normalization-and-conversion/993/4 "2024-07-17T12:32:46Z")

</div>

I tried making this code “data driven” which may or may not be idiomatic Ada (I too am in the process of learning Ada best practices).  
**NOTE** I followed the C code for the Normalize\_To\_Deg first while condition check on 0.0 rather than -360.0 used by you since that made the code simpler.

```ada
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Numerics;

procedure Angles_Geometric_Normalization_and_Conversion is
   Pi : constant := Ada.Numerics.Pi;
   Two_Pi : constant := 2.0 * Ada.Numerics.Pi;

   type Normalization_Types is (Normalize_To_Deg, Normalize_To_Grad, Normalize_To_Mil,
      Normalize_To_Rad);

   Normalization_Magnitudes : array (Normalization_Types) of Float :=
      (Normalize_To_Deg => 360.0,
      Normalize_To_Grad => 400.0,
      Normalize_To_Mil => 6400.0,
      Normalize_To_Rad => Two_Pi);

   function Normalize (Normalization : Normalization_Types; A : Float)
      return Float is
      Magnitude : Float := Normalization_Magnitudes (Normalization);
      Tmp : Float := A;
   begin
      while (tmp < 0.0) loop
         Tmp := Tmp + Magnitude;
      end loop;
      while (Tmp >= Magnitude) loop
         Tmp := Tmp - Magnitude;
      end loop;
      return Tmp;    
   end Normalize;

   type Conversion_Types is (Deg_to_Grad, Deg_to_Mil, Deg_to_Rad,
      Grad_to_Deg, Grad_to_Mil, Grad_to_Rad, 
      Mil_to_Deg, Mil_to_Grad, Mil_to_Rad,
      Rad_to_Deg, Rad_to_Grad, Rad_to_Mil);

   Conversions : array (Conversion_Types) of Float :=
      (Deg_To_Grad => 10.0 / 9.0, 
      Deg_To_Mil => 160.0 / 9.0, 
      Deg_To_Rad => Pi / 180.0,
      Grad_To_Deg => 9.0 / 10.0, 
      Grad_To_Mil => 16.0, 
      Grad_To_Rad => Pi / 200.0, 
      Mil_To_Deg => 9.0 / 160.0, 
      Mil_To_Grad => 1.0 / 16.0, 
      Mil_To_Rad => Pi / 3200.0,
      Rad_To_Deg => 180.0 / Pi, 
      Rad_To_Grad => 200.0 / Pi, 
      Rad_To_Mil => 3200.0 / Pi);

   function Convert (Conversion : Conversion_Types; A : Float)
      return Float is
      (a * Conversions (Conversion));

   type Index is range 1 .. 12;
   type Test_Values_Array is array (Index) of Float;
   Test_Values : Test_Values_Array :=
      (Float (-2), Float (-1), Float (0), Float (1), Float (2),
      6.2831853, Float (16), 57.2957795, Float (359),
      Float (399), Float (6399), Float (1000000));

begin
   Put_Line (" DEGREES GRADIANS MILS RADIANS");
   Put_Line (" TEST VALUE Normalized Converted Converted Converted");
   for I in Index loop
      Put (Test_Values (I), Exp => 0, Aft => 8, Fore => 8);
      Put (" ");
      Put (Normalize (Normalize_To_Deg, Test_Values (I)), Exp => 0, Aft => 8, Fore => 4);
      Put (" ");
      Put (Convert (Deg_To_Grad, Normalize (Normalize_To_Deg, Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
      Put (" ");
      Put (Convert (Deg_To_Mil, Normalize (Normalize_To_Deg, Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
      Put (" ");
      Put (Convert (Deg_To_Rad, Normalize (Normalize_To_Deg, Test_Values (I))), Exp => 0, Aft => 8, Fore => 2);
      New_Line;
   end loop;

   New_Line;
   Put_Line (" GRADIANS MILS RADIANS DEGREES");
   Put_Line (" TEST VALUE Normalized Converted Converted Converted");
   for I in Index loop
      Put (Test_Values (I), Exp => 0, Aft => 8, Fore => 8);
      Put (" ");
      Put (Normalize (Normalize_To_Grad, Test_Values (I)), Exp => 0, Aft => 8, Fore => 4);
      Put (" ");
      Put (Convert (Grad_To_Mil, Normalize (Normalize_To_Grad, Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
      Put (" ");
      Put (Convert (Grad_To_Rad, Normalize (Normalize_To_Grad, Test_Values (I))), Exp => 0, Aft => 8, Fore => 2);
      Put (" ");
      Put (Convert (Grad_To_Deg, Normalize (Normalize_To_Grad, Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
      New_Line;
   end loop;

   New_Line;
   Put_Line (" MILS RADIANS DEGREES GRADIANS");
   Put_Line (" TEST VALUE Normalized Converted Converted Converted");
   for I in Index loop
      Put (Test_Values (I), Exp => 0, Aft => 8, Fore => 8);
      Put (" ");
      Put (Normalize (Normalize_To_Mil, Test_Values (I)), Exp => 0, Aft => 8, Fore => 4);
      Put (" ");
      Put (Convert (Mil_To_Rad, Normalize (Normalize_To_Mil, Test_Values (I))), Exp => 0, Aft => 8, Fore => 2);
      Put (" ");
      Put (Convert (Mil_To_Deg, Normalize (Normalize_To_Mil, Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
      Put (" ");
      Put (Convert (Mil_To_Grad, Normalize (Normalize_To_Mil, Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
      New_Line;
   end loop;

   New_Line;
   Put_Line (" RADIANS DEGREES GRADIANS MILS");
   Put_Line (" TEST VALUE Normalized Converted Converted Converted");
   for I in Index loop
      Put (Test_Values (I), Exp => 0, Aft => 8, Fore => 8);
      Put (" ");
      Put (Normalize (Normalize_To_Rad, Test_Values (I)), Exp => 0, Aft => 8, Fore => 4);
      Put (" ");
      Put (Convert (Rad_To_Deg, Normalize (Normalize_To_Rad, Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
      Put (" ");
      Put (Convert (Rad_To_Grad, Normalize (Normalize_To_Rad, Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
      Put (" ");
      Put (Convert (Rad_To_Mil, Normalize (Normalize_To_Rad, Test_Values (I))), Exp => 0, Aft => 8, Fore => 4);
      New_Line;
   end loop;

end Angles_Geometric_Normalization_and_Conversion;

```

---

<div class="post-metadata">

### Author: ![Ret\_Build\_Engineer](https://forum.ada-lang.io/letter_avatar_proxy/v4/letter/r/ccd318/32.png) [@Ret\_Build\_Engineer](https://forum.ada-lang.io/u/Ret_Build_Engineer)
#### Post date: [July 17, 2024, 10:45pm UTC](https://forum.ada-lang.io/t/critique-for-my-first-potential-rosetta-code-task-angles-geometric-normalization-and-conversion/993/5 "2024-07-17T22:45:35Z")

</div>

Hi Anuj;

Thank you for your response. I will be examining this to learn all I can about your alternative approach. This does look like it is easier to read (and therefore, maintain) than my version. If I submit your version (or even parts of what you wrote) I’ll mention that you were a contributor.

Retired\_Build\_Engineer

---

<div class="post-metadata">

### Author: ![Ret\_Build\_Engineer](https://forum.ada-lang.io/letter_avatar_proxy/v4/letter/r/ccd318/32.png) [@Ret\_Build\_Engineer](https://forum.ada-lang.io/u/Ret_Build_Engineer)
#### Post date: [July 19, 2024, 12:28am UTC](https://forum.ada-lang.io/t/critique-for-my-first-potential-rosetta-code-task-angles-geometric-normalization-and-conversion/993/6 "2024-07-19T00:28:46Z")

</div>

Hi All;

I have posted my original version (with a small update regarding the literal whitespace padding for the table) to Rosetta Code.

Thanks for the feedback!

Retired Build Engineer
