conversion float

Posted By: physical_love

conversion float - 08/21/20 08:45

hi,
Code
inline var _VAR(int i) { return i<<10; }					// int -> var
inline var _VAR(double f) { return (var)(f * (1 << 10)); }		// double -> var, overloaded
inline int _INT(var x) { return x>>10; }					// var -> int
inline float _FLOAT(var x) { return ((float)x)/(1<<10); }	// var -> float

There are these in the adll header but float-> var does not exist. (float to var)
can someone tell me how to do this?
Posted By: Aku_Aku

Re: conversion float - 08/21/20 13:52

I would cast the float to double and the way is straitforward from that.
Like this: var the_var = (var)((double)the_float));
Or use the _VAR((double)the_float)) format.
Hope this helps.
© 2024 lite-C Forums