Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

📐 The fastest and smallest Go math library for constrained environments, like microcontrollers or WebAssembly.

License

NotificationsYou must be signed in to change notification settings

orsinium-labs/tinymath

Repository files navigation

[📚 docs ] [🐙 github ]

The fastest Go math library for constrained environments, like microcontrollers or WebAssembly.

  • Optimizes for performance and small code size at the cost of precision.
  • Uses float32 because most microcontrollers (likeESP32) have much faster computation for float32 than for float64.
  • Designed and tested to work with both Go andTinyGo, hence the name.
  • Most algorithms are ported frommicromath Rust library.
  • Zero dependency.

📦 Installation

go get github.com/orsinium-labs/tinymath

🔧 Usage

fmt.Println(tinymath.Sin(tinymath.Pi))

🔬 Size

Here is a comparison of WebAssembly binary size (built with TinyGo) when using tinymath vs stdlib math:

functiontinymathstdlibratio
atan10636728%
atan216778221%
exp463272217%
fract166154107%
hypot6720333%
ln19648924%
powf70191677%
round12917175%
sin125123710%
sqrt5757100%
tan138113712%
trunc5757100%

To reproduce:python3 size_bench.py

About

📐 The fastest and smallest Go math library for constrained environments, like microcontrollers or WebAssembly.

Topics

Resources

License

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp