How can I perform square root calculation of Economic Order Quantity using decimal inputs when the default return type of square root is actually a double?
I tried using the method suggested in similar question How can I improve this square root method? but it is not does not share a similar context to my problem. I have tried casting to type decimal but it does not seem to work.
public class Sample
{
public int AnnualSalesUnits { get; set; }
public decimal OrderCost { get; set; }
public decimal HoldingRate { get; set; }
public decimal UnitCost { get; set; }
public decimal EconomicOrderQuantity => Math.Sqrt((2 * OrderCost * AnnualSalesUnits) / ((HoldingRate / 100) * UnitCost));
}
Can someone help me rewrite this formula to account for the decimal inputs?