-----------[stress.adb]-----------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Float_Text_IO;
with Ada.Numerics.Elementary_Functions;
with Ada.Wide_Wide_Text_IO;
--with Ada.Wide_Wide_Text_IO.Text_Streams;
procedure σ_max_min is
package IOFloat renames Ada.Float_Text_IO;
package NumEF renames Ada.Numerics.Elementary_Functions;
package IOWide renames Ada.Wide_Wide_Text_IO;
type σ is new float digits 3 range -20_000.0..20_000.0;
type τ is new float digits 3 range -20_000.0..20_000.0;
σ_x, σ_y, σ_max, σ_min, A, B : σ;
τ_xy : τ;
begin
σ_x := σ(5.5);
σ_y := σ(-2.3);
τ_xy := τ(1.4);
A := σ( (σ_x + σ_y) / 2.0 );
B := σ( NumEF.Sqrt( float((σ_x - σ_y)**2 / 4.0 + σ(τ_xy)) ) );
σ_max := σ( A + B );
σ_min := σ( A - B );
IOWide.Put("σ_x = "); IOFloat.Put( float(σ_x)); New_Line;
IOWide.Put("σ_yx = "); IOFloat.Put( float(σ_y)); New_Line;
IOWide.Put("σ_min = "); IOFloat.Put( float(σ_min)); New_Line;
IOWide.Put("σ_max + σ_min = "); IOFloat.Put( float(σ_max + σ_min) ); New_Line;
IOWide.Put("σ_x + σ_y = "); IOFloat.Put( float(σ_x + σ_y) ); New_Line;
New_Line;
end σ_max_min;
-----------[end stress.adb]-----------
I compiled it by the command
gnatmake -gnatW8 -Xstyle=Debug -Xos=Linux -Xtarget=i686 "stress"
The program writes
σ_x = 5.50000E+00
σ_yx = -2.30000E+00
σ_min = -2.47554E+00
σ_max + σ_min = 3.20000E+00
σ_x + σ_y = 3.20000E+00