aardappel / lobster

The Lobster Programming Language
http://strlen.com/lobster
2.24k stars 121 forks source link

conv int to float - (float) #236

Closed georgiy-pruss closed 1 year ago

georgiy-pruss commented 1 year ago

https://github.com/aardappel/lobster/blob/ccf3c651c02626f7394039fe529ce9e4c45842ac/dev/src/lobster/vmops.h#L595

Shouldn't it be (double)? Maybe in other common places too, like in vmdata.h

let a = 2222222222222222222
let b = 2222222222222222222.0

print 2.0*a // 4444444527406612480.0
print 2.0*b // 4444444444444444672.0

print float(a) // 2222222222222222336.0
print 1.0*a    // 2222222263703306240.0

I understand it may not matter for the graphics calculations, but for the general part I don't know...

aardappel commented 1 year ago

That's indeed a bad oversight.. still from the days when Lobster was 32-bit I guess.

I scanned all other files for (float) and couldn't find any similar mistakes.

fixed here: https://github.com/aardappel/lobster/commit/7546001dcdcc51c93a9b3070d5b86076e3037639