Recent

Author Topic: Conversion StrToFloat  (Read 1145 times)

coffee

  • Newbie
  • Posts: 2
Conversion StrToFloat
« on: October 01, 2022, 08:27:05 am »
Why is it StrToFloat instead of StrToReal? the data type declared is Real
What do you prefer guys? Im just curious why follow C languange :)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Conversion StrToFloat
« Reply #1 on: October 01, 2022, 11:07:04 am »
The Turbo Pascal era mostly said real. In Delphi time, the *float functions appeared.

Maybe real had gotten tainted because of real48, the emulated floating point type.

So yes, historical reasons. My guess would be that the terminology came from the FPU (x87) world, not necessarily C directly.
« Last Edit: October 03, 2022, 09:28:00 am by marcov »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Conversion StrToFloat
« Reply #2 on: October 12, 2022, 11:35:46 am »
I thought it was meant to be used alongside math unit's Float type, but apparently StrToFloat returns Extended instead, completely unrelated to math since sysutils itself doesn't use math.

 

TinyPortal © 2005-2018