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, 08:34   #101
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 could you explain me what exactly what 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).
limited is that it doesn't support certain features another language has.
i've given a lot of examples already.

yes many times you can do a workaround and do something another way, but that is not the point.
the language is still limited in that it doesn't support 'xyz'.

the more limited a language is, the less ways there is to accomplish a certain task.
i don't like having only '1 way' to do something, i like having multiple ways and doing it the way i like.

as i said to fadingz, i think programming is an art.
if you only have 1 way to do something however, that is not art, instead it is just 'the way' to accomplish a task.
anyways i'm really tired now; been talking for hours in this thread lol
__________________

"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

Advertisement [Remove Advertisement]
Old December 4th, 2009, 08:40   #102
@ruantec
Crazy GFX coder
 
@ruantec's Avatar
 
Join Date: Nov 2002
Location: Dominican Republic/Austria
Posts: 8,099
mmm i think i got ya this time..... still i think people can misunderstand the word "limited" the way you put it in your words. even though such techniques are great for private Projects but when working on something real they are useless. anyways i think thatīs something you will learn through the years i guess(i wasnīt any different than you in the past tho.).

i have to say i admire your point of view on trying to find different ways and the "Think different" view... besides that was actually the point i wanted to make clear in the other thread where everybody misunderstood my point because i posted about my "Think different" view... just as you, i like to find and do things differently but because of my bad English people totally misunderstood my point.

just as you explained i try to "STOP" bad/wrong idealism spread-ed over here too. while your "Style" and techniques are fun for you i donīt think its a good practice to spread around and atm thatīs all iīve seen so far because its an awesome technique to toy with on your private stuff but definitely not a good practice for a beginner or someone that wants to build a future in the programming world.

Quote:
Originally Posted by fried_egg View Post
yeah. bloated code is different from code that is overly verbose. if you use more lines to express the exact equivalent statements, that is not code bloat. and sorry for correcting your grammar @ruantec. its not an attack on you, but red squiggly lines really bother me.
thatīs fine

i donīt feel attacked because of my bad english as i recognize is bad.. still am doing my best to write down my thoughts as good as i can
__________________


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 09:54..
@ruantec is offline   Reply With Quote
Old December 4th, 2009, 14:25   #103
Proto
Knowledge is the solution
 
Proto's Avatar
 
