Why is there FloatToStr if Delphi doesn't have the Float data type?

Question:

Reading about Delphi/Pascal data types I noticed that there is no Float type, however there is a FloatToStr() function as well as StrToFloat() .

In this case, could I use a floating point variable of any type and the function takes care of performing the conversion correctly?

Answer:

There are programmer who have difficulty naming things. It's actually kind of normal among people in general, there's even a quote that the two hardest things in computing are invalidating caches and naming things.

I can't say why they did this, but for me it's just a way of trying to name a lot of things and make the function more discoverable by having some overloads.

In fact what it does is work with several types that have decimal part, with floating point or not, which is really funny 🙂

Free Pascal Documentation .

Another curious thing is that the function that creates a floating point type is unique, which shows that whoever did it wasn't thinking very well about the problem. Documentation .

Scroll to Top