• 1 Post
  • 84 Comments
Joined 1 year ago
cake
Cake day: November 24th, 2023

help-circle

  • Good and bad use-cases for floats

    Floats can be used everywhere where it doesn’t matter that you can’t store a 100% accurate base ten representations. For example positions and speeds in 3D games and animations, “analog” values like temperatures, speed of a vehicle, geo positions with longitude and latitude, a persons weight or heart pressure. In fact if you develop games there is no way around 32 bit floats because GPUs are f32 number crunching beasts. Modern 3D games wouldn’t be possible without all those fast f32 calculations.

    You shouldn’t use binary floats if you need or expect accurate base ten calculations (addition, subtraction, multiplication, - note that divisions also introduce errors quickly in decimal types) and for dimensions that have a smallest unit that can’t be broken down, for example like money. If you need to handle money just store the amount of cents as integers and only divide by 100 in your display function.

    This is exactly my point. Don’t use floats when you need to get accurate stuff, but use it when you need a “feel” for it








  • I think they are referring to crates vs binaries vs cargo binaries.

    Crates are your libraries, not meant to be standalone, binaries are your .exe, cargo binaries are meant to be compiled by cargo on your machine and run through cargo, ex: cargo sqlx

    They might also refer test binaries and example binaries which are two executables that only compile the tesrs and the examples to make sure they work, but apart from that idk






  • I hate AI, but here it’s a bit understandable why copilot says that. If you ask the same thing to someone else they would surely respond 2 as they my imply you are trying to spell the word, and struggle on whether it’s one or two R on the last part.

    I know it’s a common thing to ask in french when we struggle to spell our overly complicated language, so it doesn’t shock me






  • There’s a difference between helping people with misunderstanding a tool and belittling them for being wrong. It’s just a matter of wording that separate an helpful answer from a toxic one

    I could tell you “You should actually use Y instead of X. They are numerous benefits like A, B and C. The doc actually have a great example you may have missed or not understood it was for this purpose. It will help you a lot more than what you are thinking of doing.” And this would be fine.

    But “Just use Y. X is bad because Y is made for that. You not willing to use Y shouldn’t make you do X. There’s even a the first Google link on how to do it” isn’t fine.

    And I have not belittled them at all. I have said that it wasn’t what I was looking for. A lot of times people post questions they think should solve their issue, but only to realise that they didn’t fully understand the full picture and theirs problem is on a larger scale.