25
Hi there,

in Business Central, we generally miss constants and trigonometric, logarithmic, and other common mathematical functions for cloud deployments.

This problem could very easily be solved by a .NET wrapper code unit, where the System.Math namespace (https://docs.microsoft.com/de-de/dotnet/api/system.math) is mapped and the static functions are provided in a codeunit.

I see this as something that should be available in a base app, and accessible for cloud and on-premises deployments.

Limited example:

var
dotNetMath: DotNet DotNetMath;

/**!
@summary: Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π.
*/
procedure Pi(): Decimal
begin
exit(3.1415926535897931);
end;

/**!
@summary: Represents the natural logarithmic base, specified by the constant, e.
*/
procedure E(): Decimal
begin
exit(2.7182818284590451);
end;

/**!
@summary:
Returns the angle whose cosine is the specified number.

@param: d
A number representing a cosine, where d must be greater than or equal to -1,
but less than or equal to 1.

@returns:
An angle, θ, measured in radians, such that 0 ≤θ≤π-or- Decimal.NaN if d
< -1 or d > 1 or d equals Decimal.NaN.
*/
procedure Acos(d: Decimal): Decimal
begin
exit(dotNetMath.Acos(d));
end;

/**!
@summary:
Returns the angle whose sine is the specified number.

@param: d
A number representing a sine, where d must be greater than or equal to -1, but
less than or equal to 1.

@returns:
An angle, θ, measured in radians, such that -π/2 ≤θ≤π/2 -or- Decimal.NaN
if d < -1 or d > 1 or d equals Decimal.NaN.
*/
procedure Asin(d: Decimal): Decimal
begin
exit(dotNetMath.Asin(d));
end;

Best regards,
Carsten
Category: Development
STATUS DETAILS
Completed
Ideas Administrator

Thank you for your input. We have decided to deliver this idea and make it available with Business Central 2019 release wave 2.  


You can preview the module in the GitHub: https://github.com/microsoft/ALAppExtensions/tree/master/Modules/System/Math/src


Thanks,
Andrei Panko, PM

Comments

C

While this idea still has status "new", a wrapper for System.Math has been checked in as System Application module (https://github.com/microsoft/ALAppExtensions/tree/master/Modules/System/Math) and will be available with Release 15.

@Microsoft: Can you close this idea or flag as implemented?

Category: Development