There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

Thyrian , in Apple donation

Was propapbly an emberassed employee paying it out of his own pocket, just pretending his company would even care a tiny bit.

TheTetrapod ,

The last time this was posted, people were speculating that Apple does donation matching for employees, so they only did this unconsciously.

Schmeckinger ,

Last time this was posted someone said apple matches employee donations and someone probably donated 24 and apple matched it.

PP_BOY_ ,
@PP_BOY_@lemmy.world avatar

$5-24*

But yeah, this is 100% the case of Apple matching an employees donation

RustySharp ,

Or, someone donated 2.5-12, Apple matched it and filed the whole thing under their corporate account.

sbv , in Apple donation

freebsdfoundation.org/our-donors/donors/?donation…

$250-$499 range.

Meanwhile BlackBerry donated in the $10k+ range. 🤣

Aatube ,
@Aatube@kbin.social avatar

but blackberry doesn't donate or make systems anymore...

sbv ,

Apparently they have cash enough to donate. 🤷

Aatube ,
@Aatube@kbin.social avatar

<del>No, I'm saying they aren't in the donors list either</del> Oh wait I just saw they're in the partners zone, nevermind!

Kolanaki , in Apple donation
@Kolanaki@yiffit.net avatar

$24?

Surely it was only $5.

RiikkaTheIcePrincess ,
@RiikkaTheIcePrincess@kbin.social avatar

"It won't go lower than $5!"
"Uuugghhh, fine, give them five."
"Alright, we're on the supporters list"
"Great, issue a press release telling everyone how great we are for giving back."

burgersc12 , in me_irl

Panicked at the library and can’t sleep? Isn’t that just a normal college Tuesday?

Kolanaki , in me_irl
@Kolanaki@yiffit.net avatar

I also panic when I can’t sleep.

AnomalousBit , (edited ) in Programming Languages as Essays

If you’re struggling to read Ruby, you probably aren’t going to read any of the other languages on this list. That’s the real humor! 😂

Aatube , in Apple donation
@Aatube@kbin.social avatar

This was either inspect-element'd or made before March 2019. Apparently Apple (or its employees) donate little by little over each year. Here are the total donation records:

2023: $250-499 (so far)
2022-2021: $1,000–$4,999
2020: $250-499
2019-2018: $1,000-4,999

Made me laugh out loud though at least, right hand side mspaint comic is well-made

tiredofsametab , in me_irl

Can't sleep, the borrow checker will eat me
Can't sleep...

MrClayman , in Programming Languages as Essays

LaTeX gang rise up

superfes , in 0.30000000000000004

Of all the garbage I was happy to not see on Lemmy…

empireOfLove , in 0.30000000000000004

Well just don’t ask a Pentium processor for it either…

Psythik ,

4195835/3145727 = 1.333739068902037589

slazer2au ,

Yes fellow program, Harbinger is the next stage in our evolution.

nixfreak ,

This is why ceiling and floor was invented.

empireOfLove ,

But where are the walls?

xigoi , in 0.30000000000000004
@xigoi@lemmy.sdf.org avatar

If you’re working with floating point, you should be aware it’s just an approximation.

kevincox ,
@kevincox@lemmy.ml avatar

People think floats are too magical. Calling it an approximation is sort of leaning into this. Floats have limited precision like every other fixed size representation of a number.

This is sort of saying that integers are an approximation because int(1.6) + int(2.6) = 5. What do you mean‽ Clearly 1.6 + 2.6 = 4.2 ~= 4!

Floating points can’t perfectly represent 0.1 or 0.2 much like integers can’t represent 1.6. So it is rounded to the nearest representable value. The addition is then performed perfectly accurately using these values and the result is the rounded to the nearest representable value. (Much like integers division is “rounded”). That result happens to not be equal to the nearest representable value to 0.3.

It is definitely a bit surprising. And yes, because of rounding it is technically approximate. But the way people talk about floating point makes it sound like it is some nebulous thing that gives a different result every time or just sort of does the correct thing.

