Home
Getting Started
  • Fundamentals
  • Advanced
  • Fundamentals
  • Intermediate
  • Advanced
OM-Functions
  • FAQs
  • Glossary
  • Contributing
Changelog
Github
Home
Getting Started
  • Fundamentals
  • Advanced
  • Fundamentals
  • Intermediate
  • Advanced
OM-Functions
  • FAQs
  • Glossary
  • Contributing
Changelog
Github
  • Tutorials

    • Fundamentals

      • Basic Arithmetic
      • Data Types
      • Introduction to Array
      • Shapes
      • Size
      • Axes
      • Statistics
      • Logic
    • Advanced

      • 2D Array
      • 3D Array
      • Algebra
      • Average
      • Variance

Data Types

In OM, numbers are the primary data type. They can be whole numbers e.g 10, 500 or numbers with decimal points e.g 3.14, 0.5. While JavaScript has other data types e.g strings for text or booleans for true/false values, OM functions are designed for numerical calculations. If you try to include non-numbers, OM might convert them to NaN meaning it can't understand them or throw an error.

For example:

You can calculate an array of prices that contains both float and integer:

import { add } from "openmadness";
const prices = add([24.99, 12.50, 5.00]);
console.log("Numeric prices:", prices.data);

What happens if you try to include a string?

import { add } from "openmadness";
const mixedItems = add([10, 'apple', 20]);
console.log("Mixed data:", mixedItems.data); // Output: [10, NaN, 20]
// 'apple' can't be converted to a number, so it becomes NaN.

Note

For reliable results, always provide numbers to Openmadness arrays.

Edit this page on GitHub
Last Updated:: 7/11/25, 12:24 PM
Contributors: Dev-Liz
Prev
Basic Arithmetic
Next
Introduction to Array