Emuforums.com

Go Back   Emuforums.com > General Discussion > Web development / Programming
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read

WON'T YOU JOIN US?
You are not a registered member and
are viewing this site as a guest.
Registration is simple and FREE.
Join this CrowdGather community today.
Registration offers the following perks:

» Less advertising throughout
» Post and participate in discussions
» Network with other forum members
» Free private messaging

join

Reply
 
Thread Tools Display Modes
Old December 4th, 2009, 03:06   #81
Fadingz
代言人
 
Fadingz's Avatar
 
Join Date: Dec 2006
Location: 應許之地
Posts: 7,056
I know, I even align my variables and constants LOL


like this:
Code:
    /* Fourth order Runge Kutta method */
    for ( int j = 0; j <= (Points - 1); j++ )
    {
        for ( int m = 0; m < 4; m++)
            for ( int n = 0; n < 3; n++ )
            {
                switch (m)
                {
                case 0:
                    X = initial[0];
                    Y = initial[1];
                    Z = initial[2];
                    break;
                case 1:
                    X = initial[0] + k[0][0] / 2;
                    Y = initial[1] + k[0][1] / 2;
                    Z = initial[2] + k[0][2] / 2;
                    break;
                case 2:
                    X = initial[0] + k[1][0] / 2;
                    Y = initial[1] + k[1][1] / 2;
                    Z = initial[2] + k[1][2] / 2;
                    break;
                case 3:
                    X = initial[0] + k[2][0];
                    Y = initial[1] + k[2][1];
                    Z = initial[2] + k[2][2];
                    break;
                }
                switch (n)
                {
                case 0:
                    k[m][n] = h * ( (float)SIGMA * ( Y - X ) );
                    break;
                case 1:
                    k[m][n] = h * ( X * ( (float)RHO - Z ) - Y );
                    break;
                case 2:
                    k[m][n] = h * ( X * Y - (float)BETA * Z );
                    break;
                }
            }
    }
I like it when it looks like 'switch (m)'
I hate it when it looks like 'switch (n)'


Isn't switch (m) beautiful? xDDDD~~~
*stares at switch(n)*
__________________
Fadingz is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old December 4th, 2009, 04:24   #82
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,385
hehe

something i do differently though, is i indent my cases from the 'switch'.
also, when i have just 1 statement on every switch case, i usually try to fit each case on one line (my widescreen monitor also lets me have wider-code)

i would probably write switch(n) something like this:

Code:
switch (n) {
    case 0: k[m][n] = h *((Y-X) * (float)SIGMA);         break;
    case 1: k[m][n] = h * (X    *((float)RHO  - Z) - Y); break;
    case 2: k[m][n] = h * (X*Y  - (float)BETA * Z );     break;
}
anyways when i see people that format stuff similar to me i automatically like their code.
well formatted code is sometimes just so nice to look at, so i totally understand what you mean when you say switch(m) is beautiful

ps.
if it was a hw assignment for uni, i would write switch(n) like this:
Code:
switch (n) {
    case 0: // Insert comment here
        k[m][n] = h * ( (float)SIGMA * ( Y - X ) );
        break;
    case 1: // Insert comment here
        k[m][n] = h * ( X * ( (float)RHO - Z ) - Y );
        break;
    case 2: // Insert comment here
        k[m][n] = h * ( X * Y - (float)BETA * Z );
        break;
}
switch cases are a good place to put comments on uni assignments i think xD
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog

Last edited by cottonvibes; December 4th, 2009 at 04:36..
cottonvibes is offline   Reply With Quote
Old December 4th, 2009, 04:30   #83
Fadingz
代言人
 
Fadingz's Avatar
 
Join Date: Dec 2006
Location: 應許之地
Posts: 7,056
'Art' of coding xD

I do the same when I put comments in switch :O


I might take your way to do single line cases xD
__________________
Fadingz is offline   Reply With Quote
Old December 4th, 2009, 04:39   #84
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,385
also another trick i like to use is on cases like this:
Code:
if (x != y)
    doCrap();
else {
    doSomeOtherCrap1();
    doSomeOtherCrap2();
}
i hate how that looks, so i have found you can save a line and make it look nicer if you write the opposite of the conditional first.

Code:
if (x == y) {
   doSomeOtherCrap1();
   doSomeOtherCrap2();
}
else doCrap();
Quote:
Originally Posted by Fadingz View Post
'Art' of coding xD

I do the same when I put comments in switch :O


I might take your way to do single line cases xD
lol

yeh coding is definitely an art.
well... depends on the person coding i guess.

there are some people that obviously don't think of it as art, as their code looks like crap, and they completely ignore formatting as well as being terribly inconsistent with the way they write their code.
for those people its just a tool to accomplish something.
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote
Old December 4th, 2009, 05:01   #85
fried_egg
Registered User
 
fried_egg's Avatar
 
Join Date: Apr 2007
Location: indiana
Posts: 694
mmm case statements beg for enums. and yeah, flipping the negative conditional is good practice.
fried_egg is offline   Reply With Quote
Old December 4th, 2009, 05:09   #86
Fadingz
代言人
 
Fadingz's Avatar
 
Join Date: Dec 2006
Location: 應許之地
Posts: 7,056
Quote:
Originally Posted by cottonvibes View Post
also another trick i like to use is on cases like this:
Code:
if (x != y)
    doCrap();
else {
    doSomeOtherCrap1();
    doSomeOtherCrap2();
}
i hate how that looks, so i have found you can save a line and make it look nicer if you write the opposite of the conditional first.

Code:
if (x == y) {
   doSomeOtherCrap1();
   doSomeOtherCrap2();
}
else doCrap();
lol

yeh coding is definitely an art.
well... depends on the person coding i guess.

there are some people that obviously don't think of it as art, as their code looks like crap, and they completely ignore formatting as well as being terribly inconsistent with the way they write their code.
for those people its just a tool to accomplish something.
I definitely do that for a lot of my if/else statement
I always like my else statement to be one line if possible xD
omg we have a lot of taste in common, don't we? XP~

I hate the naming convention of a lot of people too, besides format.
__________________
Fadingz is offline   Reply With Quote
Old December 4th, 2009, 05:13   #87
Fadingz
代言人
 
Fadingz's Avatar
 
Join Date: Dec 2006
Location: 應許之地
Posts: 7,056
for bool functions,
I do
Code:
bool func(int x, int y)
{
     return
          (x == y)
       && (x > CONST);
}
instead of
Code:
bool func(int x, int y)
{
     if (x == y && x > CONST)
          return true;
     else return false;
}
As well.
It's less calculation, easier to read, looks nicer. xD
__________________
Fadingz is offline   Reply With Quote
Old December 4th, 2009, 05:16   #88
Proto
Knowledge is the solution
 
Proto's Avatar
 
Join Date: Dec 2002
Location: Pittsburgh, US. Previously in Mexico City
Posts: 7,160
Quote:
for others its apparently seeing less since they like to spread out their code like writing a double spaced college essay
If you don't try to at least be neutral some people won't take you seriously. The secret of "overly verbose code", is just following a coding guidelines that just says that every line should only apply one change to the code context, (except for standardized structures like the for initialization, etc). Doing it that way makes it incredibly easy for anyone to follow an algorithm, since they can see line per line what a program is doing. Trying to stuff 30 changes into a single line doesn't really do anything for code efficiency and does nothing for other programmers who will look later at your code. Although I don't advocate either extreme, I tend to lean more towards being a little more verbose than necessary so that anyone can eventually look into my code and extend it (and hence my papers get more citations )
__________________
Proto is offline   Reply With Quote
Old December 4th, 2009, 05:19   #89
Fadingz
代言人
 
Fadingz's Avatar
 
Join Date: Dec 2006
Location: 應許之地
Posts: 7,056
Well, I rely a lot on comments on helping readers.
One thing I hate about verbose code is that it usually slows down the speed.
__________________
Fadingz is offline   Reply With Quote
Old December 4th, 2009, 05:57   #90
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,385
Quote:
Originally Posted by Fadingz View Post
It's less calculation, easier to read, looks nicer. xD
heh
i would just do:
Code:
bool func(int x, int y) {
     return (x == y) && (x > CONST);
}
myself xD

btw another cool trick you can do in c++ when dealing with integers and you need to convert them to bool you can do this:
Code:
int  a = 140;
bool b = !!a; // makes b == true
you can also use this trick to get 1/0 results from integers
Code:
int a = 140;
int b = !!a; // b == 1
obviously in these examples its useless, but you can do cool bitwise tricks using this technique; like setting individual bits based on some integer.