r00ty Admin ,
r00ty avatar

I think specifically, they have amazing precision. But the boundaries just don't fall perfectly on round numbers we humans would expect. That's what gets people confused.

Rounding can resolve these problems, or don't use float if you don't need to.

merc ,

The difference is that when you input a specific, precise floating point number, the number that’s stored isn’t what you entered.

When you enter integers and store them in ints, as long as the number is small enough, what’s stored is exactly what you entered.

If you tell your program that the radius of the circle is 0.2 units exactly, it says OK and stores 0.200000000000000011102230246251565404236316680908203125.

Of course everybody knows that there’s a limit to how many digits get stored. If you tried to store Pi, there’s obviously some point where it would have to be cut off. But, in life we’re used to cutting things off at a certain power of 10. When we say Pi is 3.14 the numbers after the 4 are all zero. If we choose 3.14159 instead, it’s the numbers after the 9 that are zero. If we represent these as fractions one is 314/100 the other is 314159/100000. The denominator is always a power of 10.

Since computers are base 2, their denominator is always a power of 2, so there’s a mismatch between the rounded-off numbers we use and the rounded-off numbers the computer uses.

psud , in 0.30000000000000004

If working in currency, work in cents and divide by 100 and round to 2 decimals for output

Jajcus ,

If working with currency use types and formating functions appropriate for currency. Not float.

psud ,

I was recalling a project in perl, which doesn’t have a variety of types. If you add values, you get a scalar, which will be a float if the numbers are not integers.

I am aware my statement isn’t true in several languages

IWantToFuckSpez ,

Yeah round down and transfer the remainder to an account you own.

psud ,

Indeed, Lex

elbarto777 ,

No, not Lex. Gus!

Awesome movie, regardless!

psud , (edited )

I just recalled, in that project I did have to divide money, which would leave fractional cents

It was a budgeting program, I could put rogue cents where I liked. I think my solution made accounts due $12.553333333… (internally 1255.3333…) each pay period get 12.54, so after n/3 pay periods they’d be 2n cents over. I could deal with that imprecision.

redcalcium ,

Some programming languages use different rounding method. Might bite you in the ass if you’re not aware of it and using multiple programming language in your application to handle different areas.

janAkali ,

Most languages have decimal libraries to correctly handle floating point arithmetics, where precision is necessary.

Slotos ,

They are as incapable of handling one third of a dollar as binary positional notation is incapable of handling one fifth (0.2).

It’s not really a float problem. It’s a positional notation one. Some perfectly rational numbers refuse to squeeze into that mold.

szczuroarturo ,

Also decimal system is not exatcly that much better since you also cant write 1/3 in decimal

MJBrune ,

Even then that can contain bugs on large amounts.

CanadaPlus ,

You’re telling me there’s someone that has more than 20 million dollars? /s

If you’re handling people’s money you should probably be using arbitrary-precision arithmetic. I mean, you might get away with a long int, but finance is serious business and the amount of data you’re going to be processing relative to your funding is probably going to be small.

psud ,

Not the project I was thinking about above, but at work my team delivered software handling 13 digit numbers, but that’s in COBOL which does fine with money

Zikeji ,
@Zikeji@programming.dev avatar

That’s what I wound up doing on a work project. Works really well.

Buckshot ,

And remember not all currencies are 2dp so get a list and use the appropriate exponent.

I had to update our currency database this week because there’s new currencies. It’s almost as bad as timezones.

ruk_n_rul ,

[email protected] wake up, new currencies just dropped

maniel , in 0.30000000000000004
@maniel@lemmy.ml avatar

Python?

magic_lobster_party ,

IEEE 754

tetris11 , in 0.30000000000000004
>>> 0.1 + 0.2
0.30000000000000004
>>> 1e16 * (0.1 + 0.2)
3000000000000000.5

Yes.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines