Re: [fpc-pascal] Floating point question

2024-02-09 Thread James Richters via fpc-pascal
>However, adding support for an option called -CFMax or similar should be no
problem.

It would be VERY much appreciated!

James

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Floating point question

2024-02-09 Thread Jean SUZINEAU via fpc-pascal

Le 09/02/2024 à 20:53, Jonas Maebe via fpc-pascal a écrit :
However, adding support for an option called -CFMax or similar should 
be no problem. 

It would be very nice to compile old code
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Floating point question

2024-02-09 Thread Jonas Maebe via fpc-pascal

On 09/02/2024 14:04, James Richters via fpc-pascal wrote:
Is there any way we can please get -CF80 or {$MINFPCONSTPREC 80} or some 
other way to turn off the new behavior for applications that use Extended.


The reason I didn't add it back then is because when parsing the 
options, there is no good way to get the maximum supported floating 
point precision by the target platform.


However, adding support for an option called -CFMax or similar should be 
no problem.



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] "Unexpected end of file" when having an open comment after the final "end."

2024-02-09 Thread Ralf Quint via fpc-pascal

On 2/8/2024 11:01 AM, Martin Wynne via fpc-pascal wrote:

Hi Thomas,

The error is not the file content after "end.".

The error is not having the expected "end;" after "begin".

This works ok:

_

program test;

begin
end;

end.

abc 123

_

Martin. 


This is not a valid Pascal source code to begin with (pun intended)...

The "begin" is the start of the actual Pascal program and by definition, 
that program is terminated by matching that with an "end." That's what 
the code completion in Lazarus for example is adding into a new "simple 
program" project source code.


Just adding a random "end;" should also just yield an error message...

Well, I actually did just tested this and it gives as expected an 
"Error: Syntax error,  "." expected but ";" found. It Doesn't even 
process past the "end." in that case.


What is however interesting is that an open comment, as mention by the 
OP,  immediately after the "end." results in the "Error: unexpected end 
of file" message, however any other addition text past that "end." will 
result in no error message and completing to compile the program 
successfully...


I just tried a couple more things, and it seems it is just the "{" or 
"(*" opening of a comment that is causing the error message, having a 
"//" comment until end of  line after the "end."  will also compile just 
fine



Ralf


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Floating point question

2024-02-09 Thread James Richters via fpc-pascal
>Because 1440.1 cannot be represented exactly as a single precision floating
point number. Nor as a double or extended precision floating point >number
for that matter, and in that case the compiler uses the maximum precision is
supported by the target platform.

I see that now, I think someone pointed out that 1440.5 would also be a
problem since it fits in a single.

So my idea of trying to change all the x.0s to x only helps some cases, not
all cases, as I can't change x.5 to anything quickly with a global search.
There could be anything that happens to fit in a single, making my Extended
calculation come out to a Single.

How does one get the old behavior for programs that use Extended without
analyzing and re-writing thousands of lines of code?

Is there any way we can please get -CF80 or {$MINFPCONSTPREC 80} or some
other way to turn off the new behavior for applications that use Extended.

James

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal