Re: [fpc-pascal] Writing Pascal Physics and Vectors

2021-10-15 Thread Darius Blaszyk via fpc-pascal
Hi Anthony, Can you put the link up to the source code please? Rgds, Darius Sent from my iPhone > On 16 Oct 2021, at 00:27, Anthony Walter via fpc-pascal > wrote: > >  > I've been working on writing Pascal bindings a friendly object orient > interface to a few open source projects. I have

Re: [fpc-pascal] string vs char

2021-10-15 Thread Ralf Quint via fpc-pascal
On 10/15/2021 3:16 PM, Ched via fpc-pascal wrote: Well, well, understand. OTOH, declaring a string of length 1 is sort of futile -- it uses two bytes where a plain char declaration takes just one byte. Not so futile as a string can be empty, not a char ! Well, if you don't like it being ca

Re: [fpc-pascal] Writing Pascal Physics and Vectors

2021-10-15 Thread Anthony Walter via fpc-pascal
I often use squares / cubes and such like: X := X * X * X; When I am unsure how much steep of a curve I want. I just add / remove X and run the test to see if the curve looks good. It's just a preference thing and considering the other processing intensive stuff going on, I am sure it doesn't mak

Re: [fpc-pascal] Writing Pascal Physics and Vectors

2021-10-15 Thread Anthony Walter via fpc-pascal
> > I have writen my own fairly extensive game engine and this will be > integrated into it sometime soon. My thought was it would be more useful to > create a minimal version first that other people could evaluate and test > more easily. ___ fpc-pascal m

Re: [fpc-pascal] Writing Pascal Physics and Vectors

2021-10-15 Thread Ched via fpc-pascal
> Fade := Fade * Fade * Fade * Fade * Fade; Why not Fade:=sqr(sqr(Fade))*fade ? Cheers, Anthony, Ched Le 15.10.21 à 22:18, Anthony Walter via fpc-pascal a écrit : I've been working on writing Pascal bindings a friendly object orient interface to a few open source projects. I have put toget

Re: [fpc-pascal] Writing Pascal Physics and Vectors

2021-10-15 Thread DougC via fpc-pascal
I would be helpful if you could meld this work into other Pascal-based efforts, such as the Castle Game Engine. I don't know the details of CGE but if it could use more of this type of functionality, why not make your work even more useful by connecting up with CGE? Doug C. On Fri,

[fpc-pascal] Writing Pascal Physics and Vectors

2021-10-15 Thread Anthony Walter via fpc-pascal
I've been working on writing Pascal bindings a friendly object orient interface to a few open source projects. I have put together Chipmunk2D, NanoVG, MiniMP3, and SDL2 for rendering nice real time platform independent programs where fast logic can be easily controlled with physics or fast graphics

Re: [fpc-pascal] string vs char

2021-10-15 Thread Ched via fpc-pascal
Well, well, understand. OTOH, declaring a string of length 1 is sort of futile -- it uses two bytes where a plain char declaration takes just one byte. Not so futile as a string can be empty, not a char ! Regards, Dennis, Ched' ___ fpc-pascal mailli

Re: [fpc-pascal] Why the difference in the rounded results?

2021-10-15 Thread Guillermo via fpc-pascal
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 (

Re: [fpc-pascal] Why the difference in the rounded results?

2021-10-15 Thread Ched via fpc-pascal
Hello All, In https://wiki.freepascal.org/Variables_and_Data_Types about Strings: // where: 1 < length <= 255 is to read as // where: 1 <= length <= 255 isn't it ? Cheers, Ched Le 15.10.21 à 18:44, James Richters via fpc-pascal a écrit : The difference is because of the way floating point

Re: [fpc-pascal] Why the difference in the rounded results?

2021-10-15 Thread James Richters via fpc-pascal
The difference is because of the way floating point math works.. and how rounding works. Rounding something that ends with 5 is ambiguous, because it could round up, or it could round down... You can control the behavior of rounding with SetRoundMode(); See https://www.freepascal.org/docs-html/r

[fpc-pascal] Why the difference in the rounded results?

2021-10-15 Thread Gabor Boros via fpc-pascal
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));