Join Date: Dec 2002
Location: Pittsburgh, US. Previously in Mexico City
Posts: 7,160
Quote:
the ps2 does not support nan/inf float values, neither does cuda afaik.
Nah, it does support them(slide 12), and representation is IEEE 754 compliant AFAIK. (in fact this is a feature of the GPU more than being CUDA's).

So no, you can't use the GPU as your friendly inferior architecture in this case.
__________________

Last edited by Proto; December 4th, 2009 at 14:33..
Proto is offline   Reply With Quote
Old December 4th, 2009, 18:01   #104
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, it does support them(slide 12), and representation is IEEE 754 compliant AFAIK. (in fact this is a feature of the GPU more than being CUDA's).

So no, you can't use the GPU as your friendly inferior architecture in this case.
well that first like you gave isn't working for me.

but from wikipedia:
Quote:
In single precision, Denormals and signalling NaNs are not supported; only two IEEE rounding modes are supported (chop and round-to-nearest even), and those are specified on a per-instruction basis rather than in a control word; and the precision of division/square root is slightly lower than single precision.
so i guess while it doesn't have sNaNs, it probably still has qNaNs.
oh well that just means its totally worthless for pcsx2 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, 18:33   #105
Proto
Knowledge is the solution
 
Proto's Avatar
 
Join Date: Dec 2002
Location: Pittsburgh, US. Previously in Mexico City
Posts: 7,160
Sorry, that was just the query i was using when searching a reference about this. The link I was referring to are these slides, but still what you were referring to is true, there do are some weird deviations from the IEE 754 for single precision and even for double precision. I have not yet read the changes CUDA 3.0 will include, so maybe some of the deviations from the standard will be solved, but in any case I guess this makes it even more useless for what you need.
__________________

Last edited by Proto; December 4th, 2009 at 21:17..
Proto is offline   Reply With Quote
Old December 4th, 2009, 19:10   #106
Fadingz
代言人
 
Fadingz's Avatar
 
Join Date: Dec 2006
Location: 應許之地
Posts: 7,056
Quote:
Originally Posted by serge2k View Post
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.
In your case, it will be
return !(b.e.) :]
__________________
Fadingz is offline   Reply With Quote
Old December 4th, 2009, 21:23   #107
serge2k
Registered User
 
Join Date: Sep 2006
Location: surrey
Posts: 111
whoops.

I'm finding Smalltalk to be fairly interesting right now. I'm just trying to put together a small (really small) program for comparison with Java. It's a pretty easy language.
serge2k is offline   Reply With Quote
Old December 14th, 2009, 01:09   #108
raksmey1309
បងស្រលាញ់អូន!
 
raksmey1309's Avatar
 
Join Date: Jul 2005
Location: ព្រះរាជាណាចក្រកម្ពុជា
Posts: 4,111
This is the loop version i can only write part of it.The code is if we input between 1 to 3 it is true and shows "Your Input is"+i.
I want to write other part if it is false (i>3) and i want it to show your "input >3 try again" and i want it to start again(press "Y"to continue and "N" to Quit.How do i do that please help!
Code:
for (int i=1 ; i = int.Parse(tbInput.Text) && i > = 1 && i <= 3 ; i++)
lbl.Text("Your Input is"+i) ;
__________________
I am the keyblade that, hopefully, will unlock your heart someday.

Proud to be Asian, proud to be Cambodian.
CPU: intel Core i7 3770 - GPU: nVidia GTX 660
M/B: Asrock Extreme 4M - RAM: DDR3 8GB bus 1600 MHz
HDD: 3TB SATA 3 7200rpm - Windows 7 64bits SP1
raksmey1309 is offline   Reply With Quote
Old December 14th, 2009, 02:20   #109
Fadingz
代言人
 
Fadingz's Avatar
 
Join Date: Dec 2006
Location: 應許之地
Posts: 7,056
Code:
if ( input > 3 )
     lbl.Text( "Your input is greater than 3" );
else if ( input < 1 )
     lbl.Text( "Your input is smaller than 1" );
else
     lbl.Text( "Your input is" input );
I'd do this.
or
Code:
switch (input)
{
     case 1:
     case 2:
     case 3:
          lbl.Text( "Your input is" input );
          break;
     default:
          lbl.Text( "Your input is greater than 3 or smaller than 1" );
}
__________________
Fadingz is offline   Reply With Quote
Old January 8th, 2010, 02:55   #110
raksmey1309
បងស្រលាញ់អូន!
 
raksmey1309's Avatar
 
Join Date: Jul 2005
Location: ព្រះរាជាណាចក្រកម្ពុជា
Posts: 4,111
I wrote this in C++.What it do is it solve this kind of equation for you. ax^2+bx+c=0
Just input a,b and c you will get the root x1 and x2.Lolz i am addicted to coding i spent my beautiful sleep last night for this. XD
I have one question i use Turbo C++ 4.5 is it good for editor and compiler?

Code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
float a,b,c,x1,x2,deta;

printf("Enter a ");
scanf("%f",&a);
printf("Enter b ");
scanf("%f",&b);
printf("Enter c ");
scanf("%f",&c);
deta=b*b-4*a*c;
printf("deta is %.2f\n",deta);

if(deta<0)
{
printf("no root\n");
}
else
{
if(deta==0)
{
x1=-b/(2.0*a);
printf("x1=x2=%.2f\n",x1);
}
else
{
x1=(-b+sqrt(deta))/(2.0*a);
x2=(-b-sqrt(deta))/(2.0*a);
printf("x1=%.2f\n",x1);
printf("x2=%.2f\n",x2);
}

}
getch();
return 0;
}
__________________
I am the keyblade that, hopefully, will unlock your heart someday.

Proud to be Asian, proud to be Cambodian.
CPU: intel Core i7 3770 - GPU: nVidia GTX 660
M/B: Asrock Extreme 4M - RAM: DDR3 8GB bus 1600 MHz
HDD: 3TB SATA 3 7200rpm - Windows 7 64bits SP1
raksmey1309 is offline   Reply With Quote
Old January 8th, 2010, 05:54   #111
blueshogun96
Last Xbox Emu Author
 
blueshogun96's Avatar
 
Join Date: Jun 2004
Location: Seattle, WA, USA
Posts: 5,843
Dynarec 101: This code creates a code "block", writes x86 instructions to it in byte form, inserts a call to a standard C/C++ function, then executes it. It took me a long time to get it right, so if you're writing a dynarec core for the first time, hopefully this will help a bit.

Just remember that x86 is little endian and every parameter is pushed on the stack from last to beginning in that order. When you're done, pop each value off the stack before you call return or else it will crash.

Code:
#include <stdio.h>
#include <malloc.h>

void func( unsigned int param1 )
{
	printf( "Function called\nParam1 = %d\n\n", param1 );
}

int main( void )
{
	void (*f)(unsigned int) = &func;
	unsigned int func_addr = (unsigned int) f;
	unsigned char* code = (unsigned char*) malloc( sizeof( unsigned char ) * 64 );
	unsigned int code_addr = (unsigned int&) code;
	int pc = 0;

	printf( "Function address = 0x%8.8X\n", func_addr );
	printf( "Code address = 0x%8.8X\n", code_addr );

	code[pc++] = 0x68;		// push imm32
	code[pc++] = 0xFF;
	code[pc++] = 0x00;
	code[pc++] = 0x00;
	code[pc++] = 0x00;

	unsigned int offset = func_addr - ( code_addr + 5 + pc );
	printf( "Offset = 0x%8.8X\n", offset );

	code[pc++] = 0xE8;		// call offset
	code[pc++] = ((offset>>0)&0xFF);
	code[pc++] = ((offset>>8)&0xFF);
	code[pc++] = ((offset>>16)&0xFF);
	code[pc++] = ((offset>>24)&0xFF);

	code[pc++] = 0x58;		// pop eax

	code[pc++] = 0xC3;		// ret

	void (*Execute)(void) = (void(*)()) code;

	Execute();

	free( code );

	return 0;
}
__________________

Official Website of Shogun3D's RyuAwai!

Shogun3D Game Development Blog

Zengjük a Dalt: Manliest Song Ever!
blueshogun96 is offline   Reply With Quote
Old January 8th, 2010, 15:25   #112
fried_egg
Registered User
 
fried_egg's Avatar
 
Join Date: Apr 2007
Location: indiana
Posts: 694
Quote:
Originally Posted by raksmey1309 View Post
I wrote this in C++.What it do is it solve this kind of equation for you. ax^2+bx+c=0
Just input a,b and c you will get the root x1 and x2.Lolz i am addicted to coding i spent my beautiful sleep last night for this. XD
I have one question i use Turbo C++ 4.5 is it good for editor and compiler?

Code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
float a,b,c,x1,x2,deta;

printf("Enter a ");
scanf("%f",&a);
printf("Enter b ");
scanf("%f",&b);
printf("Enter c ");
scanf("%f",&c);
deta=b*b-4*a*c;
printf("deta is %.2f\n",deta);

if(deta<0)
{
printf("no root\n");
}
else
{
if(deta==0)
{
x1=-b/(2.0*a);
printf("x1=x2=%.2f\n",x1);
}
else
{
x1=(-b+sqrt(deta))/(2.0*a);
x2=(-b-sqrt(deta))/(2.0*a);
printf("x1=%.2f\n",x1);
printf("x2=%.2f\n",x2);
}

}
getch();
return 0;
}
this is called a quadratic equation, and if the discriminant ( b^2 - 4ac) is less than zero, there are roots. they are just not real roots.
fried_egg is offline   Reply With Quote
Old January 8th, 2010, 16:03   #113
raksmey1309
បងស្រលាញ់អូន!
 
raksmey1309's Avatar
 
Join Date: Jul 2005
Location: ព្រះរាជាណាចក្រកម្ពុជា
Posts: 4,111
That is called delta<0
__________________
I am the keyblade that, hopefully, will unlock your heart someday.

Proud to be Asian, proud to be Cambodian.
CPU: intel Core i7 3770 - GPU: nVidia GTX 660
M/B: Asrock Extreme 4M - RAM: DDR3 8GB bus 1600 MHz
HDD: 3TB SATA 3 7200rpm - Windows 7 64bits SP1
raksmey1309 is offline   Reply With Quote
Old January 9th, 2010, 00:57   #114
raksmey1309
បងស្រលាញ់អូន!
 
raksmey1309's Avatar
 
Join Date: Jul 2005
Location: ព្រះរាជាណាចក្រកម្ពុជា
Posts: 4,111
Here is C# version. Only 1 error Please help me with below in bold text taken from the whole code why when i use "-" it gives me error "-" cannot apply to float and string but it works with "+". O_O what is wrong here?


txtx2.Text = -float.Parse(txtb.Text) - System.Math.Sqrt(float.Parse(txtdeta.Text) / 2 * float.Parse(txta.Text)).ToString();

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CSharpdeta
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            txtdeta.Text = (System.Math.Pow(float.Parse(txtb.Text), 2) - 4 * float.Parse(txta.Text) * float.Parse(txtc.Text)).ToString();
            if (float.Parse(txtdeta.Text) < 0)
                MessageBox.Show("No Root");

            else if (float.Parse(txtdeta.Text) == 0)
            {
                txtx1.Text = (-float.Parse(txtb.Text) / 2 * float.Parse(txta.Text)).ToString();
                txtx2.Text = txtx1.Text;
            }

            else
            {
                txtx1.Text = -float.Parse(txtb.Text) + System.Math.Sqrt(float.Parse(txtdeta.Text) / 2 * float.Parse(txta.Text)).ToString();
                txtx2.Text = -float.Parse(txtb.Text) - System.Math.Sqrt(float.Parse(txtdeta.Text) / 2 * float.Parse(txta.Text)).ToString();
            }
        }
    }
}
__________________
I am the keyblade that, hopefully, will unlock your heart someday.

