taltamir
Member
I have a math issue when using mafia
in the 1/2 case it does
step 1: "integer divided by integer is 0.5 which is stored as an integer 0"
step 2: "convert integer 0 into float 0.0"
My request is. when mafia detects a division, first convert the numbers into float, then calculate, then check if it needs to be converted back or not.
that is
float x = 1/2
int y = 1/2
step 1: convert integers to float. 1 to 1.0. convert 2 to 2.0.
step 2: calculate 1.0/2.0 = 0.5
step 3: store as x unchanged. convert 0.5 to int and get 0 then store it as y
This will get identical results when doing
int = int/int
but will fix the problem with
float = int/int
Code:
> ash float x = (1/2)
Returned: 0.0
> ash float x = (1.0/2) Returned: 0.5
step 1: "integer divided by integer is 0.5 which is stored as an integer 0"
step 2: "convert integer 0 into float 0.0"
My request is. when mafia detects a division, first convert the numbers into float, then calculate, then check if it needs to be converted back or not.
that is
float x = 1/2
int y = 1/2
step 1: convert integers to float. 1 to 1.0. convert 2 to 2.0.
step 2: calculate 1.0/2.0 = 0.5
step 3: store as x unchanged. convert 0.5 to int and get 0 then store it as y
This will get identical results when doing
int = int/int
but will fix the problem with
float = int/int