Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

utils

Felt Utilities

Utility functions for working with signed felt252 values using sign-magnitude representation.

Functions

  • felt_sign - Determine the sign of a felt value
  • felt_abs - Get the absolute value of a felt

Fully qualified path: cairo_fp::utils

Constants

HALF_PRIMEHalf of the prime field modulus. Used as the boundary between positive and negative values in sign-magnitude representation. Values above this are negative.

Free functions

felt_signReturns the sign of a signed felt252 . Uses sign-magnitude representation where values greater than HALF_PRIME are considered negative….
felt_absReturns the absolute value of a signed felt252 . If the value is negative (per sign-magnitude representation), returns its negation. Otherwise returns the value unchanged.