a quick example is say you had the following code:
Code:
int a = 140;
int b;
if (a) { b = 8; }
else   { b = 0; }
you can write the same code w/o even using any conditionals!
Code:
int a = 140;
int b = (!!a) << 3; // b == 8
now that's cool i think xD
i love cool bitwise tricks like that.
languages like c#/java limit tremendously how much cool tricks you can do (you can't do the above in c#/java).

Quote:
Originally Posted by Proto View Post
If you don't try to at least be neutral some people won't take you seriously.
i didn't really think my comment was offensive, but i was trying to think of what it reminds me of, and that came to mind

anyways i've mainly just been talking about my preferences, i'm not saying my preferences are the correct way to do something, but rather its how i like it.
i know great coders that like to code more spaced out than me; i don't try and convince them my way is better, but i do try to defend my style when its criticized.

most coders like to code the spaced-out way. compactness is more rare so it needs more defending xD

Quote:
Originally Posted by Proto View Post
The secret of "overly verbose code", is just following a coding guidelines that just says that every line should only apply one change to the code context, (except for standardized structures like the for initialization, etc). Doing it that way makes it incredibly easy for anyone to follow an algorithm, since they can see line per line what a program is doing. Trying to stuff 30 changes into a single line doesn't really do anything for code efficiency and does nothing for other programmers who will look later at your code. Although I don't advocate either extreme, I tend to lean more towards being a little more verbose than necessary so that anyone can eventually look into my code and extend it (and hence my papers get more citations )
hmm.
when i've been specifically talking about 'overly verbose' its different than the way you defined it.

there is some code in pcsx2 for example that is very bloated, in terms of "it has way more code than needed to accomplish the same task".

a quick good example is what fadingz showed:
comparing something like this:
Code:
bool foo() { return x==y; }
compared to:
Code:
bool foo() {
    if (x==y) return true;
    else      return false;
}
the second way is needlessly more verbose, regardless of how you format it.
it is like just blurting out w/e pops into your head first and writing it down; instead i always try and optimize it to get a nice consice result like the above.

now that is a very simple example, but imagine now 5k lines of someone that codes in a bloated way, has silly inefficient algorithms, and has stuff formatted terribly (i mean like not even lining up the start of lines; and not caring about it)
once you imagine that you get some of the old source files i've seen in pcsx2.
i won't link them to protect the authors identity though ;p
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote
Old December 4th, 2009, 06:07   #91
Proto
Knowledge is the solution
 
Proto's Avatar
 
Join Date: Dec 2002
Location: Pittsburgh, US. Previously in Mexico City
Posts: 7,160
Quote:
btw another cool trick you can do in c++ when dealing with integers and you need to convert them to bool you can do this:
Code:
int  a = 140;
bool b = !!a; // makes b == true
you can also use this trick to get 1/0 results from integers
Code:
int a = 140;
int b = !!a; // b == 1
obviously in these examples its useless, but you can do cool bitwise tricks using this technique; like setting individual bits based on some integer.

a quick example is say you had the following code:
Code:
int a = 140;
int b;
if (a) { b = 8; }
else   { b = 0; }
you can write the same code w/o even using any conditionals!
Code:
int a = 140;
int b = (!!a) << 3; // b == 8
now that's cool i think xD
i love cool bitwise tricks like that.
languages like c#/java limit tremendously how much cool tricks you can do (you can't do the above in c#/java).
Well, I like that trick, but that's because I program in architectures where using conditional statements and loops can actually come with a heavy performance penalty, so cool tricks like that actually boost performance. But in architectures like the x86 where conditional statements don't really take much more processing that a goto in assembly code that's just overkill. (since the compiler will optimize that for you anyway, so there's no real performance gain).

Well, in any case i won't push the point any further since we seem to have reached a deadlock here. Just for the record, where I actually use tricks like that for any particular reason (performance, trying to compact code, etc), I always try to leave a more extended version of the code as a comment for people to know what's going on.

@the pcsx2 example: Well that's an example I can agree with, though more than being verbose that is just plain redundant.
__________________

Last edited by Proto; December 4th, 2009 at 06:14..
Proto is offline   Reply With Quote
Old December 4th, 2009, 06:33   #92
@ruantec
Crazy GFX coder
 
@ruantec's Avatar
 
Join Date: Nov 2002
Location: Dominican Republic/Austria
Posts: 8,101
Quote:
Originally Posted by cottonvibes View Post
apparently you want to start another argument with me; or else you wouldn't write that.
mmmm if that were the case i wouldnīt have written that way and you know that from our previous posts in other threads. anyways i said that the text there gives the feeling like you really think to be superior than your teacher which i said "i doubt".

am not trying to start a fight over here as iīve been trying to finally establish a normal conversation and debate. i really understand/accept/agree or whatever your preference is that you like to code things unnecessarily complicated/unreadable/compact but somehow am under the impression that you actually think that technique makes you "cool" or more "advanced" and i just donīt think its that way.

if thatīs not the case than just ignore the above text.

Quote:
Originally Posted by cottonvibes View Post
now that's cool i think xD
i love cool bitwise tricks like that.
languages like c#/java limit tremendously how much cool tricks you can do (you can't do the above in c#/java).
mmmm well the word "limit" always bother me you know??? because it could give the impression to others that may not mature in the materia that those languages are "limited" but in other things and not on the area you actually mean.. cool tricks are fine but sometimes those are not relevant for coding. just by instance i want to mention a small comparison about VB6 and VB.Net. since youīre a VB coder yourself you will know that there are several tricks that can be done in VB6 that canīt be accomplish anymore in VB.Net.

for example you can declare a variable as "Optional" or even as "Any", while this ability may be cool sometimes it doesnīt make much sense just like the "Option Explicit" to Force explicit declaration of all variables in a file just because by default its not that way... also that doesnīt mean VB.Net is "limited" by any means.

again this is just my point of view and by any means an attack and i really have no idea why we keep misunderstanding each other

Quote:
Originally Posted by cottonvibes View Post
most coders like to code the spaced-out way. compactness is more rare so it needs more defending xD
i agree with that and i think its the right way to think.
__________________


Current development tools:

Visual C++.net, Visual C#.net
Visual VB.net, Visual Webdeveloper.net
Bloodshed Dev C++, Borland C++
Visual Basic 6

Last edited by @ruantec; December 4th, 2009 at 06:55..
@ruantec is online now   Reply With Quote
Old December 4th, 2009, 07:15   #93
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,385
Quote:
Originally Posted by Proto View Post
Well, I like that trick, but that's because I program in architectures where using conditional statements and loops can actually come with a heavy performance penalty, so cool tricks like that actually boost performance. But in architectures like the x86 where conditional statements don't really take much more processing that a goto in assembly code that's just overkill. (since the compiler will optimize that for you anyway, so there's no real performance gain).
in the example i gave its indeed overkill, but i was just trying to explain the potential it has.

tbh, i don't know what the code ends up compiling to though on x86-32. all i know is that in certain situations it is more compact to use than explicitly using conditionals.
it might end up using some variation of SETcc in the compiled result... its possible it would be a slowdown in some cases as well...

when you think about conditional jumps though you have to think about branch prediction. jumps are fast if branch is predicted correctly, but you get a hit on misses. current cpus have very sophisticated and fast jumps though.

your work with CUDA sounds interesting.
the architecture sounds like something where a lot of bitwise tricks would come in handy.
maybe someday i'll work with CUDA and see first hand though xD
but currently i have a lot of other stuff i wish to learn that comes first

Quote:
Originally Posted by Proto View Post
Well, in any case i won't push the point any further since we seem to have reached a deadlock here. Just for the record, where I actually use tricks like that for any particular reason (performance, trying to compact code, etc), I always try to leave a more extended version of the code as a comment for people to know what's going on.
yeh i sometimes use comments when i do stuff like that too.

i don't like the term deadlock as i don't really feel like i've been arguing here, but rather just expressing my opinions in a conversation about programming xD
ideally i want to learn more tricks similar to what i post, which is why i constantly try to promote conversation; even if it may sound like i'm being an elitist or what not...

generally in our pcsx2 dev channel we have a lot of random coding conversations, and talk about cool tricks and different ways to code stuff... when i learn a cool new trick i find it really exciting and go on to use it when the situation comes up.

