Skip to content

Latest commit

 

History

History
488 lines (322 loc) · 17.1 KB

File metadata and controls

488 lines (322 loc) · 17.1 KB

Math Functions

ROUND

Signature: ROUND(number, decimals)
Returns: number
Description: Rounds a number to specified decimal places

Arguments:

  • number (number): Number to round
  • decimals (number): Number of decimal places
Test References (9 found)
  • math-functions.test.js (9 references)
    • Line 12: const result = evaluateFormula('ROUND(3.14159, 2)', testContext);
    • Line 18: const result = evaluateFormula('ROUND(revenue, 0)', testContext);
    • Line 96: const result = evaluateFormula('ROUND(ABS(revenue - cost) / MAX(revenue, cost) * 100, 2)', testContext);
    • Line 102: const result = evaluateFormula('ROUND(revenue * 0.1, 2) + MIN(cost, 100)', testContext);
    • Line 108: const result = evaluateFormula('STRING(ROUND(revenue, 2)) & " (max with cost: " & STRING(MAX(revenue, cost)) & ")"', testContext);
    • Line 115: () => evaluateFormula('ROUND(3.14, "world")', testContext),
    • Line 160: () => evaluateFormula('ROUND(MIN("a", "b"), ABS("c"))', testContext),
    • Line 171: () => evaluateFormula('ROUND(3.14)', testContext),
    • Line 180: () => evaluateFormula('ROUND("hello", 2)', testContext),
