Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

lut

Lookup Tables

Precomputed lookup tables for fast mathematical operations. These functions use binary search through hardcoded values to avoid expensive runtime calculations.

Functions

  • msb - Most significant bit position and power of 2
  • exp2 - Powers of 2 for exponents 0-64
  • sin - Sine interpolation data for 256 slots
  • atan - Arctangent interpolation data for 100 slots

Implementation Notes

These lookup tables are optimized for gas efficiency by using cascading if-statements with binary search patterns. While the code is verbose, it provides O(log n) lookup time.

Fully qualified path: cairo_fp::f128::math::lut

Free functions

msbCalculates the most significant bit position….
exp2
sin
atan