fp.from_felt

fn from_felt(val: felt252) -> T;

Creates a new fixed point instance from a felt252 value.

Args

  • val(felt252) - felt252 value to convert in fixed point.

Returns

A new fixed point instance.

Examples

use orion::numbers::{FP16x16, FP16x16Impl, FixedTrait};

fn from_felt_example() -> FP16x16 {
    // We can call `from_felt` function as follows . 
    FixedTrait::from_felt(190054)
}
>>> {mag: 190054, sign: false} // = 2.9

Last updated