Usage Examples (13 found)
  • examples/table/customer/budget_analysis.formula (1 reference)

    • Line 1: first_name & " " & last_name & " | Budget Range: $" & STRING(ROUND(budget_max - budget_min, 0)) & " | Flexibility: " & STRING(ROUND((budget_max - budget_min) / budget_min * 100, 0)) & "% | Avg Target: $" & STRING(ROUND((budget_min + budget_max) / 2, 0))
  • examples/table/customer/contact_card.formula (1 reference)

    • Line 1: first_name & " " & last_name & " | " & email & " | " & phone & " | Budget: $" & STRING(ROUND(budget_min/1000, 0)) & "K-$" & STRING(ROUND(budget_max/1000, 0)) & "K | " & STRING(preferred_bedrooms) & "BR | " & UPPER(status) & " | " & assigned_rep_id_rel.name
  • examples/table/customer/lead_score.formula (3 references)

    • Line 1: STRING(ROUND(
    • Line 7: , 0)) & "/100 | " & IF(ROUND(
    • Line 13: , 0) > 70, "🔥 HOT", IF(ROUND(
  • examples/table/listing/luxury_indicator.formula (1 reference)

    • Line 1: IF(listing_price > 800000, "💎 LUXURY", IF(listing_price > 500000, "⭐ PREMIUM", IF(listing_price > 300000, "🏠 STANDARD", "💰 AFFORDABLE"))) & " | " & STRING(bedrooms) & "BR " & STRING(bathrooms) & "BA | " & STRING(ROUND(square_feet/1000, 1)) & "K sqft"
  • examples/table/listing/market_analysis.formula (1 reference)

    • Line 1: address & " | Market Position: " & IF(days_on_market < 30, "🔥 HOT", IF(days_on_market < 60, "📈 NORMAL", IF(days_on_market < 90, "📊 SLOW", "❄️ STALE"))) & " | " & STRING(days_on_market) & " days | Price/sqft: $" & STRING(ROUND(listing_price/square_feet, 0)) & " | " & IF(ROUND(listing_price/square_feet, 0) > 200, "💰 PREMIUM", IF(ROUND(listing_price/square_feet, 0) > 150, "📊 MARKET", "💵 VALUE"))
  • examples/table/listing/market_summary.formula (1 reference)

    • Line 1: address & " | $" & STRING(ROUND(listing_price/1000, 0)) & "K | " & STRING(bedrooms) & "bed/" & STRING(bathrooms) & "bath | " & STRING(ROUND(listing_price/square_feet, 0)) & "/sqft | " & STRING(days_on_market) & " days | " & UPPER(status)
  • examples/table/listing/price_per_sqft.formula (1 reference)

    • Line 1: ROUND(listing_price / square_feet, 2)
  • examples/table/opportunity/commission_projection.formula (1 reference)

    • Line 1: IF(stage = "closed", "✅ PAID: $" & STRING(ROUND(commission_total, 0)), "📊 PROJECTED: $" & STRING(ROUND(NULLVALUE(offer_amount, listing_id_rel.listing_price) * 0.06 * (probability / 100), 0))) & " | Reps: " & STRING(COUNT_AGG(rep_links_opportunity_id, rep_id))
  • examples/table/opportunity/deal_summary.formula (1 reference)

    • Line 1: customer_id_rel.first_name & " " & customer_id_rel.last_name & " → " & listing_id_rel.address & " | " & UPPER(stage) & " | $" & STRING(ROUND(NULLVALUE(offer_amount, listing_id_rel.listing_price)/1000, 0)) & "K | " & STRING(probability) & "% | " & NULLVALUE(financing_type, "TBD")
  • examples/table/rep/commission_summary.formula (1 reference)

    • Line 1: name & " | Earned: $" & STRING(ROUND(SUM_AGG(rep_links_rep_id, NULLVALUE(commission_amount, 0)), 0)) & " | Pending: $" & STRING(ROUND(SUM_AGG(rep_links_rep_id, IF(ISNULL(commission_amount), 50000 * commission_percentage / 100, 0)), 0)) & " | Deals: " & STRING(COUNT_AGG(rep_links_rep_id, id))
  • examples/table/rep/performance_dashboard.formula (1 reference)

    • Line 1: name & " (" & region & ") | Goal: $" & STRING(ROUND(sales_goal/1000, 0)) & "K | Active Listings: " & STRING(COUNT_AGG(listings_listing_agent_id, id)) & " | Opportunities: " & STRING(COUNT_AGG(rep_links_rep_id, id)) & " | Rate: " & STRING(commission_rate * 100) & "%"

ABS

Signature: ABS(number)
Returns: number
Description: Returns the absolute value of a number

Arguments:

  • number (number): Number to get absolute value of
Test References (7 found)
  • if-function.test.js (1 reference)

    • Line 66: const result = evaluateFormula('IF(ABS(revenue - cost) > 1000, "Large difference", "Small difference")', testContext);
  • math-functions.test.js (6 references)

    • Line 24: const result = evaluateFormula('ABS(-25.5)', testContext);
    • Line 30: const result = evaluateFormula('ABS(cost)', testContext);
    • Line 96: const result = evaluateFormula('ROUND(ABS(revenue - cost) / MAX(revenue, cost) * 100, 2)', testContext);
    • Line 160: () => evaluateFormula('ROUND(MIN("a", "b"), ABS("c"))', testContext),
    • Line 189: () => evaluateFormula('ABS()', testContext),
    • Line 198: () => evaluateFormula('ABS("hello")', testContext),
Usage Examples (0 found)

No usage examples found for this function.


CEILING

Signature: CEILING(number)
Returns: number
Description: Rounds a number up to the nearest integer

Arguments:

  • number (number): Number to round up
Test References (4 found)
  • math-functions.test.js (4 references)
    • Line 72: const result = evaluateFormula('CEILING(3.2)', testContext);
    • Line 78: const result = evaluateFormula('CEILING(revenue)', testContext);
    • Line 142: () => evaluateFormula('CEILING(3.2, 5)', testContext),
    • Line 234: () => evaluateFormula('CEILING(TODAY())', testContext),
Usage Examples (0 found)

No usage examples found for this function.


FLOOR

Signature: FLOOR(number)
Returns: number
Description: Rounds a number down to the nearest integer

Arguments:

  • number (number): Number to round down
Test References (3 found)
  • math-functions.test.js (3 references)
    • Line 84: const result = evaluateFormula('FLOOR(8.9)', testContext);
    • Line 90: const result = evaluateFormula('FLOOR(cost)', testContext);
    • Line 151: () => evaluateFormula('FLOOR("text")', testContext),
Usage Examples (0 found)

No usage examples found for this function.


POWER

Signature: POWER(base, exponent)
Returns: number
Description: Raises a number to a power

Arguments:

Test References (0 found)

No test references found for this function.

Usage Examples (0 found)

No usage examples found for this function.


SQRT

Signature: SQRT(value)
Returns: number
Description: Returns the square root of a number

Arguments:

  • value (number): Number to get square root of
Test References (0 found)

No test references found for this function.

Usage Examples (0 found)

No usage examples found for this function.


LOG

Signature: LOG(value)
Returns: number
Description: Returns the natural logarithm of a number

Arguments:

  • value (number): Number to get natural logarithm of
Test References (0 found)

No test references found for this function.

Usage Examples (0 found)

No usage examples found for this function.


LOG10

Signature: LOG10(value)
Returns: number
Description: Returns the base-10 logarithm of a number

Arguments:

  • value (number): Number to get base-10 logarithm of
Test References (0 found)

No test references found for this function.

Usage Examples (0 found)

No usage examples found for this function.


EXP

Signature: EXP(value)
Returns: number
Description: Returns e raised to the power of a number

Arguments:

Test References (0 found)

No test references found for this function.

Usage Examples (0 found)

No usage examples found for this function.


SIN

Signature: SIN(angle)
Returns: number
Description: Returns the sine of an angle in radians

Arguments:

  • angle (number): Angle in radians
Test References (0 found)

No test references found for this function.

Usage Examples (0 found)

No usage examples found for this function.


COS

Signature: COS(angle)
Returns: number
Description: Returns the cosine of an angle in radians

Arguments:

  • angle (number): Angle in radians
Test References (0 found)

No test references found for this function.

Usage Examples (0 found)

No usage examples found for this function.


TAN

Signature: TAN(angle)
Returns: number
Description: Returns the tangent of an angle in radians

Arguments:

  • angle (number): Angle in radians
Test References (0 found)

No test references found for this function.

Usage Examples (0 found)

No usage examples found for this function.


RANDOM

Signature: RANDOM()
Returns: number
Description: Returns a random number between 0 and 1

Arguments: None

Test References (0 found)

No test references found for this function.

Usage Examples (0 found)

No usage examples found for this function.


MIN

Signature: MIN(num1, num2)
Returns: number
Description: Returns the minimum of two numbers

Arguments:

Test References (6 found)
  • math-functions.test.js (6 references)
    • Line 36: const result = evaluateFormula('MIN(10, 20)', testContext);
    • Line 42: const result = evaluateFormula('MIN(revenue, cost)', testContext);
    • Line 102: const result = evaluateFormula('ROUND(revenue * 0.1, 2) + MIN(cost, 100)', testContext);
    • Line 160: () => evaluateFormula('ROUND(MIN("a", "b"), ABS("c"))', testContext),
    • Line 207: () => evaluateFormula('MIN(5)', testContext),
    • Line 216: () => evaluateFormula('MIN("hello", "world")', testContext),
Usage Examples (0 found)

No usage examples found for this function.


MAX

Signature: MAX(num1, num2)
Returns: number
Description: Returns the maximum of two numbers

Arguments:

Test References (5 found)
  • math-functions.test.js (5 references)
    • Line 48: const result = evaluateFormula('MAX(15, 8)', testContext);
    • Line 54: const result = evaluateFormula('MAX(revenue, cost)', testContext);
    • Line 96: const result = evaluateFormula('ROUND(ABS(revenue - cost) / MAX(revenue, cost) * 100, 2)', testContext);
    • Line 108: const result = evaluateFormula('STRING(ROUND(revenue, 2)) & " (max with cost: " & STRING(MAX(revenue, cost)) & ")"', testContext);
    • Line 124: () => evaluateFormula('MAX(10, TODAY())', testContext),
Usage Examples (0 found)

No usage examples found for this function.


MOD

Signature: MOD(dividend, divisor)
Returns: number
Description: Returns the remainder of division

Arguments:

  • dividend (number): Number to divide
  • divisor (number): Number to divide by
Test References (4 found)
  • math-functions.test.js (4 references)
    • Line 60: const result = evaluateFormula('MOD(17, 5)', testContext);
    • Line 66: const result = evaluateFormula('MOD(revenue, 10)', testContext);
    • Line 133: () => evaluateFormula('MOD(revenue, "divisor")', testContext),
    • Line 225: () => evaluateFormula('MOD(17, 5, 3)', testContext),
Usage Examples (0 found)

No usage examples found for this function.


SIGN

Signature: SIGN(value)
Returns: number
Description: Returns the sign of a number (-1, 0, or 1)

Arguments:

  • value (number): Number to get sign of
Test References (0 found)

No test references found for this function.

Usage Examples (0 found)

No usage examples found for this function.

Documentation generated on 2025-06-27T07:39:53.106Z