Proud to be Asian, proud to be Cambodian.
CPU: intel Core i7 3770 - GPU: nVidia GTX 660
M/B: Asrock Extreme 4M - RAM: DDR3 8GB bus 1600 MHz
HDD: 3TB SATA 3 7200rpm - Windows 7 64bits SP1
raksmey1309 is offline   Reply With Quote
Old January 9th, 2010, 01:57   #115
cooliscool
Global Moderator
 
cooliscool's Avatar
 
Join Date: Jul 2001
Location: SC, USA
Posts: 7,231
uot - Project Hosting on Google Code

My Zelda 64 Editor's SVN.
__________________
cooliscool is offline   Reply With Quote
Old January 11th, 2010, 01:31   #116
raksmey1309
បងស្រលាញ់អូន!
 
raksmey1309's Avatar
 
Join Date: Jul 2005
Location: ព្រះរាជាណាចក្រកម្ពុជា
Posts: 4,111
I wrote in C: I have fun with loop abit lolz.
I will learn array next week cant wait.
Coding if damn fun than playing games lolz i spent time coding than gaming now. XD
What it do is input the 5 subjects score it will sum the scores give you total,average,and grade.

Code:
#include <stdio.h>
#include <conio.h>
void main()
{
float score,total=0,avg;
for(int i=1;i<=5;i++)
{printf("Intput your %d subject:",i);
 scanf("%f",&score);
total=total+score;

 }
 printf("Total Score is %.2f\n",total) ;
avg=total/5;
printf("Avg is %.2f\n",avg);
if(avg>100)
 {
  printf("Wrong");
  }

else if(avg>=90)
 {
 printf("A");
 }
 else if(avg>=80)
 {
 printf("B");
 }
 else if(avg>=70)
 {
 printf("C");
 }
 else if(avg>=60)
 {
 printf("D");
 } else if(avg>=50)
 {
 printf("E");
 }
  else if(avg<50)
 {
 printf("F");
 }
And this is C# windows form application.
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Score
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            txttotal.Text = (float.Parse(txtcom.Text) + float.Parse(txtEng.Text) + float.Parse(txtmath.Text)).ToString();
            txtavg.Text = (float.Parse(txttotal.Text) / 3).ToString();
            float i = float.Parse(txtavg.Text);

            if (i > 100)
                txtgrade.Text = "wrong";
            
                else if (i >= 90)
                    txtgrade.Text = "A";
                else if (i >= 80)
                    txtgrade.Text = "B";
                else if (i >= 70)
                    txtgrade.Text = "C";
                else if (i >= 60)
                    txtgrade.Text = "D";
                else if (i <= 50)
                    txtgrade.Text = "F";

               
            


        }
    }
}
__________________
I am the keyblade that, hopefully, will unlock your heart someday.

