Why does Floattostr exist if Delphi does not possess the Float data type?

Asked

Viewed 180 times

4

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

In this case, you could use floating point variable of any type and the function is in charge of performing the conversion correctly?

  • 2

    Exactly, any type of floating point will be converted.

1 answer

6


There are programmers who have trouble naming things. Actually it’s kind of normal among people in general, there’s even a quote that the two hardest things in computing is to invalidate cache and name things.

I can’t tell you why they did it, but for me it’s just a way of trying to name a lot of things and make the function more discoverable by having a few overloads.

In fact what it does is it works with various types that have decimal, floating point, or not, which is pretty funny :)

Documentation of Free Pascal.

Another curious thing is that the function that creates a kind of floating point is unique, which shows that whoever did it was not thinking very well about the problem. Documentation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.