Re: [fpc-pascal] Why the difference in the rounded results?
Hi, Silly question: Were all compiled an executed in the same computer and operating system? Also, were all compilations done with same optimization configuration? It is well known that different CPUs have differences in some operations, specially DIV ones that even introduced bugs in the past (i.e. the infamous Pentium DIV). Also different compilers may introduce different configurations about math processing if you didn't set one (i.e. using the "default" CPU). Maybe some assume Pentium (so it should workaround DIV operations) and other don't. Also if it was compiled in a way that doesn't use the CPU math operations different operating systems/library versions may have different implementations for the same operation. Regards, Guillermo Martínez. El Fri, 15 Oct 2021 11:49:59 +0200 Gabor Boros via fpc-pascal escribió: > Hi All, > > I got different results with 32bit vs. 64bit, 3.2.2 vs. 3.3.1, FPC > vs. Delphi. Why? > > var >d1,d2:Double; > > begin >d1:=20.5; >d2:=1.05; >Writeln(RoundTo(d1*d2,-2)); >Writeln(SimpleRoundTo(d1*d2)); >d1:=28.9; >Writeln; >Writeln(RoundTo(d1*d2,-2)); >Writeln(SimpleRoundTo(d1*d2)); >d1:=21.5; >Writeln; >Writeln(RoundTo(d1*d2,-2)); >Writeln(SimpleRoundTo(d1*d2)); >Readln; > end. > > - FPC 3.2.2 Win32 > > 2.1531E+001 > 2.1531E+001 > > 3.0340E+001 > 3.0340E+001 > > 2.2570E+001 > 2.2570E+001 > > - FPC 3.2.2 Win64 > > 2.1523E+001 > 2.1531E+001 > > 3.0347E+001 > 3.0351E+001 > > 2.2574E+001 > 2.2578E+001 > > - FPC 3.3.1 Win32 > > 2.1531E+001 > 2.1531E+001 > > 3.0340E+001 > 3.0340E+001 > > 2.2570E+001 > 2.2570E+001 > > - FPC 3.3.1 Win64 > > 2.1523E+001 > 2.1531E+001 > > 3.0347E+001 > 3.0351E+001 > > 2.2574E+001 > 2.2578E+001 > > - Delphi 10.4.2 Win32 > > 2.153000E+0001 > 2.153000E+0001 > > 3.034000E+0001 > 3.034000E+0001 > > 2.258000E+0001 > 2.258000E+0001 > > - Delphi 10.4.2 Win64 > > 2.152000E+0001 > 2.153000E+0001 > > 3.034000E+0001 > 3.035000E+0001 > > 2.258000E+0001 > 2.258000E+0001 > > Gabor > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Hello, new Pascal programmer. had a question!
Hi Joseph, Besides all other answers, once you have a (Turbo) Pascal basis you can read "Modern Object Pascal Introduction for Programmers" [https://castle-engine.io/modern_pascal_introduction.html]. It will show you old and new stuff. Regards, Guillermo "Ñuño" Martínez El Fri, 27 Aug 2021 16:01:38 -0400 joseph turco via fpc-pascal escribió: > Hello all, > > I am a new programmer, and I thought I'd learn Pascal. I saw that with > FreePascal, most users are using Lazarus. I don't want to use this and > would rather work in the console, and use the free pascal IDE. I'm not > really interested in using any GUI tools. I was looking for a book > that teaches free pascal without the GUI stuff, that has a lot of > examples in it, but i cannot find anything of the sort. This has made > me turn to Turbo Pascal books, and i am currently reading "Learn > Turbo Pascal in three days". When i use the free pascal IDE to write > code, and compile it, i have no issues. When i go to run my program, > any text i have printed, will mix in with the terminal/console text, > and doesn't just print at the bottom like i would expect. This has > made me turn to using emacs, and then just compiling the code in the > terminal using "fpc -Mtp ". My question is, id like to > use the free pascal IDE, and learn the more modern(?) form of pascal, > but i cannot find a resource for beginners that will teach me with a > lot of examples, and not walls of text, just for non-GUI > applications. Does anyone know if such a book exists? Many thanks! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How does FPC perform in the FASTEST Computer Language Race
Hi, I remember years ago a similar test in a web page. Pascal was way low in the list, even below Java and Python! but we (in a forum) found that it wasn't Pascal fault: most versons program were optimised in code while Pascal used brute force (also compiling using -O3 made it way faster than the web proclaimed so we suspect they used -O- or even worse a relic compiler [Turbo Pascal 1?]). Once fixed it was almost unoticeably behind C in both FPC and Delphi (Delphi result was a bit faster). Anyway I haven't seen the video yet. Regards, Guillermo "Ñuño" Martínez El Fri, 9 Jul 2021 10:40:55 -0700 Wayne Sherman via fpc-pascal escribió: > If you are a speed geek, you will probably be interested in this. > > What is the FASTEST Computer Language? 45 Languages Tested! (E01) > https://www.youtube.com/watch?v=tQtFdsEcK_s > > Current standings at the time of this video > Iterations per sec: > Ada: 67 > Pascal: 143 > Fastest language: 7301 > Slowest language: 1 > > "HD Episode 01: Retired Microsoft engineer Dave Plummer takes you on a > guided tour of 45 different computer languages and drag races each > against one another using a prime sieve benchmark. From Ada to Zig > and everything in between, find out which is fastest and which is > slowest." > > Github: https://github.com/PlummersSoftwareLLC/Primes > > Current Pascal code: > https://github.com/PlummersSoftwareLLC/Primes/tree/drag-race/PrimePascal/solution_1 > Current Delphi code: > https://github.com/PlummersSoftwareLLC/Primes/tree/drag-race/PrimeDelphi/solution_1 > > Pull requests for faster/better implementations: > https://github.com/PlummersSoftwareLLC/Primes/pulls > > Related: > https://components4developers.blog/2021/07/04/delphi-sieve-candidates-to-the-fastest-programming-language-contest/ > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Interruption handling on i8086
El Sun, 11 Apr 2021 00:26:39 +0200 Sven Barth escribió: > That revision wasn't merged to 3.2.x, so it's not fixed in the RC. > I've now done so, thus it should be in the final 3.2.2. Thanks Sven. I was about to ask at Lazarus forums right now. :) > > Regards, > Sven Regards, Guillermo "Ñuño" Matínez ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Interruption handling on i8086
Hi, Tomas. El Sat, 10 Apr 2021 16:05:28 +0200 Tomas Hajny via fpc-pascal escribió: > > Hi, > > I believe that you need to add the "far" modifier after the > "interrupt" - at least this has been the case with TP/BP and is > probably needed at least for some memory models supported with FPC > for i8086. The {$F+} directive as mentioned in your later post is an > alternative, but not needed for the whole program (it might make it > less efficient). I don't know if there are any other caveats. > > Tomas It was long ago since I did my latest DOS 16bit program with Turbo C/C++ 2.0 so I forgot the "far" modifier. Thank you to make me remember it. Now I remember I have to use it with Large and Huge, not sure about Medium but I'll look for documentation. I'll also look for the {$F+} directive to know how it behaves with Tiny and Compact models. Regards, Guillermo "Ñuño" Martínez. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Interruption handling on i8086
El Sat, 10 Apr 2021 10:42:12 +0200 Christo Crause escribió: > On Sat, Apr 10, 2021 at 10:14 AM Guillermo via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > Hi pascaloids, > > > > I'm doing DOS development for fun and, after installing the compiler > > (was quite hard), I'm having problems handling interrupts. > > > > I started with keyboard and it doesn't work. The handler > > declaration: > > > > procedure DOS_KbdHandler; interrupt; > > > > but compiler says: > > > > keybrd.inc(14,29) Warning: Calling convention directive ignored: > > "OldFPCCall" > > > > This was fixed in trunk rev 39838 ( > https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/pdecsub.pas?r1=39703=39838), > but so far the fix didn't make it into a release yet. At least for > AVR the warning can be ignored. Not sure why your code doesn't work > properly on i8086 though. So it whould be fixed in 3.2.2. Maybe I should install the RC and test it. Thanks for the note. Guillermo "Ñuño" Martínez ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Interruption handling on i8086
El Sat, 10 Apr 2021 11:35:18 +0200 Marco Borsari via fpc-pascal escribió: > Il 09/04/2021 19:56, Guillermo via fpc-pascal ha scritto: > > Hi pascaloids, > > > > I'm doing DOS development for fun and, after installing the compiler > > (was quite hard), I'm having problems handling interrupts. > > I have this handler from SWAG, hope it would be helpful. > Marco Thanks for the code snippet. It is quite similar to mine, but in Assembler. I'll test it (specially the "{$F+}" thing that I didn't know about). Guillermo "Ñuño" Martínez ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Interruption handling on i8086
Hi pascaloids, I'm doing DOS development for fun and, after installing the compiler (was quite hard), I'm having problems handling interrupts. I started with keyboard and it doesn't work. The handler declaration: procedure DOS_KbdHandler; interrupt; but compiler says: keybrd.inc(14,29) Warning: Calling convention directive ignored: "OldFPCCall" When running the program in DOSBox it just executes the interruption once when I press any key and then the interruption doesn't executes anymore. I thought the compiler doesn't manage the interruption enter/exit stuff properly (since it says the calling convention was ignored) so I tried to add the "CLI" and "STI IRET" by myself, but the compiler sayd: keybrd.inc(21,7) Error: Instruction not supported by the selected instruction set The instruction not supported is IRET. BTW, I tried the same thing for DOS 32bits (with all the GO32V2 stuff) and it worked as expected. I've attached both 16bits and 32bits code, complete with initialization, handling and finalization. Do anybody see what I'm doing wrong? How can I fix it? Guillermo "Ñuño" Martínez keyb16.inc Description: Binary data keyb32.inc Description: Binary data ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal