You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The main reason and it's an quite important one is that third parties C++ libraries like Panda3D or Bullet Physics can be built for simple or double float precision. So for a whole project it should be possible to set the default precision of Mys.
A goal for Mys is to be minimalistic, mainly to make that language easier to learn. Everything we add gives the user more choices and makes her less confident in what is the best way to implement a given problem.
Initially there were only int and float of machine word size. They were replaced by i8/i16/... because the user often prefers to know that their code works regardless of machine word size.
As I see it most pure Mys programs will benefit from using the fixed size types. If it turns out we can gain a huge performance improvement by introducing int and float, well, ok, I guess we have to, but if the only advantage is that C interop becomes slightly more conveniant I prefer not to add more types to Mys.
128 bits types will probably be supported as some point.
If it turns out we can gain a huge performance improvement by introducing int and float
it's really not about performance but interoperability instead, including safeguards when downcasting f64 / f128 to f32 ( which is already known to give very strange behaviour on bullet physic engine). Remember that doing a lot of successive float math on lesser precision than final target introduce more rounding error at each step than user would expect and may lead to bugs and bugs reports.
it is really about adding a macro to let Mys pickup at compile time the best accuracy available regarding to final target ( as if float/int where extern types provided by the third party ). It also help to avoid linking problem like panda3d/panda3d#787
eg in Panda3D : you have Vec3f and Vec3d but user is always advised to use Vec3 instead which is remapped via include files to the matching precision choosen at build.
with reasonable defaults like i32 and f32.
The main reason and it's an quite important one is that third parties C++ libraries like Panda3D or Bullet Physics can be built for simple or double float precision. So for a whole project it should be possible to set the default precision of Mys.
( also maybe up to i128/ f128 with https://bellard.org/softfp ? )
The text was updated successfully, but these errors were encountered: