maTH
  • 👋Welcome!
  • 🗿Installation
  • Reference
    • 😱Mathematical operations
      • add
      • pascal
      • factorial
      • factorialL
      • GCD
      • LCM
      • pow
      • permutations
      • combinations
      • combinationsWithRep
      • subtract
      • multiply
      • divide
      • sin
      • cos
      • ln
      • log
      • radToDeg
      • degToRad
      • mod
      • abs
      • floor
      • ceil
      • root
      • exp
      • tan
      • arcsin
      • arccos
      • arctan
      • sinh
      • cosh
      • round
    • 🥶Statistics
      • Binomial
      • Poisson
      • Geometric
      • Pascal
      • Hypergeometric
      • Exponential
      • Uniform
    • 🥵Data structures
      • Stack
      • Queue
      • LinkedList
    • 🤓Algorithms
      • Bubble sort
      • Insertion sort
      • Selection sort
      • Merge sort
      • Quicksort
      • Heap sort
      • Count sort
      • Bucket sort
      • Radix sort
    • 😳Constants
Powered by GitBook
On this page
  1. Reference
  2. Mathematical operations

subtract

Subtract any two numbers

subtract<return_type>(a, b);

will return the difference of the two given numbers. The return_type specifies in which data type the difference will be returned in, like shown in below example:

subtract<int>(6.9, 4.20); //2
subtract<float>(3.222, 5); //-1.778
subtract<bool>(0, 1); //1
------------------------
subtract<char>('c', 2); //'a'

Typically subtraction works only for numeric data types, but in this case, you have an additional option for characters. Before using it in that way, please test it before actually implementing something.

PreviouscombinationsWithRepNextmultiply

Last updated 11 months ago

😱