Quote:
Originally Posted by @ruantec View Post
i really understand/accept/agree or whatever your preference is that you like to code things unnecessarily complicated/unreadable/compact but somehow am under the impression that you actually think that technique makes you "cool" or more "advanced" and i just donīt think its that way.
i believe the more experience you have and the better you get at coding, the more your style evolves.
my code now looks a lot different from 3 years ago, and obviously a whole lot different than 10 years ago when i started coding with vb.

eventually you do learn advanced tricks besides just the 'basics'.
if not then you have not progressed as a coder.

i love learning new advanced tricks, and i like sharing what i have learned. by having such conversations, everyone wins.

even through debates (and sometimes arguments) you can learn new things.
i have had debates with many people here, i used to be known for debating with thanakil all the time about random stuff; yet thanakil always brought up great support for his claims and i would learn new information.

the problem is when people don't support their claims with any useful information. when that happens nobody learns any real knowledge, but instead they just hear the opinions of another individual.

i want to learn; and what i want to learn about is programming techniques, tricks, architecture, and cool stuff...

i should also note that i get angry when people spread false information to others that don't know enough to know its incorrect.
its common for people new to programming to just blindly believe other more-experienced coders statements; regardless if they're correct or not.
in those cases i don't hesitate to point out the flaws in the original arguments; i mainly do this to stop the spread of incorrect knowledge.
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote
Old December 4th, 2009, 07:26   #94
Proto
Knowledge is the solution
 
Proto's Avatar
 
Join Date: Dec 2002
Location: Pittsburgh, US. Previously in Mexico City
Posts: 7,160
Well, in appreciation or the trick you gave me here is one of mine. (though maybe you already know it) How to divide (or multiply) by powers of 2 without doing any divisions at all:
given a dividend 'x' and a divisor 'y' that is a power of 2.

int divisor = ffs(y) -1; //*
int result = x >> divisor; //nothing new here.

* (find first set, which obtains the position of the first set bit (bit that is one) starting from the fist significant bit. Complete with the -1 returns a result equal to doing log(y)/log(2)).

This is useful in GPU's since divisions are an operation that takes as much as 4 to 16 times (depending on the precision) than a bitwise/add/multiply operation.
__________________
Proto is offline   Reply With Quote
Old December 4th, 2009, 07:29   #95
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,385
Quote:
Originally Posted by @ruantec View Post
mmmm well the word "limit" always bother me you know??? because it could give the impression to others that may not mature in the material that those languages are "limited" but in other things and not on the area you actually mean.. cool tricks are fine but sometimes those are not relevant for coding.
the other languages are limited, but many times it is these limitations that make them simpler and more appealing.
also, for beginners they will not know enough to know that their language is limited.

there is an old chinese saying: "the frog in the well won't know the ocean."
essentially saying that people won't know more than what they've seen/learned/experienced.

its true that beginner coders could misunderstand when i talk about other languages being limited; but i am having conversations here with people already familiar with coding, not beginners.

also, in many threads involving which languages people should learn programming with, i always recommend stuff like vb/java/c#.
to a beginner, c++ is evil and the difficulty might scare them off from programming.
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote
Old December 4th, 2009, 07:46   #96
serge2k
Registered User
 
Join Date: Sep 2006
Location: surrey
Posts: 111
Quote:
Originally Posted by Fadingz View Post
for bool functions,
I do
Code:
bool func(int x, int y)
{
     return
          (x == y)
       && (x > CONST);
}
instead of
Code:
bool func(int x, int y)
{
     if (x == y && x > CONST)
          return true;
     else return false;
}
As well.
It's less calculation, easier to read, looks nicer. xD
ahahaha

just yesterday we got a bit of a lecture about using

if(b.e.) return false
else return true.

basically it was use return b.e. instead.
serge2k is offline   Reply With Quote
Old December 4th, 2009, 07:48   #97
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,385
Quote:
Originally Posted by Proto View Post
Well, in appreciation or the trick you gave me here is one of mine. (though maybe you already know it) How to divide (or multiply) by powers of 2 without doing any divisions at all:
given a dividend 'x' and a divisor 'y' that is a power of 2.

int divisor = ffs(y) -1; //*
int result = x >> divisor; //nothing new here.

