fixtof(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

✨ fixtof ✨

okay bestie, welcome to the Allegro manual πŸŽ€ and specifically to fixtof(3), a lil function from the Allegro game programming library that is, and I mean this, lowkey carrying your whole fixed-point-to-float pipeline. πŸ’…


🌸 NAME 🌸

fixtof β€” converts a fixed point to floating point. Part of the Allegro game programming library, obviously. πŸ‘‘


✨ SYNOPSIS ✨

#include <allegro.h>

double fixtof(fixed x);

like… that's it. one arg. one return value. no drama. 🫢


πŸ’– DESCRIPTION πŸ’–

So here's the vibe: fixtof takes a fixed point value and converts it to floating point. That's the whole job. It does it. It slays. ✨

And because a demo is worth a thousand words, here's the example straight from the source, no cap:

float result;

/* This will put 33.33333 into `result'. */
result = fixtof(itofix(100) / 3);
/* This will put 16.66666 into `result'. */
result = fixtof(itofix(100) / 6);

see how it's giving math? itofix(100) goes in as fixed, fixtof brings it back out as a float, and the division just… works. iconic behaviour fr fr. 🌈


πŸ‘€ SEE ALSO πŸ‘€

the whole friend group, if you will:


and that's the whole page bestie!! πŸ’œ this came to you courtesy of Allegro, version 4.4.3, and yes it's the fixtof(3) page we've been talking about this entire time 😭 go forth and convert your fixed points to floats, you main character. πŸ¦‹πŸ’…β­

πŸ“¦ where this page comes from