Skip to content

landonAL/mlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 

Repository files navigation

MLib

Warning

This library is a work in progress, and anything is subject to change without notice. Use this library at your own risk!

A mathematical library that does not have any dependencies and aims to provide advanced mathematical functionality.

The library itself does not need to be built. You can simply copy-paste mlib into your project directory and include it.

In its primary language, which is C, MLib is a classic stb-style single header library, meaning that by default it acts like a header, but if you add #define MLIB_IMPLEMENTATION prior to including the library it acts like a source file.

Example

C

#include <stdio.h>

#define MLIB_IMPLEMENTATION
#include "mlib.c"

int
main()
{
    for (int i = 1; i < 11; ++i) {
        printf("%f\n", pow(i, 2));
    }

    return 0;
}

C++

#include <iostream>

#define MLIB_IMPLEMENTATION
#include "mlib.c"

int
main()
{
    for (int i = 1; i < 11; ++i) {
        std::cout << pow(i, 2) << "\n";
    }

    return 0;
}

CSharp

using static mlib;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 0; i < 11; ++i)
            {
                Console.WriteLine(mlib.pow(i, 2));
            }
        }
    }
}

C3

import mlib;
import std::io;

fn int main()
{
    for (int i = 1; i < 11; ++i)
    {
        io::printn(mlib::pow(i, 2));
    }
}

Python

import mlib

def main():
    for i in range(11):
        print(pow(i, 2))

if __name__ == "__main__":
    main()

Javascript

const mlib = require('./mlib.js');

function start() {
    for (let i = 0; i < 11; ++i) {
        console.log(mlib.pow(i, 2));
    }
}

start();

Rust

pub mod mlib;

fn main() {
    for i in 1..11 {
        println!("{}", mlib::pow(i as f64, 2));
    }
}

Known issues

None currently found

About

An experimental and multilingual math library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •