nyan needs a built-in fixed-point type to handle safe arithmetics for fractional numbers. The implementation can be taken from the openage fixed-point implementation.
The type identifier could be fixed, fpdouble or doublefp. It can probably be hardcoded as a <int64_t, 16> fixed point (64 Bit signed, 16 Bit scale factor) which should be sufficient for most use cases.
ExampleObj():
member : fixed = 1.25
The type could be compatible with the int type, and maybe with float if float is the left operand.
nyan needs a built-in fixed-point type to handle safe arithmetics for fractional numbers. The implementation can be taken from the openage fixed-point implementation.
The type identifier could be
fixed
,fpdouble
ordoublefp
. It can probably be hardcoded as a<int64_t, 16>
fixed point (64 Bit signed, 16 Bit scale factor) which should be sufficient for most use cases.The type could be compatible with the
int
type, and maybe withfloat
iffloat
is the left operand.fixed
ofixed
=>fixed
fixed
oint
=>fixed
fixed
ofloat
=> ERROR