[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 325
Thread images: 24

File: 1484817483506.jpg (47KB, 637x579px) Image search: [Google]
1484817483506.jpg
47KB, 637x579px
What are you working on, /g/?


Previous Thread: >>59725700
>>
>>59731178
For for C++ is for idiots.
>>
File: 1490484251913.jpg (32KB, 358x344px) Image search: [Google]
1490484251913.jpg
32KB, 358x344px
>>59731185
>Cirno is perfect
>C(irno)

>therefore, C++ cannot be an improvement of C

qed
>>
File: vbe3.png (144KB, 1057x1155px) Image search: [Google]
vbe3.png
144KB, 1057x1155px
>>59731178
low-level C++ is high-level comfy
>>
>>59731178
when will zen+ be available for purchase?
>>
File: IMG_1371x.jpg (229KB, 1024x768px) Image search: [Google]
IMG_1371x.jpg
229KB, 1024x768px
>>59731261
unfortunately it doesn't work though
it's crashing on this RETF here, that should be valid.
>>
>>59731261
>>59731305
How can it be comfy if it doesn't work?
>>
>>59731335
I'm sure my code works, the stupid rom code I'm calling doesn't.
>>
File: 1489687004832.jpg (169KB, 548x294px) Image search: [Google]
1489687004832.jpg
169KB, 548x294px
Does anyone here seriously still use Turing complete shitlangs?
>>
>>59731348
So, it doesn't work
>>
>>59731349
I only write software with no I/O. Who else /patrician/ here?
>>
>>59731424
Please answer the question.
>>
>>59731261
I'm thinking of using procedural-oriented C++ more and more until I reach true enlightenment.
>>
File: 1481661304967.jpg (54KB, 575x553px) Image search: [Google]
1481661304967.jpg
54KB, 575x553px
>my typechecker is finally working perfectly
>>
>>59731519
I'm pretty sure it's not.
This or the equivalent of this most likely typchecks in your language.
5 + fix (x -> x)
>>
Trying to set up a stack for our next project. Back end dev wants some RESTful asp.net thing and i (being the front end dev) want to try out npm with some of these _buzzword_ javascript libraries.

Started looking into renting a VPS - they all come with Linux. Which is fine by me since npm is very Linux friendly and i personally like working with CLI.

But mr back end is all asp.net and microshill so how do we make this work? (Note: I'm completely new to REST)

Two different servers? One building the front end single page application, sending out only index.html and scripts.js to the client; and the other one being a RESTful asp.net server.

Follow up quesiton on this: If we want user authentication (login), what's a proper way to approach this? Send credentials with each API request?

What about encryption; Can you establish a TLS connection with the back-end only? Credentials wouldn't touching the front end server in this case.

Im drowning in questions and I feel stupid. Should i just put npm + asp.net on the same server and deal with porting asp.net to linux?
>>
>>59731558
I don't see why that shouldn't typecheck, assuming you're giving fix the standard type ((a -> a) -> a)

In any case, my project language doesn't have fixpoints
>>
>overusing const for non-constants is just increasing meaningless visual noise
>returning bool and passing the real parameter out in a pointer is worse than raising an exception and using it for flow control
prove me wrong
protip: it's impossible because what I've said is 100% right
>>
>>59731586
>I don't see why that shouldn't typecheck
Because (+) doesn't have type (forall a : a -> a -> a) and because it's retarded.
>In any case, my project language doesn't have fixpoints
Any loop is pretty much the same from this standpoint.
>>
>>59731656
solution to #1 is purity
solution to #2 is monads
>>
>>59731675
inst (a = Int)
>>
File: 1459180993068.jpg (12KB, 306x306px) Image search: [Google]
1459180993068.jpg
12KB, 306x306px
>>59731656
>having non-constants in your language
>>
>>59731675
but fix (x -> x) has type (forall a.a) so you should be able to infer that the second argument be given type Int

and the language I'm writing is total so it doesn't have loops
>>
>>59731577
>Send credentials with each API request?
Look up OAuth or any other variation of token based authentication
>>
>>59731679
show me a gui application written in haskell that isn't absolutely garbage
>>
Would removing all looping from my language make it non-Turing complete?
>>
>>59731757
show me a gui application that isn't absolutely garbage
>>
>>59731757
Where did he say anything about H*skell?
>>
File: IMG_1374x.jpg (233KB, 1024x768px) Image search: [Google]
IMG_1374x.jpg
233KB, 1024x768px
>>59731400
Fixed it now.
I had to make a "short" far call with an m16:16 fword ptr. it was doing a long one with m16:32, then the retf from 16-bit rom code tried to pop an m16:16 pointer and failed.
I couldn't figure out the right syntax to do that in gcc asm, so I just inserted an opcode-size prefix:
".byte 0x66;"
"call fword ptr cs:[0];"

If anyone here knows the right syntax to do that, that would be cool.
>>
>>59731762
dude just make stuff lmao
>>
>>59731577
Also REST web services are all about interoperability, you should be able to interact with a REST webservice with basically any language and technology more often than not

Its basically a glorified XML that lists all the available methods you can call on the server along with their parameters and the type of return you recieve, several languages have a way to translate that file into classes you can call locally in your code
>>
>>59731758
If you remove mutually recursive calls too yeah
>>
>>59731855
Isn't a program a series of mutually recursive calls though?
>>
>>59731752
Looks pretty neat, but how is this RESTful? Isn't the auth provider issuing a session?

Maybe I'm missing the point here about REST.

>>59731805
So I take it your advice is to keep front end and back end on two different servers, yeah? It would probably simplify the development process too, eliminating some unnecessary conflicts.
>>
>>59731876
Not necessarily recursive. But to be a computer program you need it to be Turing complete.
>>
>>59732002
>But to be a computer program you need it to be Turing complete.
So according to you this is somehow not a computer program?
(\x : Bool . x) True
>>
C = INT_MAX
C++
>>
>>59731977
I can't offer proper informed advice since i don't know what you guys are trying to do, there's a very big difference between just displaying content and handling on the fly realtime thermodynamics calculations, just giving you a heads up about what REST is all about so you aren't too spooked about it
>>
>>59732060
We were talking about the language. Turing completeness is not a property of a program
>>
>>59731261
What the fuck does that spaghetti code do?
>>
>>59732086
It's written in a non-Turing complete language and it is a computer program. Which means what you said was incorrect.
>>
>>59732102
I wish I was as smart as you think you are.
>>
>>59732126
You literally said "But to be a computer program you need it to be Turing complete." And I have shown you a program which is written in a non-Turing complete language.
Only some kind of retard would think this is """"smart""""
>>
>>59732076
Absolute madman
>>
>>59732094
It sets up an interface to call the graphics card's bios directly.
>>
File: 1490412379882.jpg (233KB, 503x662px) Image search: [Google]
1490412379882.jpg
233KB, 503x662px
>>59731178
Has anyone been able to correctly write a function in C that takes two numbers from the user and returns the sum? Or is C still a proven garbage?
>>
>>59732431
You mean the average of two ints?
>>
>>59732431
>C
No one cares. And no, you can't do it in C properly.
>>
>>59732431
const char* avg(int a, int b) {
if (a == 0 && b == 0) return "0"
else return "an error occurred"
>>
>>59732502
Does it work with 100M + (-9999999999999999.000000000000000001)? Show proof pls
>>
>>59732517
but the second var isn't a int, you asked for sum of ints
>>
File: 1486385480258.jpg (38KB, 362x346px) Image search: [Google]
1486385480258.jpg
38KB, 362x346px
>>59732533
>you asked for sum of ints
>ints
Point to me where
>>
>>59732502
So where's the addition part?
>>
>>59732431
GNU nano 2.7.5 File: sum.c

#include <stdio.h>

double
sum(double a, double b){
double c = (a + b);
return c;
}

int main(){
double a, b, out;
printf("Enter num 1:");
scanf("%lf", &a);
printf("Enter num 2:");
scanf("%lf", &b);
out = sum(a, b);
printf("The sum is: %lf\n", out);
}

//now fuck off with your shitty meme
>>
>>59732607
It's in the pointer.
>>
>>59732609
>returns double
So 4.9 +.1 returns a double, not int? Why?
>>
>>59732631
So numbers will decimal points can be added and summed accurately.
>>
>>59732631
4.9 is from the set of doubles
so is .1
Why the hell would it return an int?
>>
>>59732648
Because the type of 4.9+.1 is an int. not a double. Are you dense?
>>
>>59732656
5.0 is by definition not an integer.
>>
>>59732677
5.0 is definitely an integer
>>
File: 1481819968050.jpg (52KB, 585x700px) Image search: [Google]
1481819968050.jpg
52KB, 585x700px
>>59732677
Let's teach you a basic thing:
4.9+0.1 = 5
5 is a whole number
5 does not have any floating point precession, the .0 is meaningless.
The zeros in 0005 are meaningless.
4.9 = 49/10
.1= 1/10
(1+49)/10 = 50/10 = 5

I hope it guides in your infancy
>>
>>59732677
Does a C toddler know what an integer means?
>>
>>59732698
5 is, 5.0 isn't.
>>59732707
Didn't even read this post.
>>59732729
what is a C toddler?
>>
>>59732733
What's the difference between 5 and 5.0 again? kek
>>
>>59732733
5 = 5.0
>>
>>59732742
>>59732748
What's the difference between 5.0 and 5.00000000?
>>
>>59732752
0
>>
>>59732733
>what is a C toddler?
A C toddler is an overgrown baby with no literacy
>>
>>59732752
There is no difference
>>
auto n = 5.0;
auto n2 = 5;
static if(!is(n == n2)) {writeln("wew lad"); }

wew lad


hmm
>>
>>59732752
For the retards replying to this, the difference is that you KNOW 5.00 is precise to two decimal places but 5 you don't. They are different numbers.
>>
>>59732748
You might want to check out the binary representation of them both.
>>
>>59732742
One is either an integer or a natural number and the other is a double.

>>59732748
Not until you apply some kind of operator which maps ints to doubles.
>>
>>59732781
That's situational. Nobody mentioned anything about precision or measurement.

>>59732785
What's that got to do with anything?

>>59732787
Both are integers
>>
>>59732781
>5 and 5.00 are different numbers
No
>>59732787
Good, so why would you return a double if the sum forms a whole number?
>>
>>59732794
Coming from a physics background, mb if it's not the case in a computer.
>>
>>59732794
>What's that got to do with anything?
Pretty much everything as demonstrated in >>59732776
>>
>>59732794
>>59732795
>>59732809
The notation IS the indication of precision, that's why you get F's when you use the wrong significant digits.
>>
To highlight how wrong you are, when someone says 1 + 2 = 3, do you correct them and say
"1 + 2 is between 2 and 4"?

>>59732810
Nobody cares about your shitty programming language.
5 = 5.0

>>59732809
If there's no kind of expectation of accuracy or anything, and we are dealing with the number 5, it is equivalent to 5.0. 5.0 is another way of writing 5.
In Physics or Chemistry, yes you would use the .0 to emphasise accuracy.

>>59732819
That's situational.
>>
>>59732794
An integer is a number with no fractional part. 5.0 clearly has a fractional part and is therefore not an integer.

>>59732795
>No
How can something be the same if it has different types?
You can turn 5.0 into 5 by using some function which converts doubles to integers, but until then they are different numbers.
>Good, so why would you return a double if the sum forms a whole number?
I'm guessing he is some sort of retard.

>>59732827
I see, so 4.53 is also an integer.
>>
there is no better language then c++
that is a fact, deal with it
stop with those meme languages you dirty autists
>>
>>59732827
It's never situational. A data type that can hold a '5' cannot necessarily hold a '5.0', there's more metadata in floats.
>>
>>59732819
Why are you pointlessly giving me this "precession" abstraction?
Do you also write 5 as
0005.00*10^0 +0i 
?
>>
>>59732827
You're fighting a losing battle man, just accept it and move on.
>>
>>59732827
Are you the 1/0 = 1 guy?
>>
>>59732835
>4.53 is also an integer.
Do C toddlers know what an integer means?
>>
>>59732835
>5.0 clearly has a fractional part and is therefore not an integer.
5.0 does not have a fractional part.

>>59732835
4.53 is not an integer. 5.00 is an integer.

>>59732842
Using .00 for precision is situational

>>59732842
>>59732846
>>59732835
>>59732847
None of you faggots have obviously got the point, so here is what my example meant

If 5.0 is an indication of precision, then how do you indicate 1 SF, or 0 DP? With "5".
So now we know that WHENEVER SOMEONE REFERS TO AN INTEGER, they actually mean a numer that rounds to an integer! So integers don't even exist!
>>
>>59732857
Or rather, the notion of precision is situational.
Obviously I was being sarcastic about the 5 thing, but that is how ridiculous you're being.
Your logic would actually have me believe that when you say you're over 18 for the 4chan verification, you actually mean you're over 17.5
>>
>>59732844
Notation carries meaning, your data type must be able to carry that meaning. If you chop that meaning off you have changed the data
>>
>>59732871
10/5 is an integer.
>>
>>59732877
10/5 is an expression of two integers.
>>
>>59732827
>1 + 2 = 3
This is correct assuming plus is defined as something which takes two integers or nats and returns the same type.
>5 = f (5.0) where f : Double -> Integer
Fixed that for you.

>>59732857
>5.0 does not have a fractional part.
You just wrote it. .0 is a fractional part. It being easily removed without any loss of information doesn't somehow mean it doesn't exist.
>4.53 is not an integer.
So you can indeed distinguish them. Anything with a dot after it is by definition not an integer.
>>
>>59732857
 auto n = 5.0;
auto n2 = 5;
writeln(n.sizeof,"|", n2.sizeof);


8|4
>>
>>59732857
A lot of my cute professors say that it's important to keep the discourse of the universe in mind when working with computer systems and programming. It's not all theoretic. :)
>>
You guys get trolled so easily.
>>
>>59732871
Ok let's see >>59732609.
./a.out
Enter num 1:1
Enter num 2:2
The sum is: 3.000000

> 3.000000
FUCK OFF C TODDLER
>>
>>59732648
in C you have to know what type you are returning, what sense would it make to dynamically return an int if it could be a double depending on user input as well?
>>
>>59732891
Yeah but then you have the C people who genuinely believe this shit. That's why you can't have nice C things.
>>
>>59731178
Still generating primes under 2mil
>>
>>59732894
That's not my problem to solve
>>
>>59732894
Where did I mention C? I was merely pointing out the retardation of claiming that something with a fractional part can be an integer.
>>
>>59732887
>it's important to keep the discourse of the universe in mind
Are you in agreement or disagreement with me?
It sounds like you're agreeing that it's dependent on the context as to whether 5.0 means 5.0 or between 4.5 and 5.5 or some other rounding.
>>
>>59732892
kek

RIP C
>>
>>59732909
It's not necessarily retarded, it's part of defining it when designing a programming language. For some languages it would make sense to be strictly type-safe and for others it wouldn't. It all depends on what purpose the language is designed for.
>>
>ITT
Brain-dead C tards that don't know how to write correct codes.
>>
>>59732912
I'm not a great programmer but it seems to me that this sort of thing should be implementation specific. In this case, the problem to solve was to write a program that sums two given numbers and returns the result. Given that these two numbers could be given as integers or doubles, returning a double isn't absurd.

The efficiency of the program isn't hugely effected (on anything with more than 1kb of memory) by returning a double and allows for a more robust solution so I don't understand the sperging out.
>>
>>59732936
Claiming that 5 = 5.0 is absolutely retarded if you are using the standard definition of integer and double.
>>
I only write some simple Octave scripts for my studies and C programs for my students.
Later this month I should prepare a one day course for linguistic students with NLP specialization. I was thinking about teaching them to use GNU/Linux and telling them about rms and free software.
>>
>>59732958
https://www.wolframalpha.com/input/?i=5+%3D+5.0
>>
>>59732971
Can you not read?
>>
>>59732986
Read what? Someone said 5 and 5.0 were different, I replied to him that it was obviously absurd, and that only in certain contexts did 5.0 mean anything other than 5.0
>>
>>59732994
>standard definition for integer and double
>>
>>59733001
What does that have to do with the claim that 5 = 5.0?
What about the standard definition of 5 and 5.0?
>>
>>59732994
If you are using the standard definition of "integer" it simply isn't possible that something with a fractional part can be equal to it.
You could obviously have some other definition where there are special cases for every single number with a fractional part of .0, but that isn't a standard integer.
>>
>>59733009
5.0 is an integer
4 / 2 is an integer
0/3 is an integer
>>
int n = 5;
int n2 = 5.0;
assert(n != n2);


(8,12) Error: cannot implicitly convert expression (5.00000) of type double to int


weird.
>>
>>59733007
An integer is anything which is in this set {...-2,-1,0,1,2...}.
No number here has a fractional part.
>>
>>59733023
10.02/5.0?
>>
>>59733023
5.0 is an integer with mantissa or a data type consisting of both
4 / 2 and 0/3 are two integers and an operator
>>
>>59733042
10.02 / 5.0 is not an integer.
>>
>>59733060
but (10.02/5.0) == 2.0 == integer?
>>
>>59733067
What?
10.02 / 5.0 is 2.004
>>
>>59733067
== 2.004
>>
>>59733072
No it isn't.
>Gaining precision from the ether
>>
File: jspls.png (6KB, 278x139px) Image search: [Google]
jspls.png
6KB, 278x139px
Can somebody explain this
>>
>>59733067
>2.0 == integer
You don't even need to calculate anything to see that this is false. I don't see you using any unary operator on 2 to convert it into an integer.
>>
>>59733086
It was directly related to the statement that 5.0 is an integer.
>>
>>59733082
Are you high?

>>59733094
5.0 IS AN INTEGER
>>
>>59733082
2.004*5.0 returns 10.02
>>
>>59733096
Then why isn't 2.0 an integer in the case of
(10.02/5.0)


>>59733101
Yes, but it's wrong.
>>
>>59733105
10.02 / 5.0 is not 2.0
>>
>>59733108
Please stop replying to retards.
>>
File: 1460604353332.png (17KB, 332x405px) Image search: [Google]
1460604353332.png
17KB, 332x405px
>>59733105
>but it's wrong.
>>
>>59733096
How can something be an integer if it's not in the set of integers?

>>59733105
>2.0 an integer in the case of
This doesn't make sense. 2.0 isn't an integer under all possible circumstances (assuming the standard definition of integer)
>>
>>59733113
I can't fucking stand it
He's an insult to western civilisation
We've regressed 3 fucking millenia
>>
>>59733114
Physics.... remedial? 101?

>>59733117
It isn't a claim, it's a rebuttle. 5.0 isn't an int because 2.0 isn't an int.
>>
worlds getting turned upside down.
thought i knew basic math but apparently i was wrong
>>
>>59733117
2.0 = 2

is 2 an integer?
>>
>>59732431
It is impossible for a computer to correctly calculate the sum of any two real numbers.
>>
>>59733136
value != type
>>
>>59733146
What? Are you trying to say 2 is not an integer?
>>
>>59733127
Physics has nothing to do with the fact that 2.004*5.0=10.02

10.02 has fractional parts so it's not an integer
>>
>>59733127
>5.0 isn't an int because 2.0 isn't an int.
Both of them are integers.
>>
>>59733151
2.004*5.0 is not the same as 10.02/5.0, thats what physics has to do with it.
>>
>>59733150
no, 2 and 2.0 have the same value, but they are different types.
>>
>>59733161
You're probably thinking of a specific programming language
>>
>>59733161
>>59733150
.0 is data, it has a precision value.
>>
>>59733127
>5.0 isn't an int because 2.0 isn't an int.
No. 5.0 and 2.0 aren't ints because they aren't in the set of integers.

>>59733136
2.0 != 2 (assuming = is defined to work on the same type)
f 2.0 = 2
Where f is a partial function of type Double -> Integer which takes any double with a fractional part of .0 and returns an int.

>>59733156
They have a fractional part therefore they are not integers.
>>
Is 0.9999999999999... = 1?
>>
>>59733159
>2.004*5.0 is not the same as 10.02/5.0
2.004*5.0 - 10.02/5.0 = 0

And physics has nothing to do with it. Does a C toddler know what the word "physics" denotes?
>>
>>59733173
yes
>>
>>59733168
>They have a fractional part
5.0 does not have a fractional part. It doesn't have a complex part as well.
>>
>>59733168
It doesn't matter what wacky programming language you think of, 2 will still be 2.0, regardless of what is true in your language

>>59733167
Says you.
Who mentioned anything about precision?
Nobody.
Is this a measurement? Nobody said anything of the sort.

Absolutely no context whatsoever suggests this is a matter of measurement.

You obviously don't believe in numbers, because 2 doesn't actually mean 2, it means 1.5 to 2.5, and 2.5 doesn't actually mean 2.5, it means 2.45 to 2.55
>>
>>59733166
no most languages should assert same value but different types.
>>59733167
the precision is just redundant data.If you move something .0 units, its not going to move.
>>
>>59733185
There will always be meaningful measurements while computers can only estimate floating point math.
>>
>>59733173
>>59733179
No
0.9999999999999... ≈ 1
>>
>>59733196
What do computers and floating point math have to do with 2 being 2.0?
>>
double d = 5.0;
int i = 5;
std::cout << (reinterpret_cast<int&>(d) == reinterpret_cast<double&>(i));

now stop trolling, idiots.
>>
>>59733199
0.999... = x
9.999... = 10x
9 + 0.999... = 9x + x
9 = 9x
1 = x
>>
>>59733185
Says number theory.
>>
File: 1488321566939.jpg (8KB, 247x248px) Image search: [Google]
1488321566939.jpg
8KB, 247x248px
>>59733215
>shitlang
>>
>>59733182
It does. .0 is the fractional part of 5.0.

>>59733185
The definition I'm using isn't related to any programming language. It's simply the standard definition of what an integer is.
A language might define = to work on multiple types, which doesn't say anything about 2.0 somehow being an integer.
>>
>>59733220
>>59733222
You're actually retarded.
>>
>>59733214
Because you can't just throw away precision data, humans have to handle it properly. Computers can't. 2 != 2.0
>>
>>59733236
So 2 isn't an integer.
>>
>>59733185
It might evaluate to the same value, but it's not the same, since they do not share type.
>>
>>59733222
Fractional part of 5.0 does not have any meaning. 5.1 is fractional, 5.1*10 - 5*10 is not equal to 0
>>
>>59733239
We are talking about the number 2.
I don't care about whatever programming language you are thinking of.
>>
>>59733175
Bump
>>
>>59733233
This isn't my opinion, I am simply stating the definition of an integer. Tell that to whoever came up with it.

>>59733236
This isn't related to computers.

>>59733247
>Fractional part of 5.0 does not have any meaning
That doesn't matter, the definition of the set of integers doesn't have the concept of "meaning". Anything with ANY fractional part is by definition not an integer.
>>
>>59733258
Integers and Rationals are not the same set, Integers have a property that distinguishes them from the Rationals.
>>
>>59733270
>integers and rationals are not the same set
Integers are a subset of rationals.
>>
>>59733272
And Integers have a property that distinguishes them from the Rationals.
>>
>>59733270
Where did I claim that they were?
>>
File: witnessed.gif (2MB, 540x210px) Image search: [Google]
witnessed.gif
2MB, 540x210px
>5.0 is an integer
>>
ITT: autists who literally cannot grasp the concept of semantics
>>
>>59733282
So they ARE a subset of the rationals.

Is 5/1 an integer?
>>
>>59733300
Yes 5/1 = 5 is an integer
>>
>>59733305
Is 5 + 0/10 an integer?
>>
>>59733306
Yes, 5 is an integer
>>
>>59733311
So 5.0 is an integer.
>>
>>59733317
dividing two floats results in a float, regardless of the result
>>
>>59733321
What?
>>
>>59733305
5/1 = 5.0
5.0 has a fractional part, meaning it's not an integer.

>>59733306
>0/10 = 0.0
>5 + 0.0
You haven't defined + to work on multiple types yet so this is invalid.
>>
>>59733325
What types?! You're all fucking insane
>>
>>59733321
No.
1.02/1.02 = 1, 1 is an integer

>>59733325
>5.0 has a fractional part
It doesn't

5 = 5 + 0i, so by your "logic" 5 is a complex number. Are you an American by any chance? Your illiteracy is showing.
>>
>>59733317
No, 5.0 is a double (in C at least, I just came here, idk what you're talking about).

>>59733325
>5/1 = 5.0
No it's not.
>>
10/10 would read again

or 10.0/10.0
>>
>>59733334
Not him, but 5 is a complex number, as well as an integer. He would be saying that 5 is a complex number AND not an integer

>>59733338
>in C
What about in mathematics?
>>
>>59733338
>in C
Who the fuck cares about piece of shit called C?

>>59733334
This
>>
>>59733317
let's say you are a computer and you need to save the value of 5.0 in an integer, 5.0 consists of two parts 5 and 0, so for every number you want to save you need to allocate two integers (x and n, for the computer it doesnt the n is static).

i kinda think that your integer would need double the space of a normal integer
>>
>>59733348
>let's say you are a computer
I'm not.

Besides, wolfram alpha IS and it already told you that 2 = 2.0
>>
File: 1488477805916.png (143KB, 600x600px) Image search: [Google]
1488477805916.png
143KB, 600x600px
>>59733348
>>
>>59733345
5 is not a complex number. Real numbers are not a subset of complex numbers
>>
>>59733360
5 = 5 + 0i
>>
>>59733334
Its fractional part being the neutral element doesn't somehow mean it isn't even there.
>Are you an American by any chance?
No, but I can clearly see by your retardation that you're E*ropean.

>>59733330
The types double and integer.

>>59733353
If 2 = 2.0 then 2.0 must be in the set of integers. I can't seem to find it there.
>>
\>>59733353
>2 = 2.0
value wise yes.
Can you not comprehend the difference between the two?
>>
>>59733345
>>59733347
>in C
Rust does this as well.
>>
>>59733367
Right next to 1 and 3.
We all make mistakes with counting.

>>59733376
I'm talking about 2, I'm not talking about some programming language

>>59733377
Guess we better over turn all of civilisation then
>>
10 * 1.0f
>>
>>59733353
you seem to have problems with implicit data type conversions

are you some kind of retarded javascript ai that someone thought would be funny to let loose in /g/?
>>
>>59733389
>implicit data type conversions

Sorry, that wasn't in my elementary fucking mathematics education
>>
>>59733366
>0i
It is not complex
>>59733367
>A**tralian
yeah makes sense that you have no knowledge of numbers
>>
>>59733376
>value wise yes.
Nope. Assuming = doesn't convert between types they are definitely inhabitants of different types and therefore are different values.

>>59733379
{-1,-2,-3,0,1,2,3}
Where? Can't seem to find it. I don't have the disease your kind seems to be born with so maybe that's why I can't see it.
>>
>>59733389
>you seem to have problems with implicit data type conversions
>are you some kind of retarded javascript ai

he wouldn't have any problems with it then anon
>>
>>59733393
well this is a thread about programming languages and not your elementary school expericence
>>
>>59733402
Specify the programming language then when you are making claims like 2 = 2.0. Since any sane person would assume you are talking about mathematics.
>>
>>59733399
what i meant was understanding the abstraction of implicit data type conversion vs explicit data type conversion
>>
>>59733413
>sane person
>in programming thread
>>
>>59733395
0i is an imaginary number, therefore it is also a complex number
0 is a real number, therefore it is also a complex number

>>59733396
2

>>59733402
Someone said 2 isn't 2.0 and I said that's wrong
>>
I was going to read programming book, then I found pic related.
Could you explain to me what's happening?
I understand everything up until the second part of the for loop:
for (fp = (char *)m.s, tp = (char *)mp->s; tp < (char *)(mp+1);)
^^^^^^^^^^^^^^^^^^^
What's this? ^

[cpde]tp is a character pointer
(char *)
, and mp is a pointer to a struct
(MSG *)

And mp is not part of an array or anything, so it makes no sense to add 1 to it, does it?
I think I have a little idea, but I'm not sure: it's checking if the address held by tp points somewhere after the struct, which would mean that it's reached the end of
mp->s

Is that it?

>>59733345
If you're talking math, 5.0 is the same thing as 5, and it's a natural number which means it's an integer and a rational and a real and a complex number. In C, on the other hand, 5 is not the same as 5.0; one is an int and the other is a double.
>>
>>59733379
>Right next to
>sets
Yeah, now it's clear why you're behaving like an absolute retard.
>>
>>59733249
> We're talking about the number 2
Yes, and?

Depending on the context in which we're discussing the number two, they can be the same or they can be different.

It depends entirely on whether your mathematical system cares about type or not. Sure, they evaluate to the same value, and I said as much. But if you are operating with types and values, they're the same value but expressed as different types.

This is not a difficult concept. This is just you forgetting that type systems exist outside programming languages, and hence the distinction is valid outside the problem domain of programming.
>>
>>59733433
>If you're talking math, 5.0 is the same thing as 5, and it's a natural number which means it's an integer and a rational and a real and a complex number. In C, on the other hand, 5 is not the same as 5.0; one is an int and the other is a double.
Thank you. I completely agree.
>>
>>59733433
Mate, we don't talk about programming in this thread. Distinctions between numbers only please.
>>
>>59733432
>0i is an imaginary number
No, 0i is 0, it's not a complex number you dumb middle school dropout autist
>>
File: 1488539287997.jpg (394KB, 938x1630px) Image search: [Google]
1488539287997.jpg
394KB, 938x1630px
as a hacker who primarily writes C and assembly, what's cooler, C++ or Rust or something else?
>>
>>59733448
I talked about that too.
>>
>>59733433
>If you're talking math, 5.0 is the same thing as 5,
Prove it. Show me a formal proof of 5.0 being a member of the set Z.

>>59733432
Yeah, I see 2 there. Can't seem to find 2.0 though.
>>
File: relation.gif (13KB, 389x309px) Image search: [Google]
relation.gif
13KB, 389x309px
>>59733434
Oh, you're a troll
Nevermind, sorry.
I'm an idiot for replying.

>>59733451
>>
>>59733446
Not really, in math 5.0 can differ from 5, if it's a measurement for example. Preciseness matters.
>>
1 and 1.0 are both the same and different.
But physically in our universe, whereve & however you measure them they will have the same perceived value.

can we stop with the semantics now.
>>
>>59733451
0 is an imaginary number you fucking retarded american
>>
>>59733464
2.0 = 2

>>59733468
As I've been saying for however many fucking posts, that is assuming some context of precision, which isn't there at all. Otherwise you don't assume it means something other than 5.0, you assume it means 5.0

Think, what does 5 mean?
If you're implying precision, then 5 could be 4.5!
So are there no integers?
>>
>>59733451
a ⊂ C
You fool.
>>
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
>>
>>59733460
Sorry I got distracted with all that code nonsense at the top of your post.
>>
>>59733468
>in math 5.0 can differ from 5
In math they can't.
>>
>>59733474
0 is not an imaginary number you fucking retarded american
>>
File: 1483950203215.gif (468KB, 500x282px) Image search: [Google]
1483950203215.gif
468KB, 500x282px
>>59732707
You're an idiot. Take your stupid shit elsewhere and comeback when you go through primitive types
>>
>>59733480
Who is talking about floats?
>>
>>59733467
What kind of a moron drew that garbage?
Imaginary number is -1^0.5, this is where the 'i' comes from
>>
>>59733464
5.0 is the decimal expansion of 5 â‹… 10^-0 + 0 â‹… 10^-1 = 5 â‹… 1 + 0 = 5
>>
>>59733487
Fuck off if you can't argue anything, retard
>>
>>59733481
That was more important to me. This is /g/ and /dpt/. Go to >>>/sci/ for math.
>>
>>59733494
Yes.

And a complex number is a real number plus an imaginary number.

0i and 0 are identities under addition.

So 3 = 3 + 0i
3 is a complex number too

If you look at the complex plane, you will see a line in which the imaginary component is 0.
This is the real number line.
>>
Meeting with my team today to review all the cases we've done for this sprint. Each of us has done about 4 cases each, with each case having 3-4 cases of its own as we apply each bugfix to all of our products (we deal with about 4 products in my department).

So each of us has done about 12-16 cases in the last two weeks, which is pretty good.

Except for Jeremy. Jeremy has been working on the same case for 3 months.

I don't know if Jeremy will be continuing to work with us
>>
>>59733511
>imaginary component is 0.
That means it has 0 imaginary component, it doesn't even belong to the i axis
>>
>>59733515
m-maybe he just got the most difficult one that had some unexpected complications
>>
>>59733479
If you can't understand something as simple as (Z ⊂ C), then you shouldn't study math, let alone argue about it on the internet.
>>
>>59733526
The numbers on the i axis are imaginary numbers, or pure imaginary numbers.

The numbers on the real axis are real numbers.

Both are complex numbers, as are the numbers that are not on the line.

Do you think 0 is a real number?
The same logic would have you say no.
>>
>>59733543
0 is a very well known exception and everyone knows that
>>
>>59733543
I think he's just trolling, stop wasting your time arguing with him.
>>
>>59733572
>loses argument
>"hez trolling guyz"
>>
>>59733528
He job is to take all the <input> tags and add readonly to them
>>
how triggered can people get when talking about types....
anyway is there a way to improve this function?
I want to display Pascals triangle and need a function to calculate the binomial coefficients of a list.
coeff :: Num a => [a] -> [a]
coeff list= case list of
[] -> []
[x] -> []
(x:y:xs) -> (x+y):coeff (y:xs)
>>
>>59732707
>4.9+0.1 = 5
>implying it isn't actually 5.00000000000000001 because of shitty rounding
>>
>>59733596
coeff (x:y:xs) = (x + y) : coeff (y : xs)
coeff _ = []
>>
>>59733596
>anyway is there a way to improve this function?
Generics
>>
>>59733502
it has been clearly outlined a number of times in this thread, if you still can't comprehend the issue maybe you should give up, because if it takes you this long to grasp basic concepts you are just wasting your time
>>
>>59733609
It is generic
>>
So >>59732609 failed miserably,

anyone else willing to try?
>>
>>59733586
Stop trolling me.
>>
>>59733635
looks good to me
the question didn't specify that the returned type had to be int
>>
>>59733602
thanks! Now to display a nth line of a pascal triangle I Thought about this, can you improve this in any way?
pascalLine :: Int -> [Int]
pascalLine 0=[1]
pascalLine n=[1] ++ coeff (pascalLine (n-1)) ++ [1]
>>
>>59733656
If the result is an int, return an int, is that something that common sense does not tell you?
>>
>>59732431
I can do that without even using C, just the C preprocessor:
#define SUM(a, b) ((a) + (b))

Wasn't that hard, was it?
Not useful either, because why use a "sum function" when you have the + operator?

Also, Richie never said that C was a mistake.
>>
>>59733671
I don't use common sense when writing programs for clients
I do exactly what they ask me to do and nothing more
>>
>>59733680
I told you to use C, are you unable to read?
>>
I like these Cirno threads.

C and C++ are both horrifyingly inconvenient to program in, though.
>>
>>59733693
The preprocessor is part of the language.
>>
>>59733664
That looks as good as it gets, though you could generalise it to
(Num a, Eq a)
>>
File: 1464852838372.png (519KB, 769x720px) Image search: [Google]
1464852838372.png
519KB, 769x720px
>>59731261
C++ was a mistake.
>>
>>59733707
It's a part of C++ as well, what are you trying to say?
>>
>>59733707
>>59733693
long double sum(long double n1, long double n2)
{
return n1 + n2;
}
/* Happy now ? */
...
int five = (int) sum(3.5, 1.5);
printf ("filve = %d\n", five); /* Prints "five = 5" */
>>
>>59733728
where are the user inputs?
>>
>>59733727
You said "I told you to use C"
I showed you that that's what I did.
>>
>>59733744
hello
void add()
{
int a,b;
readf(" %s", &a);
readf(" %s", &b);
writeln(a + b);
}

>>
>>59733776
What's the out put of 1.2 + 9?
>>
>>59733776
>%s
>int
What kind of retardation is this?
>>
>>59733795
%s inferes whatever a+b is
>>
>>59733785
10.2 when changed to doubles
>>
>>59733805
Then why the hell are they using scanf-like formatters?
Why not just a % on its own, or something completely different like {}? Why is it using the "string" format from scanf?
That is just pointless and retarded. That seems to be a common thing I've seen in Deadlang.
>>
File: 1465765912542.png (17KB, 722x452px) Image search: [Google]
1465765912542.png
17KB, 722x452px
>>59732224
I wish I could do that. But I'm a 32bit protected mode cuck.
>>
>>59733785
1.11
>>
>>59733832
You can still setup a linear frame buffer through your bootloader.
>>
>>59733830
>"string" format from scanf?
It's not, %s infers to relevant type
>>
>>59733830
>C toddler with a baby duck syndrome
Classic retardation
>>
>>59733830
D is a little funky with its readf variant because it defaults to references.
>>
>>59733860
>using + for modulo
Expected from people who think they are women (male).
>>
>>59733843
Yeah, I do, but I can't change it after I enter my kernel, which sucks.
I will have to setup a vm86 monitor sometime, but not sure how well that will go or even how safe that is.
>>
>>59733869
>>using + for modulo
They don't
>>
>>59733851
I went to deadlang's docs.
https://dlang.org/library/std/stdio/readf.html
No description of formats, so I clicked "format specifier". 404.
Fucking excellent language you have there. You can't even have the links in your documentation be valid.

Again, if it's just going to infer the arguments, why the fuck would they pick something deliberately-misleading like "%s"?
>>
>>59733891
Format Specifiers
s default
b binary
d decimal
o octal
x,X hexadecimal
f,F floating point in the standard decimal notation
e,E floating point in scientific notation
a,A floating point in hexadecimal notation
g,G as e or f
( element format start
) element format end
| element delimiter
>>
>>59733891
https://dlang.org/library/std/format/formatted_read.html
>>
>>59733884
>I can't change it after I enter my kernel, which sucks
My OSdevfu is lower than a few years ago but I'm fairly sure you are still able to temporarily lower the CPU mode without fucking everything up. But it might be too bothersome (which is the reason I suggested doing it through the bootloader and just calling it a day).
>>
>>59733891
How does %s ""mislead"" you, unless you are a brain dead C toddler?
>>
>>59733914
>using + for modulo
>>
>>59733919
They don't
>>
>>59733906
Yes, I saw that link too, and there was still nothing helpful.

>>59733914
Scanf is a pretty well-known function. If you're going to masquerade as it and try to be "friendly" to the potential C programmers who might use your language, you really shouldn't be modifying the syntax so misleadingly.
They should have just used a different syntax entirely.

>>59733897
Why didn't their shitty docs link to that?
Do you expect me to take this language seriously?
>>
>>59733934
>Scanf is a pretty well-known function.
to C toddlers, that is. No one cares that you have baby duck syndrome, D is not C
>>
>>59733934
>Do you expect me to take this language seriously?
Well at least it can add two numbers
>>
>>59733956
rekt
>>
>>59733744
Shut up.
#include <stdio.h>
#include <stdlib.h>

#ifndef BUFSIZ
# define BUFSIZE ((unsigned int) (1u << 8))
#endif

long double sum_with_input_from_user(void);

int main(void)
{
printf("Sum = %Lg\n", sum_with_input_from_user());

return 0;
}

long double sum_with_input_from_user(void)
{
long double n[2] = {0.0};
int i;

for (i = 0; i < 2; ++i) {
char buffer[BUFSIZ] = {'\0'};
char *status = NULL;
char *endptr = NULL;

printf("Dear user, would you please be so kind as to give me the %s number?\n",
i == 0 ? "first" : i == 1 ? "second" : "nth");
status = fgets(buffer, sizeof(buffer), stdin);
if (!status)
exit(1);
n[i] = strtold(buffer, &endptr);
if (endptr == buffer || *endptr != '\n') {
printf("An error may have occurred.\n");
exit(1);
}
printf("n[%d] = %Lg\n", i, n[i]);
}

return n[0] + n[1];
}
>>
>>59733934
Their docs dont really have a full time person. Most of their non-essential read: community stuff, are volunteer basis.
Admittingly there are more than a few 404's and outdated material. But Id rather the steady compiler and language feature discussion come first. Anything you cant find is probably on the d forums. Or theres a book by a senior member of the core-group
>>
>>59733911
I know you can lower the CPU mode, but that will fuck with interrupts.
You have to restore the BIOS IVT and original configuration of the PIC, so any interrupt that comes in during the mode switch gets handled by BIOS code and is pretty much completely missed by your kernel, who was the intended recipient.

A vm86 monitor apparently solves that issue.
>>
Why does this macro not properly return when passing in an arithmetic expression as a parameter with the visual studio compiler?

#define MIN(val, min) ((val) < (min) ? (min) : (val))

short x = MIN(0 - 32 / 2, 0);
short y = MIN(0 - 32 / 2, 0);


The above code leaves x and y at value -16 instead of 0. What am I doing wrong?
>>
>>59733956
I have seen people (it was probably just you. I can't imagine that anybody would actually use D) post snippets of D code, and I can't believe some the design decisions in that fucking language.
It's fucking retarded. I don't know how anyone can seriously defend D. It's clear to everyone that it's fucking dead.

>>59733973
>Their docs dont really have a full time person.
Again, do you expect me to take this language seriously?
The official docs are _the_ most important part of a language. Programmers are going to be spending a lot of time with it.
If you can't even get that right, I'm seriously going to question the quality of the rest of the language.
This sort of defence is just pathetic.
>>
>>59733785
[anon@anonhost tmp]$ ./sum 
Dear user, would you please be so kind as to give me the first number?
1.2
n[0] = 1.2
Dear user, would you please be so kind as to give me the second number?
9
n[1] = 9
Sum = 10.2

(using this >>59733969)
>>
>>59734016
>I don't know how anyone can seriously defend D
see >>59733956
>>
>>59733969

Beautiful.

>inb4 the other anon does mental gymnastics to find a flaw
>>
>>59734023
They are welcome to try to, but I think it doesn't have any flaws.
>>
>>59734022
>Le loaded misleading maymay questions prove me right XDD
Fucking D-lang shiteaters.
>>
>>59734023
stop samefagging
>>
>>59734034
Ah, this particular C toddler is upset
>>
>>59734035
That wasn't me, dude.
>>
>>59734035
>implying
>>
>>59732971

See:
>https://www.wolframalpha.com/input/?i=5+%3D+5.0000000001
>>
Any good programming book with short nuggets of wisdom and not much else?
>>
>>59734071
>5.0000000001
not 5
>>
New thread:
>>59734157
>>59734157
>>59734157
>>
>>59733433
Adding x to a pointer type increases the address by the size of that referenced pointer. This is why you can add 1 to any kind of pointer to array, deference, and get the next element.

So what you have going on there is that "mp+1" returns the start of mp plus the size of one dereferenced mp. So it's making sure you don't run past the barrier of the struct you've allocated memory for.

The "char *" business is because sizeof a char is guaranteed to be 1 so it dictates how you move across your data. If the cast to "char *" is what confuses to, try taking it out. You'll get a complaint about trying to compare incompatible pointer types.
>>
>>59734180
Finally an answer, thank you, Anon!
>>
>>59734180
Autocorrect seems to have butchered my "reference"/"referenced" and "dereference"/"dereferenced".
>>
>>59734200
Also "you"/"to" in "If the cast [...] is what confuses to"
>>
>>59734140
Effective C++
Hacker's Delight
Common Lisp Recipes
>>
>>59734217
Thanks. Personally speaking, I'd rather just write something like:
memcpy(mp->s, m.s, sizeof(mp->s));

And call it a day. I'd change the names to something helpful, too.
>>
>>59734400
I know, it just says that if you understood that code, then you'd have no trouble understanding the examples in that book; and that their code is not "if you do not understand this fragment, do not despair (there is nothing quite so convo-luted in our code"
>>
New (cute) thread:

>>59734442
>>59734442
>>59734442
>>
>>59734445
Don't create duplicate threads just because you don't like the image, unless it's seriously off-topic shit that will impact the quality of the thread (e.g /pol/posting).
Just delete that shit. Duplicate threads are annoying, and just fracture /dpt/ up pointlessly, and waste board space.
>>
>>59731762
Gvim.
>>
>>59732752
Their types.
The value is the same, but the type is not.
We've already had this argument.
>>
>>59733023
4/2 is a fraction with a value equal to the integer 2..
0/3 is a fraction with a value equal to the integer 0.
5.0 is a decimal with a value equal to the integer 5.

But they are only the same if you don't consider type part of sameness.
>>
>>59736475
please learn basic mathematics first
Thread posts: 325
Thread images: 24


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.