calculate_net_margin
Calculate net margin: net income divided by net sales — the share of every revenue pound/dollar that reaches the bottom line. Formula: Net Margin = Net Income / Net Sales. WHEN TO USE: Use for the all-in profitability picture after operating costs, interest, tax and other items. WHEN NOT TO USE: Do NOT use alone — net margin is affected by capital structure and tax; compare alongside gross and operating margins. BEHAVIOUR: pure deterministic calculation — no side effects, no network or storage access; idempotent and non-destructive; identical inputs always produce identical outputs. Division by zero or non-finite inputs returns an explicit error instead of a number. RETURNS: JSON object { net_margin: decimal (e.g. 0.12 = 12%), net_margin_pct: number (e.g. 12.0), inputs }. PARAMETERS: net_income (required): Net income after tax, e.g. 120000. May be negative. net_sales (required): Net sales / revenue, e.g. 1000000. Must be > 0.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| net_sales | Yes | Net sales / revenue, e.g. 1000000. Must be > 0. | |
| net_income | Yes | Net income after tax, e.g. 120000. May be negative. |