Recent

Author Topic: real48 zero becomes two as Double  (Read 2357 times)

roeug

  • Jr. Member
  • **
  • Posts: 67
    • http://roeug.50megs.com/
Re: real48 zero becomes two as Double
« Reply #15 on: September 11, 2023, 07:26:41 am »
Thank you. Yes it was old (initially delpi2.0 16-bit?) data file with real48 records in common use. Think to bruitDouble it next summer vacations.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: real48 zero becomes two as Double
« Reply #16 on: September 11, 2023, 11:13:23 am »
It is not THAT old, the compatibility stems from 2016: https://forum.lazarus.freepascal.org/index.php/topic,33636.msg224802.html#msg224802

I have a fix but need a test. Enkin wrote the original code but I contributed some.
The unit was only meant to provide some compatibility for old data, never to do everything.
Simply never use real but double. Unless you are using very, very old code.
« Last Edit: September 11, 2023, 11:15:24 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Curt Carpenter

  • Sr. Member
  • ****
  • Posts: 402
Re: real48 zero becomes two as Double
« Reply #17 on: September 11, 2023, 04:41:58 pm »
Should Real48 be added to the FPC documentation too?
You mean, like this ?

I was thinking more like this:  https://www.freepascal.org/docs-html/ref/refsu5.html

I suspect that the desire to use Real48 would be rare (maybe in embedded applications?), but perhaps not zero.
« Last Edit: September 11, 2023, 04:50:50 pm by Curt Carpenter »

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: real48 zero becomes two as Double
« Reply #18 on: September 11, 2023, 05:37:48 pm »
I suspect that the desire to use Real48 would be rare (maybe in embedded applications?), but perhaps not zero.
It is definitely not relevant for embedded, but only for older TurboPascal code:
This came up on this forum and efforts were made to provide at least a reasonable and sensible set of support, mainly to do conversions to more modern types.
It ended up somewhat, but not totally, complete but it has issues because it is not often used and therefor lack much testing.
That is clear because since 2016 the bug did not come up before.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Curt Carpenter

  • Sr. Member
  • ****
  • Posts: 402
Re: real48 zero becomes two as Double
« Reply #19 on: September 11, 2023, 05:48:22 pm »
Embedded applications are the only ones I can think of off the top of my head that might use a CPU without a built-in math coprocessor, and have tight memory constraints that merit a shorter real type and emulation.  Can you think of others?

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: real48 zero becomes two as Double
« Reply #20 on: September 11, 2023, 07:25:56 pm »
Well, if you mean a scaled integer to represent a float value where an FPU is missing, you are correct.
But I am not aware of sane applications that use real48 on its own other than legacy TP or even older versions of Pascal and even then it is only to be able to read (or write) legacy data in the correct format.

But still it is a bug. I will write a fix proposal in the weekend.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018