• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

-

To understand how to calculate data as a decimal number you need understand what a data type is, in c/c++ and many other languages.

An integer holds a whole number (e.g. 1,2,3 etc) whereas a float would hold a decimal number (e.g. 1.0, 2.5, 3.9 etc..), but there are many different data types, if a data type is signed it will hold both negative and positive values, if a data type is unsigned then it will only hold positive values.

Currently there are no unsigned floating data types so a float or double etc will always have a range of positive & negative values.

In C/C++ normally if there is a data type surround in parentheses (data type) and there is a value to the right of it, then this is known as a cast, which will convert from 1 data type to another, if your converting from a decimal to a whole number then everything after the decimal place will be truncated (aka deleted).
Code:
float f = 10.5
int x = (int) f
// x now holds the value of 10

float p = (float) x
// p now holds the value of 10.0

Unlike lua, javascript, php, and a few other languages I can't think of atm, C/C++ requires its functions / methods to state a return type, if the function or method does not return a value then the return type is void.

If it does have a return type then you must return that data type or you will generate an error and your code may not compile at all.

To summarize you would need to find a data type with a big enough range value to hold a range to that of a uint64_t using floating point notation.
 
Last edited:
Back
Top Bottom