Absolute Value Calculator Formula

Understand the math behind the absolute value calculator. Each variable explained with a worked example.

Formulas Used

Abs Val

abs_val = abs(num)

Sign

sign = num > 0 ? 1 : (num < 0 ? -1 : 0)

Squared

squared = pow(num, 2)

Variables

VariableDescriptionDefault
numNumber-7.5

How It Works

Absolute Value

Definition

x= x if x ≥ 0, andx= -x if x < 0

The absolute value of a number is its distance from zero on the number line, always non-negative.

Properties

  • x ≥ 0 for all x
  • x = 0 only when x = 0
  • xy=x×y
  • x + y≤x+y (triangle inequality)
  • Worked Example

    Find the absolute value of -7.5.

    num = -7.5
    1. 01|-7.5| = 7.5
    2. 02The number is negative, so the sign is -1
    3. 03(-7.5)² = 56.25

    Frequently Asked Questions

    What is absolute value?

    Absolute value is the distance of a number from zero, regardless of direction. It strips away the negative sign if present.

    Is absolute value always positive?

    Absolute value is always non-negative. It equals zero only when the input is zero, and is positive for all other inputs.

    How is absolute value used in real life?

    Absolute value is used when only magnitude matters: distance between points, error margins, temperature differences, and electrical signal strength.

    Learn More

    Guide

    How to Graph Absolute Value Functions

    Learn how to graph absolute value functions step by step. Covers the V-shape, vertex, reflections, stretches, and transformations of y = |x| with examples.

    Ready to run the numbers?

    Open Absolute Value Calculator