Is this really what it has come to?

Anybody know what's even going on here?

Attached: CockFuckery.gif (514x310, 3K)

Both of them equal = 0.424135178021501 but somehow they still aren't the same. Wtf?

its possible that one is being truncated due to the 'one' variable but not sure

What language is this?

javascript doesn't have this problem

Attached: js.png (453x53, 8K)

The weird thing is this trick only works with these exact numbers. If I cange the 6's to anything else it won't work. If I change the 7's to anything else it wond work. If I change the order of sin's & cos's it won't work.

This looks like intro to programming floating point comparison stupidity.

javascript has other problems lad

Attached: this_is_the_power_of_javascript.png (274x85, 8K)

How do you explain (1*6) causing a difference when compared to (one*6) where one = 1? We are dealing with integers here

welcome to compoopers, OP
>>> one = 1
>>> epsilon = 1E-8
>>> abs(math.sin(math.cos(1*6)*7) - math.sin(math.cos(one*6)*7)) < epsilon
True

Attached: 2391ace1004b34a1258a440d3577dddd.jpg (1900x2000, 281K)

What are you implying here?

that you should not check for equality when dealing with floating point

it works on my machine

Attached: 2018-12-03_x.png (437x224, 11K)

>I don't understand floating point

Are they actually integers? What language are you using? lots of scripting langs don't have real integers.

He's implying

>no language and version of the runtime stated
Fuck off retard.

2 shitty floats generated by what should be the same code, should be the same.

t. Pajeet

I think it's about time you go prep your bull. Maybe if you're lucky he'll teach you how to program in Elm

Attached: cucks_will_defend_this.png (95x97, 4K)

>wahh wahh why won't my language hand hold me

Print them and see what the difference is.

Why do you assume a numeric literal and a run-time var would be the same in whatever shitty lang OP used?

If they aren't then that lang is garbage. So lets just blame OP

int a = 1;
printf("%d\n", a == 1);

>OMFG UR SUCH AN IDIOT WHY WULD U ASSUME DAT A NUMERIC LITERAL AND A RUN-TIME VAR WULD BE DA SAME

Yeah yeah, Javascript has lax type coercion. Everyone knows that. Why did you expect 4.8998e-15 to be equal to 0 though?

This has literally nothing to do with type coercion you retard. The same thing would have happened if he used 2 instead of "1" = 1.

There's all kinds of nonsense that effect floating point results. Intermediate precision, registers, cpu flags, etc. The short of it is that floating point math is unreliable and you must use an epsilon in floating point comparison.

Okay everyone I discovered that it was indeed a compile-time idssue(cimpiler actually turned the first one with only the numbers, into this: 0.42413517802150097 , a more precide floatnumber, but when ran in runtime and interpreted it gave a "quick-float" (maybe 32-bit when compiler thought 64-bit?) conversion to the one with a var, which cut the thing it just barely to round up a bit and proquce and inequal sum)

>why would the sine of 2pi equal 0
the current state of CS brainlets

So basically... the complier didn't actually want the engine to perform that operation every time so it optimized it and looks like accidentally changed the format to incompatible one with the runtime... so the thing finally got sorted out

You were right all along man and I offically confirm it

>400921FB54442D18 is the same as pi
the current state of math brainlets

Okay, so you don't understand floating point. Got it.

You could've just said you don't understand floating point numbers. You entered a value that approximates pi, not the exact value of pi.

>"b-b-but muhh IEEE"
wew lad. JavaScript sucks, just admit it.
>sin(2pi) is an approximation of 0
brainlet status confirmed

Isn't the sin function Literally based off PI? At least in my math liberary specification it is

Stop trying so hard. Pretending to be retarded is such boring bait.

>4 lines of code
>6 different colors
Do people really do this?

Attached: OO.jpg (777x897, 207K)

floating point errors

Don't you wanna program in a wellcoming enviroment?

yeah. let's just sit back and watch everyone lose their minds. it is entertaining.