Search found 10 matches

by PurePilish
Thu May 29, 2025 6:53 am
Forum: Coding Questions
Topic: Round(0.51, #PB_Round_Nearest) <> {debug integer 0.51}
Replies: 17
Views: 2356

Re: Round(0.51, #PB_Round_Nearest) <> {debug integer 0.51}

AZJIO -

That's because it's banker's rounding, as previously established in this thread (correct?). When the fractional part is 0.5, banker's rounding rounds up if the integer part is odd and rounds down if the integer part is even. Your x1 has even integer part and x2 has odd integer part, hence ...
by PurePilish
Mon Mar 31, 2025 12:48 am
Forum: Coding Questions
Topic: Calculating with large numbers (Fibonacci)
Replies: 13
Views: 965

Re: Calculating with large numbers (Fibonacci)

Jacobus -

You wrote "...and using a double instead of an integer gives the correct results."

That's not really true. The integer version of the code (2 posts ago) gives the exactly correct answer up to the 92nd Fibonacci number. The double-precision code (previous post) only gives the exactly ...
by PurePilish
Sat Jan 25, 2025 12:35 am
Forum: Coding Questions
Topic: Whats the best way to check mouseclick locations in window
Replies: 4
Views: 1215

Re: Whats the best way to check mouseclick locations in window

With today's GHz processors, 100 is a small number, so I would guess that it is not a problem (and simple) to test the mouseclick coordinates against an array of rectangle coordinates. Of course that can be made more sophisticated, but a simple loop over all 100 possibilities is not unreasonable. I ...
by PurePilish
Sat Jan 04, 2025 9:38 pm
Forum: Coding Questions
Topic: number to letter conversion
Replies: 9
Views: 4424

Re: number to letter conversion

Hi, I found this online:

https://devforum.roblox.com/t/coding-challenge-1-numbers-to-french/500012

At the bottom of the first post, click on "Here is the answer", and then scroll to the bottom of the first post in that thread where the full code is listed. It's in the Lua language but looks easy ...
by PurePilish
Sun Dec 01, 2024 11:31 pm
Forum: Coding Questions
Topic: Help with GRABIMAGE
Replies: 7
Views: 1197

Re: Help with GRABIMAGE

It is not surprising that both dithering and using 4-bit depth add a lot of time to PNG compression. I doubt that it is a bug, it's just that those operations are expensive. As others have said, you can probably solve it by saving as JPG, or saving as PNG without dithering and using 24 or 32 bit ...
by PurePilish
Thu Nov 14, 2024 9:17 am
Forum: 3D Programming
Topic: Capping frame rate in 3D
Replies: 5
Views: 3760

Re: Capping frame rate in 3D

Thanks a lot, miso - that really helps. Very nice solution, and I like that the other operations can happen at a higher frequency than the renders.
by PurePilish
Tue Oct 29, 2024 7:36 am
Forum: 3D Programming
Topic: Capping frame rate in 3D
Replies: 5
Views: 3760

Re: Capping frame rate in 3D

Oh, I see. Was just starting to read up on 3D and hadn't noticed that FlipBuffers() is used with RenderWorld(). That answers my question, thanks.
by PurePilish
Tue Oct 29, 2024 1:37 am
Forum: 3D Programming
Topic: Capping frame rate in 3D
Replies: 5
Views: 3760

Capping frame rate in 3D

I know about SetFrameRate(), which limits (on the upper end) the frame rate of FlipBuffers() in 2D, but it seems there is not an equivalent function for 3D (to limit the number of times RenderWorld() is called per second). Do I have to implement this frame rate cap myself? If so, what's the "best ...
by PurePilish
Mon Oct 07, 2024 9:15 pm
Forum: Coding Questions
Topic: Confusion about WindowEvent and FlipBuffers
Replies: 4
Views: 689

Re: Confusion about WindowEvent and FlipBuffers

miso/infratec - Thank you for the replies, they are helpful. I understand how double buffering works, but it is still unexpected that checking for events changes whether a FlipBuffers() is required. Perhaps it is because I'm checking for events inside a StartDrawing / StopDrawing block? Anyway, I ...
by PurePilish
Mon Oct 07, 2024 9:46 am
Forum: Coding Questions
Topic: Confusion about WindowEvent and FlipBuffers
Replies: 4
Views: 689

Confusion about WindowEvent and FlipBuffers

Hello, all. I'm a new user of PB on Windows (only 1 or 2 weeks), but an experienced programmer. The program below is a toy version of something I've been working on. The FOR loop simulates the fact that my real program will have a need, every so often, to draw graphics that will take some time, say ...