package core:math/fixed
Overview
Fixed-point rational numbers and conversion to/from f64.
Fixed :: struct($Backing: typeid, $Fraction_Width: uint) where intrinsics.type_is_integer(Backing), 0 <= Fraction_Width, Fraction_Width <= 8 * size_of(Backing) {
}
Related Procedures With Parameters
Fixed13_3 :: struct($Backing: i16, $Fraction_Width: uint = 3) where intrinsics.type_is_integer(Backing), 0 <= Fraction_Width, Fraction_Width <= 8 * size_of(Backing) {
i: i16,
}
Fixed16_16 :: struct($Backing: i32, $Fraction_Width: uint = 16) where intrinsics.type_is_integer(Backing), 0 <= Fraction_Width, Fraction_Width <= 8 * size_of(Backing) {
i: i32,
}
Fixed26_6 :: struct($Backing: i32, $Fraction_Width: uint = 6) where intrinsics.type_is_integer(Backing), 0 <= Fraction_Width, Fraction_Width <= 8 * size_of(Backing) {
i: i32,
}
Fixed32_32 :: struct($Backing: i64, $Fraction_Width: uint = 32) where intrinsics.type_is_integer(Backing), 0 <= Fraction_Width, Fraction_Width <= 8 * size_of(Backing) {
i: i64,
}
Fixed4_4 :: struct($Backing: i8, $Fraction_Width: uint = 4) where intrinsics.type_is_integer(Backing), 0 <= Fraction_Width, Fraction_Width <= 8 * size_of(Backing) {
i: i8,
}
Fixed52_12 :: struct($Backing: i64, $Fraction_Width: uint = 12) where intrinsics.type_is_integer(Backing), 0 <= Fraction_Width, Fraction_Width <= 8 * size_of(Backing) {
i: i64,
}
Fixed5_3 :: struct($Backing: i8, $Fraction_Width: uint = 3) where intrinsics.type_is_integer(Backing), 0 <= Fraction_Width, Fraction_Width <= 8 * size_of(Backing) {
i: i8,
}
Fixed6_2 :: struct($Backing: i8, $Fraction_Width: uint = 2) where intrinsics.type_is_integer(Backing), 0 <= Fraction_Width, Fraction_Width <= 8 * size_of(Backing) {
i: i8,
}
Fixed7_1 :: struct($Backing: i8, $Fraction_Width: uint = 1) where intrinsics.type_is_integer(Backing), 0 <= Fraction_Width, Fraction_Width <= 8 * size_of(Backing) {
i: i8,
}
Fixed8_8 :: struct($Backing: i16, $Fraction_Width: uint = 8) where intrinsics.type_is_integer(Backing), 0 <= Fraction_Width, Fraction_Width <= 8 * size_of(Backing) {
i: i16,
}
This section is empty.
This section is empty.
add :: proc(x, y: $T/Fixed) -> $$deferred_return {…}
append :: proc(dst: []u8, x: $T/Fixed($Backing, $Fraction_Width)) -> string {…}
ceil :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> $$deferred_return {…}
div :: proc(x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: $$deferred_return) {…}
div_sat :: proc(x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: $$deferred_return) {…}
floor :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> $$deferred_return {…}
init_from_f64 :: proc(x: ^$T/Fixed($Backing, $Fraction_Width), val: f64) {…}
init_from_parts :: proc(x: ^$T/Fixed($Backing, $Fraction_Width), integer, fraction: $Backing) {…}
mul :: proc(x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: $$deferred_return) {…}
mul_sat :: proc(x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: $$deferred_return) {…}
round :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> $$deferred_return {…}
sub :: proc(x, y: $T/Fixed) -> $$deferred_return {…}
to_f64 :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> f64 {…}
write :: proc(dst: []u8, x: $T/Fixed($Backing, $Fraction_Width)) -> string {…}
This section is empty.
Source Files
Generated with odin version dev-2026-03 (vendor "odin") Windows_amd64 @ 2026-03-21 21:17:16.148673400 +0000 UTC