AL icon indicating copy to clipboard operation
AL copied to clipboard

Provide methods from System.Math

Open finstx opened this issue 8 years ago • 7 comments

Methods like sine, cosine, min, max and other elementary functions as well as fields like Pi should be available in AL.

finstx avatar Dec 27 '17 14:12 finstx

Thank you for the suggestion! Do you have any scenarios in mind? We are interested in knowing about the use cases you have for these.

atoader avatar Dec 27 '17 15:12 atoader

I'm trying to migrate a BingMaps solution to AL. One feature of the solution is to calculate the bounding box around a contact (by latitude/longitude) and show other contacts in this bounding box. For calculating the bounding box I need some of the trigonometric functions and constants (http://aboutsqlserver.com/2013/09/03/optimizing-sql-server-spatial-queries-with-bounding-box/ fig. 11).

finstx avatar Dec 27 '17 15:12 finstx

I agree with this. I have come across the need for functions in the Maths library when trying to calculate material requirements for specific manufacturing processes.

GaryFrostick avatar Jan 11 '18 12:01 GaryFrostick

Any update on this? A NumberManagement Codeunit (like COD41 TextManagement) with mathematical functions would be very useful. The first 2 functions can already be moved from COD5780 "Whse. Cross-Dock Management" Maximum and Minimum.

BertDeTemmerman avatar Jun 14 '18 07:06 BertDeTemmerman

Well, I would say MAX and MIN should be implemented as global functions rather than in a CU. If implementing in a CU, I need to declare a variable of type codeunit to use it.

ThomasBrodkorb avatar Aug 17 '18 15:08 ThomasBrodkorb

I have a requirement for old functionality in our ISV I am bringing forward to allow user entered formulas be parsed and it allows a user to enter almost every function inside of the System.Math library. We need these function exposed if possible Abs, Ceiling, Exp, Floor, IEEERemainder, Min, Max, Sqrt, Truncate, Pow.

I think that this functionality would make most sense as a codeunit. Just like System.Math is a library, a codeunit is the AL equivalent. If we cannot get System.Math features we lose a core feature in our software.

kevindstanley1988 avatar Oct 31 '18 13:10 kevindstanley1988

Hello, thank you for the perspectives on introducing Math utilities in AL. I am closing this issue as all the math functions mentioned above are currently supported using the Math codeunit defined in System Application, see https://github.com/microsoft/BCApps/blob/main/src/System%20Application/App/Math/src/Math.Codeunit.al. If something is missing, feel free to contribute to the system application as it is now publicly available on Github.

qutreson avatar Nov 28 '23 12:11 qutreson