Proud to be Asian, proud to be Cambodian.
CPU: intel Core i7 3770 - GPU: nVidia GTX 660
M/B: Asrock Extreme 4M - RAM: DDR3 8GB bus 1600 MHz
HDD: 3TB SATA 3 7200rpm - Windows 7 64bits SP1

Last edited by raksmey1309; January 12th, 2010 at 00:39..
raksmey1309 is offline   Reply With Quote
Old January 11th, 2010, 09:37   #117
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,385
raksmey1309:
it would be easier to read if you used the [code] tags instead of [quote]
__________________

"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 January 12th, 2010, 00:39   #118
raksmey1309
បងស្រលាញ់អូន!
 
raksmey1309's Avatar
 
Join Date: Jul 2005
Location: ព្រះរាជាណាចក្រកម្ពុជា
Posts: 4,111
Edited lolz. :shy:
__________________
I am the keyblade that, hopefully, will unlock your heart someday.

Proud to be Asian, proud to be Cambodian.
CPU: intel Core i7 3770 - GPU: nVidia GTX 660
M/B: Asrock Extreme 4M - RAM: DDR3 8GB bus 1600 MHz
HDD: 3TB SATA 3 7200rpm - Windows 7 64bits SP1
raksmey1309 is offline   Reply With Quote
Old January 12th, 2010, 00:51   #119
Kaizen
John
 
Kaizen's Avatar
 
Join Date: Nov 2007
Location: Scotland
Posts: 5,498
"Congrategulation you are right"

:rofl:
__________________
Spoiler:
I'm not jealous. I don't like people, so I don't mind not having many friends.
Kaizen is offline   Reply With Quote
Old January 12th, 2010, 00:58   #120
raksmey1309
បងស្រលាញ់អូន!
 
raksmey1309's Avatar
 
Join Date: Jul 2005
Location: ព្រះរាជាណាចក្រកម្ពុជា
Posts: 4,111
Yep i tested it already =D
__________________
I am the keyblade that, hopefully, will unlock your heart someday.

Proud to be Asian, proud to be Cambodian.
CPU: intel Core i7 3770 - GPU: nVidia GTX 660
M/B: Asrock Extreme 4M - RAM: DDR3 8GB bus 1600 MHz
HDD: 3TB SATA 3 7200rpm - Windows 7 64bits SP1
raksmey1309 is offline   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 18:45.

© 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.