Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Yes, that is troublesome. But they will quickly learn.
You should probably double down on that point. Get real with them. -
@zlice someone said the typical design of the math coprocessor that handles floats semi natively is why we get strange run on quotients for example that don't make sense or when you add 1.01 + 2.005 sometimes you get 3.0250000000001
-
@AvatarOfKaine it's not an "issue". it's how computers work. the issue is your lack of understanding. https://floating-point-gui.de/
-
@AvatarOfKaine Why fix something that isn't broken? Other than financial records, float is fine the way it is. It's fine when used in game logics, graphic processing, 3D rendering, etc. It's fine because in most decimal numbers scenarios, we use > and < on them. We don't use ===.
-
People not thinking of basic things is a real problem indeed. So often it was the other way round, people telling me that float should not be used and suggested totally OTT data types ... for a max precision of 2.
-
hitko31462y@AvatarOfKaine Try to write down all the decimals of 12/7. Oh wait, there's infinitely many of them. Well guess fucking what, the same goes for 3/10 when you try to write it down in binary. There's nothing wrong with floats or computers, what's wrong is that your ignorant ass never bothered to look up how any of that works because "you don't need proper education, you can learn everything from online tutorials".
-
@zlice
If you think division and decimals are the bane of our math... You are in for a bumpy ride. -
@CodingTripledad
Even if your max required decimal precision is 2, if you want *exact* numbers, you should still use integers and scale by 1/100 only for display. -
@tosensei i will look at that however what is broken is two numbers that are supposed to be identical resulting from calculations end up having am entirely seperate identity. That's the problem. That an expression of equality that makes sense in all other math and is true somehow becomes false. Why must you people always oppose sense and reason so reflexively? I'd be moved on in life all over again with a healthy set of teeth and slender frame still if not for the bitter resentful crap you people did to me for no reason
-
@AvatarOfKaine because, as people keep telling you but you are oh so adamantly stubborn in not wanting to understand, what you say only holds over the set of real numbers.
IEEE754 does not, and never claimed to be isomorphic to R. It is merely a suitable approximation for many common use cases.
To begin with, some numbers are simply impossible to represent with your narrow definition of number. These are irrational numbers, such as pi or e. They are *real* numbers, and can be exactly defined and used. However, they can not be represented in base 10 notation without infinite decimals.
Infinite storage obviously doesn't exist, and thus, IEEE754 suffers from the same problem in its base 2 representations of numbers.
By definition, 32 bits can only hold almost 5000 million of discrete values. Real numbers, even in a bounded interval, are infinite.
It's not unintuitive, and it's not "broken". It's very basic math applied rather elegantly.
It's *you* choosing to be blind. -
@AvatarOfKaine what is broken is, simply, your understanding.
what you are complaining about translates to a carpenter complaining that his saw doesn't work, while he's holding a hammer.
floating points are only approximations of decimal numbers. which is verbosely explained in the floating point guide. and if you keep failing to grasp this, as stubbornly as you do now, you simply have no place in IT.
my recommendation: by hand, write down the numbers 0.1, 0.2 and 0.3 in binary. until you've completely written them down. when you're done, you can come back online. -
Also, before anyone roasts me, I know IEEE754 doesn't map to values like ints do, it's base 2 scientific notation, but the point still stands 😂
-
@tosensei again. I don't care what their Intended use is and again with the above mentioned intended uses there is error
Obviously you don't believe we should have a method of QUICKLY handling precise numbers since last I remember high precision libs and decimal types get the job done
Seriously why don't you suck up someone else's time with your sophisms and groundless reasons to argue -
@AvatarOfKaine
We *do* have methods to quickly and easily handle those, as you correctly said, decimal format libraries.
Seems to me it is you who gets lost in sophism and arguments.
If you don't think those are good enough and somehow want to make a breakthrough in Physics and discover a material or particle that can hold 10 stable different states at a whim so a magical base 10 computer can be built just so you can compile assert(0.1 + 0.2 == 0.3), be my guest.
I promise you I'll be the first one to second your Nobel prize nomination. -
@AvatarOfKaine obviously you are incapable of logical thought.
i do believe that there should be a way to handle precise _decimal_ numbers. but that's not important, since there are _many_ such ways. some of them described in the floating point guide. read it or leave it, but don't try to victimise yourself again because you're uncapable and/or unwilling.
seriously, why don't you suck up some therapists time with your inane jabber. -
@tosensei obviously you just look for every opportunity to Engage in repeat arguments.
The point I am making is the issue is one that I first encountered in 1995
You jumped down my throat about wishful thinking
So you want logic ?
Let's engage in a little behavioral analysis.
The most frequent person on here to antagonize me is you
You claim you don't like me
You claim to not respect me
And the most frequent words out of your whore mouth are telling me to take meds
Logic would suggest your personality is highly neurotic, you crave conflict, and must have very low self esteem to require consistent childish levels of feedback from someone you don't like.
Now that is face value
Adding everything you lie about makes me think you're a psychopath -
hjk10156962yIn JS it's fine to use that it's only for display right, not to do any calculations. That happens on a secure backend that should not use any floating point variables for any calculations that matter.
-
@hjk101 probably not; since currency display should typically use Banker's rounding. Printing a float directly won't do that. But I don't know JS space well, we're using JVM.
-
@AvatarOfKaine Noone fixed floats because they ain't broken, bro. There is just a trade-off between fast and precise when it comes to representing real numbers using binary.
IEEE standard is precise enough for most applications while being fast, so not broken. -
@CoreFusionX You're right, I should've been a bit more precise. Max precision is 2 and in a later process it gets transformed again and in that process is rounded, so in the end it's totally ok.
-
@hardCoding I will accept this answer which defines better instead of calling me stupid and telling me to fuck my dead mother.
Again it was wishful thinking
Besides
Way back in the day
There were only floats and integers -
hjk10156962y@Augmental for display floating point stuff just works (especially when you needed to work with locale stuff. However we use integer representation in cents or Millicent's when calculations are done. A tiny bit (accumulation for presentation) in front-end but almost everything is in back-end including the rounding.
My company deals in finances.
Part of our interview process is a coding challenge.
It is absolutely fascinating to me how few candidates point out that 'float' is an inappropriate data-type for currency. SMH.
rant
javascripts-legacy