* (find first set, which obtains the position of the first set bit (bit that is one) starting from the fist significant bit. Complete with the -1 returns a result equal to doing log(y)/log(2)).

This is useful in GPU's since divisions are an operation that takes as much as 4 to 16 times (depending on the precision) than a bitwise/add/multiply operation.
ah yeah definitely familiar with that one.
although your in-depth explanation using ffs() made me question if i was

a shift is always nicer than a divide/mul operation when applicable on pretty much any current hw.
that only works with integers however; when working with CUDA i assume most of the time you work with floats which obviously you can't do that trick with.


anyways in a related note, i'm sure you probably know about the & trick to do modulus with powers of 2.
quick example:
11 % 8 == 11 & (8-1)

also by the same principal you can easily tell if a number if even/odd by using an AND.
if (n & 1) // is odd
else // is even

when i learned about that i thought it was interesting xD
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote
Old December 4th, 2009, 08:01   #98
Proto
Knowledge is the solution
 
Proto's Avatar
 
Join Date: Dec 2002
Location: Pittsburgh, US. Previously in Mexico City
Posts: 7,160
Yup, I knew about that one. Actually all those tricks that dance around divide and modulus are all things we have to do everyday unfortunately, given the low performance of those operations on the GPU.

Quote:
that only works with integers however; when working with CUDA i assume most of the time you work with floats which obviously you can't do that trick with.
Nah, fortunately CUDA supports (1,2 and 3 dimentional) intergers and floats (and chars, and shorts). And since a few versions ago we got full double precision support. Yay.
__________________
Proto is offline   Reply With Quote
Old December 4th, 2009, 08:10   #99
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,385
Quote:
Originally Posted by Proto View Post
Nah, fortunately CUDA supports (1,2 and 3 dimentional) intergers and floats (and chars, and shorts). And since a few versions ago we got full double precision support. Yay.
oh nice; that sounds more fun.

there's something interesting about using the gpu to do floating point calculations regarding ps2 emulation.
the ps2 does not support nan/inf float values, neither does cuda afaik.
i believe cuda treats this range as just normal floating point values; which the ps2 does as well.

many problems on pcsx2 are due to x86-32 cpus supporting inf/nans. so potentially running the calculations on the gpu would fix that (of course its unpractical due to the overhead; CUDA's benefit is when running many parallel calculations, which emulation isn't suited for).
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote
Old December 4th, 2009, 08:21   #100
@ruantec
Crazy GFX coder
 
@ruantec's Avatar
 
Join Date: Nov 2002
Location: Dominican Republic/Austria
Posts: 8,101
Quote:
Originally Posted by cottonvibes View Post
the other languages are limited, but many times it is these limitations that make them simpler and more appealing.
also, for beginners they will not know enough to know that their language is limited.
mmmm could you explain me what exactly do you mean by "limited" ??? thatīs the main problem i kept misunderstanding you because what you call "limits" its not what i see as limited but in fact different approach and changes that are there for a reason(just as i explained with the VB6 vs VB.Net example).

Quote:
Originally Posted by cottonvibes View Post
its true that beginner coders could misunderstand when i talk about other languages being limited; but i am having conversations here with people already familiar with coding, not beginners.
i agree again here but the fact is that lots of beginners are watching this thread that has turned into a very interesting one and thatīs undeniable.

Quote:
Originally Posted by cottonvibes View Post
also, in many threads involving which languages people should learn programming with, i always recommend stuff like vb/java/c#.
to a beginner, c++ is evil and the difficulty might scare them off from programming.
i donīt consider C++ as evil and as i previously posted here i recommend anyone to learn that language as they could benefit from it. my only issue/problem/misunderstanding or whatever you want to call it with you is that i donīt keep calling languages "limited" just because they do not allow something that may be not of importance to others or at all just because you think is "Right" or like it.
__________________


Current development tools:

Visual C++.net, Visual C#.net
Visual VB.net, Visual Webdeveloper.net
Bloodshed Dev C++, Borland C++
Visual Basic 6

Last edited by @ruantec; December 4th, 2009 at 08:33..
@ruantec is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 13:21.

© 2006 - 2012 Emu Forums | About Emu Forums | Advertisers | Investors | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.