Using Ada (GNAT): I need to determine the power of ten for a given value. The most obvious approach is to use a logarithm; but that fails to compile.
with Ada.Numerics.Generic_Elementary_Functions;
procedure F(Value : in Float) is
The_Log : Integer := 0;
begin
The_Log := Integer(Log(Value, 10));
G(Value, The_Log);
end;
error:
- utilities.adb:495:26: "Log" is not visible
- utilities.adb:495:26: non-visible declaration at a-ngelfu.ads:24, instance at line 482
- utilities.adb:495:26: non-visible declaration at a-ngelfu.ads:23, instance at line 482
So then I attempt to refer to the package, but that also fails:
with Ada.Numerics.Generic_Elementary_Functions;
procedure F(Value : in Float) is
The_Log : Integer := 0;
package Float_Functions is new Ada.Numerics.Generic_Elementary_Functions (Float);
begin
The_Log := Integer(Float_Functions.Log(Value, 10));
G(Value, The_Log);
end;
error:
- utilities.adb:495:41: no candidate interpretations match the actuals:
- utilities.adb:495:41: too many arguments in call to "Log"
- utilities.adb:495:53: expected type "Standard.Float"
- utilities.adb:495:53: found type universal integer ==> in call to "Log" at a-ngelfu.ads:24, instance at line 482