Totem-Studios / lotus

Lotus is a type-safe compiled programming languages designed to simplify systems programming, achieving memory safety using RAII.
https://totemstudios.org/lotus
MIT License
4 stars 2 forks source link

Printing f32 with printf [BUG] #36

Open lucasnorman07 opened 1 month ago

lucasnorman07 commented 1 month ago

Describe the bug

The type f32 always prints 0.000000 when using the printf function provided by LLVM IR. It works fine when casting to an f64, so the problem is likely due to the printf implementation of LLVM IR and it might not do type promotion correctly.

To Reproduce

Steps to reproduce the behavior:

  1. Create a lotus program
  2. Create the main function with a variable of type f32
  3. Try to print the variable with printf and %f
  4. Run the code and see that it only prints zeros

Expected behavior

The f32 type should work the same as the f64 when printing.

Screenshots

image

Environment (please complete the following information):