[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 55 KB, 1604x678, are numbers the only things that are real.png [View same] [iqdb] [saucenao] [google]
6834868 No.6834868 [Reply] [Original]

Are numbers the Only things real?

>> No.6834884

Complex numbers aren't real.

>> No.6834947

>that fucking awful code.

Learn what standards are, and use a proper operating system. That code is harmful and unsafe.

>> No.6834953

>>6834947
Are you high on adrenaline or something

>> No.6834956

>>6834947
>scanf considered harmful

>> No.6834963

>>6834868
Interesting how the newlines terminating a scanf input don't spill over into the next scanf (as they are normally left in the stdin buffer) and make it skip over without taking an actual value. That always used to be a quirk with scanf - had to preceed the specifier with a whitespace char that would "eat" the lingering space, but you don't do that and your program seems to work fine regardless.

>> No.6834968

>>6834868
>"Process exited with return value 14"
>not that main ever actually returned anything
>dat meaningful random return value out of ass and the subsequent wanking over it

>> No.6834972

>>6834868
No, death is. Seriously, why isn't there a Philosophy board?

>> No.6834973

>>6834972
how can death be real if reality stops once you die?

>> No.6834981

>>6834973
Whose reality? Yours or mine?

>> No.6834985

>>6834981
>reality ain't real

>> No.6834992

>>6834868
How can mirrors be real if our eyes aren't?

>> No.6834997

>>6834884

Why do people always forget zero (and those complex numbers with complex part zero ;) ? I read a quick study guide once which stated that the imaginary numbers (having a real part of zero) and the reals are disjoint sets. I palm'd'or.

>> No.6835006

>>6834997
>zero
What do you mean zero doesn't exist? Look at that hot babe by your side, oh wait there's none therefore zero exists otherwise there would be one. QED.

>> No.6835007

>>6834953
My blood gets pumping when I see code which wouldn't stand up to the rigor of Unix Systems programming (the true use of C).

It is an insult, a danger and should be illegal. Let the kids play with shitty, poor-performance toys like Python.

>> No.6835009

>>6835007
*tips distro*

>> No.6835014

Prove numbers are real first.

>> No.6835015

>>6835007
Look, I am 6834953, I am interested on what you have to say about Unix Systems programming. Care to post more?

>> No.6835018

>>6835014
I have 2 balls. My 2 balls are real. Therefore numbers are real.

>> No.6835021

>>6835007
I am a faggot that does not know anything about programming.

>> No.6835027

>>6835015
Rob Pike and Brian Kernighan released a book in the 80s on The Unix Programming Environment, this outlines the ways to combine the power and performance of Unix with C. Both of these are products of Bell Labs, where Pike and Kernighan worked (Kernighan coined Unix). This begun the thinking of the ideology of the Unix philosophy. I'm not a freetard Linux fag (I use OS X and BSD, both of which are more Unix then Linux is), but I support a philosophy which encourages small, isolated programs and the swapping of information via text in these programs. Don't confuse this with the likes of RMS who care more about ethics and morality than good programming.

The entire Unix philosophy was later expanded on by Eric Steven Raymond in 'The Art of Unix Programming' in the 90s/early 2000s. This is not a technical book at all, really. It tells the user good practice and how to conform to the Unix philosophy which by that point had been brewing for 30 years.

The programming of Unix systems tools and programs is the purest form of C programming, it encourages elegance, simplicity, isolation, and safe practice. It produces the best programs, unlike the abomination by OP, which is already stupid by line 2. int main(void) in future OP, you have left the program open to unlimited command line input as is.

>> No.6835028

>>6835018

using that argument, we should be using base 2.

>tfw 10 balls

>> No.6835065

I stopped caring about math when I was introduced to the concept of imaginary numbers. What a crock of shit.

>> No.6835072

>tfw learning C on physics course
>can't tell if anything is wrong with OP's code
Is there an actual problem with it?

>> No.6835078

>>6835065

why. If they'd be called Cardano numbers instead, would you like them then?

They're not stupid, they just extend your sets so that you can count other things than apples and bees and so on.

They're really not that crazy. I know the root of negative numbers are weird but imagine the number line just taking a detour into another dimension to pop back out again afterwards, it is not that bad.

We actually calculate a horde of things with them that give results in how we treat 'apples and bees'.

They can help you solve problems that were before constructed with real numbers (because that was all we had) that then give an answer as a real number, like problems involving trigonometric stuff.

Don't be scared by the strange names "complex" and "imaginary", they're outdated by now as plenty of stuff is truly imaginary in maths and complex numbers are far from the worst stuff.

>> No.6835082

>>6835065
You should have stopped caring when you were introduced to negative numbers. Because without them, there would be no need to introduce imaginary numbers in the first place. And imaginary numbers are no more "unreal" or "fabricated" than negative ones, by the way.

>> No.6835098

>>6835007
How does systemd conform to the Unix ideal that a program should do one thing and do it well?

>> No.6835100

>>6835072
spergs gonna sperg

>> No.6835107

>>6835098
It doesn't. It's a fucking abomination and I despise it.

>>6835072
There's a problem by the second line. Don't declare main(). Declare it as main(void) or main(int argc, char *argv[]), based on if you are taking command line arguments or not. main() is stupid and poor, poor practice. Also. Why the fuck has he declared g=0 at the top of the code. It's stupid not to just do for (int g=0; g<10; g++). I could go on.

>> No.6835109

>>6835027
>unlike the abomination by OP, which is already stupid by line 2. int main(void) in future OP, you have left the program open to unlimited command line input as is.
Yea, but there are such "abominations" aplenty in the K&R 2 book.

>> No.6835115
File: 3.30 MB, 400x267, systemd_monster.gif [View same] [iqdb] [saucenao] [google]
6835115

>>6835107
>It doesn't. It's a fucking abomination and I despise it.
Yet most major distros have adopted it by now, and more are to follow... how fucked is Linux then?

>> No.6835117

>>6835082
>no negative numbers
>no imaginary numbers
Can you save us the time to figure this out. I know negative numbers are used on a number line that is a infinite length vector, but what else

>> No.6835125

>>6835107
Can you explain how he didn't run into the quirk described here >>6834963 while running the program? How come the '\n' remaining in the stdin buffer didn't make the next scanf skip actual input?

>> No.6835140

>>6835115
It won't matter. Most users don't care for the Unix philosophy and will just let bloat infect their system. Those who hold the Unix philosophy in high regard will move to BSD, non-SystemD distros (Gentoo etc.) or Plan9 (if they're fucking hardcore).

>> No.6835141

>>6835115
So fucked that people will start calling it GNU due to its conformance to the GNU philosophy of "do everything, do it horribly".

>> No.6835144

>>6835125

>>6835072 here
I never ran into the issue you're saying and so far I have always wrote the scanf like OP's.

>> No.6835149

>>6835107
I always write it as main(void), even when taking command line arguments, is there some difference?

>> No.6835152

>>6835125
Fairly sure that compilers optimised for that a while ago. I just tested with gcc and clang and both did it no problem.

I'm not 100% sure on that though, usually it's good practice to flush the buffer (manually, fflush isn't good practice).

>> No.6835156

>>6835149
Well, yes. Are you sure you don't just mean regular input? Command line arguments are specified at the same time you run the program, so if you type into a terminal 'program a'. It will run the program, with the input 'a'. Whereas regular input is just input taken from scanf and the like.

>> No.6835159

>>6835140
>Plan9
Is it even seriously usable these days? I remember having tried to run the installer from an ISO, but couldn't even over come some "glenda something" (don't remember the details, sorry, was long ago) messages that were completely cryptic.

>> No.6835160
File: 30 KB, 409x409, 1412625349576.jpg [View same] [iqdb] [saucenao] [google]
6835160

>>6835007

>> No.6835162

>>6835156
Oh, I just meant regular input, haven't learned how to do the second one yet.

>> No.6835169

>>6835162
Also, don't use scanf(), it's horribly prone to buffer overflows. Use fscanf() and have it read from stdin with a specific buffer length.

>> No.6835171

>>6835159
No, not really. It's only usable if you have a ton of time and limited use. It's amazing though. I wish it was fully usable.

>> No.6835439

>>6835018
>Therefore numbers are real.
Nope. You only prove twoness is real however that proof rests on your balls.

Prove balls are real.

>> No.6835620

>>6835169
Aren't you confusing scanf/fscanf for gets/fgets?

>> No.6835672

>>6835620
I don't know if he is, but the primary danger of scanf is the ability to use %s by itself, in which case it behaves like gets. %[] would be dangerous too. You should always include length specifiers for those.

Scanning anything of fixed length should be safe.

>> No.6835679

>>6835439
I can touch and fondle the balls, therefore they're real.

>> No.6835683

>>6835439
Are Church numerals sufficient evidence for the existence of natural numbers?

>> No.6835684

>>6835672
char str[32];
scanf("%31s",str);

>> No.6835687

>>6835684
Yeah, that's the aforementioned length specifier.

>> No.6835699
File: 870 KB, 1475x1850, cover2.jpg [View same] [iqdb] [saucenao] [google]
6835699

>>6835027
what do you think about APUE

>> No.6836115

>>6835699
It's a good book. I'd read The UNIX Programming Environment and The Art of Unix Programming first though.

>> No.6836888

>>6835683
Nah. numbers are an abstract idea

>> No.6836909

>>6835027
I doest matter when it is compiled, retard

>> No.6836918

>>6836909
and it does not matter, since /prog was banned from 4chan => 4chan != 4chan

>> No.6837097

>>6836909
Yes it does, fucko. Have fun with your disgusting unsafe programs, with unreadable, unmaintainable code.

>> No.6837119

numbers are a concept

>> No.6837125

No, numbers are descriptive tools that only exist in your head. There's no such thing as an original 'one' somewhere near Jupiter, they're labels we put on things

>> No.6837166

>>6834868
please return 0 next time.

>> No.6837199

>>6834868
nothing is real

>> No.6837231

>>6834868
wow this code looks like shit, no offense if its yours.

>> No.6837242

>>6835006
>zero
>he thinks it is a number

> main() is stupid and poor, poor practice
>sperging
>explicitly stating void in your params
LEL I've seen some sperg shit, but its been awhile since it was this concentrated.

>> No.6837254

>>6837242
meant for
>>6835107 too
>also

>2014
>returning main function with exception code
>returning any function with exception code
>Not creating/using even the simplest error handling/debugging libraries to handle exceptions.

#include <iostream>
void main(){
printf("Get with the times Grandpa.");
}

>> No.6837290

The only thing you can be sure exists is yourself. Everything else could be a lie

>> No.6837518

>>6837254
>#include <iostream>
>printf
You have no idea what you're talking about, do you?

>> No.6838051

>>6837254
>iostream

whaddafuck

>> No.6838056

>>6837254
Declaring main as void means there is no return type. Passing void into main means there is no command line input. Fuck off, troll.

>> No.6838060

>>6837254
>iostream
C++ck you're privilege

>> No.6838077

>>6835009
I laughed hard.

>> No.6838082

But how can you return 0 if 0 isn't real?

>> No.6838089

>>6837166
How about

void *main(void)
{
return NULL;
}

>> No.6838091

>>6837231
>you're code a shit
Not OP, but would you care to elaborate?

>> No.6838094

0 and 1 are the only real numbers, all others are simply abstractions

>> No.6838108

>>6834973
Not falsifyable.

>> No.6838113

>>6835078
That's a high school explanation. Introducing him to the Caylay-Dickson construction is the real intuitive answer.

>> No.6838116

>>6835107
Do you have any idea what algorithm speed is?

>> No.6838118

>>6837242
>LEL I've seen some sperg shit, but its been awhile since it was this concentrated.

I, for once, would gladly welcome our new spergoverlords.

(BTW it's interesting how these days any criticism tends to result in a reaction that's either "omg racist" or "omg sperg".)

>> No.6838130

>>6838116
Which of his recommendations would compromise performance in your opinion?

>> No.6838137
File: 62 KB, 1604x678, why.png [View same] [iqdb] [saucenao] [google]
6838137

>>6834868
can someone explain why this happens with ops image? pic related.

>> No.6838168

>>6838091
Read the thread as a whole. It's crap code.

>> No.6838231

>>6835009

Orbital velocity etc.

>> No.6838250

>>6837254
>#include <iostream>
>void main(){
>printf("Get with the times Grandpa.");
>}

While your compiler may swallow it, "void main" is explicitly bad code in C++, main should always return an int, unless you are on a non-standard compiler (C99 allows you to do a few other things, and many embedded-system compilers will also accept "void main(void)" because main is never supposed to return on an embedded system).

>>>Stoustrup:
>>>http://www.stroustrup.com/bs_faq2.html#void-main

>>Can I write "void main()"?
>The definition
> void main() { /* ... */ }
>is not and never has been C++, nor has it even been C. See the ISO C++ standard 3.6.1[2] or the ISO C standard 5.1.2.2.1. A conforming implementation accepts
> int main() { /* ... */ }
>and
> int main(int argc, char* argv[]) { /* ... */ }

>> No.6838254

>>6835006
Hahaha, that's a funny one.

>> No.6838296

4 squirrels * 2 acorns = ?

>> No.6838302

>>6838137
BUMP for answers

>> No.6838306

>>6834868
No, numbers are not real, we(humans) made them up.

>> No.6838312

>>6835672
>>6835169
Thanks.

>> No.6838317

No. The world is real. Numbers are as real as the word "tomato". They are only man made accessories for describing the world

>> No.6838321

>>6838094
Third is also a good answer. But I'm afraid you are confusing significant with signifier

>> No.6838777

>>6838137
you niggas cant answer this?

>> No.6838840

>>6838089
double main(void *)
{
return NaN;
}

>> No.6838844

>>6838094
1 := S(0)

0 is the only real number.

>> No.6838861

>>6838137
>>6838302
>>6838777
I'm pretty sure they teach induction in high school you should be able to solve this.

>> No.6838887

>>6838844
So, all of the complex plane except for the point (0,0) is imaginary?

>> No.6838898

>>6838887
it's in the fuckin name, bro

IMAGINARY numbers

>> No.6839073

>>6834868
I rewrote the horrific code by OP.
It's c11, not iso c. Deal with it.
http://pastebin.com/itKKHjEx

>> No.6839108

>>6839073
>trying this hard
christ dude if it's just something to practice addition with you could have just foregone half his code to begin with.

>> No.6839115

>>6839108
There are several reasons the design of the program is terrible :p
I just rewrote the program for practice. Unlike OP, I like to write secure, good-looking code.

>> No.6839130

>>6839115
first-year cs undergrads who think they're the shit are so annoying. don't you have some fizzbuzz's to write or something?

>> No.6839145

>>6839130
I don't care whether or not I'm the shit.
I just think OP isn't the shit.

>> No.6839701

>>6839073
There's no security issue when scanning an integer, dummy. The only thing you might want to do is make sure that errno isn't set to ERANGE afterwards.

>> No.6840227
File: 384 KB, 488x600, 1401375492018.png [View same] [iqdb] [saucenao] [google]
6840227

>>6834868
How can numbers be real if operators aren't real?

>> No.6840228

>>6838898
complex != imaginary

>> No.6840324

>>6835007
Care to write it out how it should be written then?
Comp Sci Junior here, OP's code looks completely normal to me but I need pointers.

>> No.6840362

>>6840324
int main( void ) should be done over int main(), fscanf should be used over scanf and g should be declared and initialised inside the for loop declaration.

>> No.6840378

>>6840362
>int main( void )
Example of horrible bracketing. Don't do that, everthing becomes unreadable.

(captcha: wappons main)

>> No.6840387

>>6840378
Sorry. I worked with id software for a while, and it was their standard. That was also the last time I wrote a lot of C, so it's ingrained in me.

>> No.6840521

>>6840387
>id software
Interesting. When were you working with them, not long ago, or back in the old days?

(BTW from what I've seen in the Doom source code the bracketing seemed pretty inconsistent, sometimes leaving a space on one side and not the other, sometimes both, sometimes none, etc.)

>> No.6840539

>>6834868
>implying imaginary are real

with your code i wouldn't even mind getting zero scores

>> No.6840546

>>6838250
>"void main" explicitly bad code in c++
not for an elementary programming that does not return any value or simply not a dynamic program.