HigherOrderCO/Bend

Convert between Integer and float

Nihal-Srivastava05 opened this issue · 4 comments

Is your feature request related to a problem? Please describe.
I am making a few math functions where I am dealing with floats. Now with List/length as inbuilt it gives the result as an integer (I had written it myself before as float). when I use it for operations I get garbage value back cause int and float division or addition leads to errors. So I need a way to convert int to float or float to int.

Describe the solution you'd like
Like a wrapper solution like Float which takes in any datatype possible to convert and returns a float,
Ex:
x = 7
y = Float(x)

Describe alternatives you've considered
Automatic conversion to other datatype while dealing with operations. Like when adding float and int the result needs to be returned in higher precision like float here.

Additional context
image

to_f24, to_i24 and to_u24 do type casting for native numbers, is that all you need?

Yes, that would be of great help.

Yes, that would be of great help.

They already exist

Thank you so much for the information.