Why does FloatToStr exist if Delphi does not have the Float data type?

3

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

In this case, could you use a floating-point variable of any kind, and would the function handle the conversion correctly?

    
asked by anonymous 31.07.2018 / 22:45

1 answer

4

There is a programmer who has difficulty naming things. Actually it's kind of normal among people in general, it even has a quote that the two most difficult things in computing is invalidating cache and naming stuff.

I can not say why they did this, but for me it's just a way of trying to name a few 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 quite funny:)

Free Pascal Documentation .

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

    
31.07.2018 / 22:55