Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programmers' lounge. (Programming-related discussions only)
New Posts  All Forums:Forum Nav:

Programmers' lounge. (Programming-related discussions only) - Page 60

post #591 of 1143
Quote:
Originally Posted by Bobicon View Post

Quote:
Originally Posted by 3930K View Post

So like:

var intPart = Bigarational.Pow(base, truncatedExp);
var rest = //what?
return intPart * rest;

var intPart = Bigarational.Pow(base, truncatedExp);
var sub = exponent - exponentTruncated
var basemult = base*sub
return int IntPart*basemult

maybe throw some print statements of the variables names in between to test that the values exist before and after the calculations as well.
Doesn't give me the right result.
post #592 of 1143
Quote:
Originally Posted by 3930K View Post

Doesn't give me the right result.

What is the equation you are trying to replicate?

because you do follow order of operations doing it step by step it would be impossible to come up with a wrong answer unless floating point values are being cut off.
Bob's Computer
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i5 2500K MSI P67A-G45 MSI 6970 Lightning 2GB G Skill Ripjaws X (2x4GB) 1866mhz 9-10-9-28 
Hard DriveOptical DriveCoolingOS
Corsair Force 3 SSD (60GB), X1 WD5000AAKS, X1 W... ASUS DRW-24B1ST/BLK/B/AS Black SATA 24X DVD Burner Noctua NH-C14 Windows 7 64 bit 
MonitorKeyboardPowerCase
Asus VH238H Logitech G510 HALE90 750W NZXT Phantom Black 
MouseMouse PadAudioOther
Logitech G9x SteelSeries 4HD ASUS Xonar DGX / Audio-Technica ATH-AD700 Hauppauge! HVR-1250 TV Tuner 
  hide details  
Reply
Bob's Computer
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i5 2500K MSI P67A-G45 MSI 6970 Lightning 2GB G Skill Ripjaws X (2x4GB) 1866mhz 9-10-9-28 
Hard DriveOptical DriveCoolingOS
Corsair Force 3 SSD (60GB), X1 WD5000AAKS, X1 W... ASUS DRW-24B1ST/BLK/B/AS Black SATA 24X DVD Burner Noctua NH-C14 Windows 7 64 bit 
MonitorKeyboardPowerCase
Asus VH238H Logitech G510 HALE90 750W NZXT Phantom Black 
MouseMouse PadAudioOther
Logitech G9x SteelSeries 4HD ASUS Xonar DGX / Audio-Technica ATH-AD700 Hauppauge! HVR-1250 TV Tuner 
  hide details  
Reply
post #593 of 1143
Quote:
Originally Posted by Bobicon View Post

Quote:
Originally Posted by 3930K View Post

Doesn't give me the right result.

What is the equation you are trying to replicate?

because you do follow order of operations doing it step by step it would be impossible to come up with a wrong answer unless floating point values are being cut off.
Its a pow method. I have no idea HOW to work it out, so the equation IS wrong. Lol
post #594 of 1143
I don't suppose that anybody here knows whether using the GOTO function in visual basic for my AS computing exam would or wouldn't get awarded marks?
We haven't been taught to use them and the teacher usually gives me the impression I'm stupid for using it but I find it easier to use than other methods.
The exam is going to be based on writing and modifying encryption software.
Fate/Zero
(19 items)
 
Storage Server
(9 items)
 
 
MotherboardRAMHard DriveHard Drive
Gigabyte N3150-D3V 8GB Crucial Non-ECC (Live life on the edge) Western Digital 4TB Western Digital 4TB 
Hard DriveHard DriveOSPower
Western Digital 4TB Western Digital 4TB FreeNAS Corsair 350W 
Case
3U Logic Case SC-2306B-550B 
  hide details  
Reply
Fate/Zero
(19 items)
 
Storage Server
(9 items)
 
 
MotherboardRAMHard DriveHard Drive
Gigabyte N3150-D3V 8GB Crucial Non-ECC (Live life on the edge) Western Digital 4TB Western Digital 4TB 
Hard DriveHard DriveOSPower
Western Digital 4TB Western Digital 4TB FreeNAS Corsair 350W 
Case
3U Logic Case SC-2306B-550B 
  hide details  
Reply
post #595 of 1143
Quote:
Originally Posted by Sir Amik Vase View Post

I don't suppose that anybody here knows whether using the GOTO function in visual basic for my AS computing exam would or wouldn't get awarded marks?
We haven't been taught to use them and the teacher usually gives me the impression I'm stupid for using it but I find it easier to use than other methods.
The exam is going to be based on writing and modifying encryption software.

MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
post #596 of 1143
Quote:
Originally Posted by {Unregistered} View Post


Maybe... Maybe I shouldn't use goto.
Why exactly is it a bad idea? It's the only command available for jumping around in assembly so I can't see why it's bad to use it in higher levels
Fate/Zero
(19 items)
 
Storage Server
(9 items)
 
 
MotherboardRAMHard DriveHard Drive
Gigabyte N3150-D3V 8GB Crucial Non-ECC (Live life on the edge) Western Digital 4TB Western Digital 4TB 
Hard DriveHard DriveOSPower
Western Digital 4TB Western Digital 4TB FreeNAS Corsair 350W 
Case
3U Logic Case SC-2306B-550B 
  hide details  
Reply
Fate/Zero
(19 items)
 
Storage Server
(9 items)
 
 
MotherboardRAMHard DriveHard Drive
Gigabyte N3150-D3V 8GB Crucial Non-ECC (Live life on the edge) Western Digital 4TB Western Digital 4TB 
Hard DriveHard DriveOSPower
Western Digital 4TB Western Digital 4TB FreeNAS Corsair 350W 
Case
3U Logic Case SC-2306B-550B 
  hide details  
Reply
post #597 of 1143
Quote:
Originally Posted by Sir Amik Vase View Post

Maybe... Maybe I shouldn't use goto.
Why exactly is it a bad idea? It's the only command available for jumping around in assembly so I can't see why it's bad to use it in higher levels

It isn't inherently a bad idea. It just leads to spaghetti code.
Chances are, if you're using a GOTO statement in a higher level language, there is probably a better way to do it.
The whole point of high level languages is that they allow you to structure your code in a better fashion.
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
post #598 of 1143
Quote:
Originally Posted by {Unregistered} View Post

It isn't inherently a bad idea. It just leads to spaghetti code.
Chances are, if you're using a GOTO statement in a higher level language, there is probably a better way to do it.
The whole point of high level languages is that they allow you to structure your code in a better fashion.
But at the same time, goto can allow for better code flow than a large and clunky looking if statement.

@Sir Amik Vase, honestly, it depends on how you used it and the professor's styling preference. IF you do get marked off points and the professor never clearly indicated to you whether or not goto statements are ok, then you *SHOULDN'T* get marked points off, and if you do, you can try to argue them back.

Also, probably 90% of the time, if you are using goto statements in higher level language, then you're most likely writing it incorrectly.
Router
(12 items)
 
  
Reply
Router
(12 items)
 
  
Reply
post #599 of 1143
Quote:
Originally Posted by stumped View Post

Quote:
Originally Posted by {Unregistered} View Post

It isn't inherently a bad idea. It just leads to spaghetti code.
Chances are, if you're using a GOTO statement in a higher level language, there is probably a better way to do it.
The whole point of high level languages is that they allow you to structure your code in a better fashion.
But at the same time, goto can allow for better code flow than a large and clunky looking if statement.

@Sir Amik Vase, honestly, it depends on how you used it and the professor's styling preference. IF you do get marked off points and the professor never clearly indicated to you whether or not goto statements are ok, then you *SHOULDN'T* get marked points off, and if you do, you can try to argue them back.

Also, probably 90% of the time, if you are using goto statements in higher level language, then you're most likely writing it incorrectly.
I must note one very important exception: in C# switch statements.
For example,this is invalid:

switch someStr:
case "ab":
//something for the b and then carry on to a
case "a":
//something for a
break;

You have to do this:

switch someStr:
case "ab":
//something for the b and then carry on to a
goto "a";
case "a":
//something for a
break;


This is to avoid accidentally carrying on.
post #600 of 1143
Quote:
Originally Posted by 3930K View Post

I must note one very important exception: in C# switch statements.
For example,this is invalid:

switch someStr:
case "ab":
//something for the b and then carry on to a
case "a":
//something for a
break;

You have to do this:

switch someStr:
case "ab":
//something for the b and then carry on to a
goto "a";
case "a":
//something for a
break;


This is to avoid accidentally carrying on.

Err...Seeing as there's no condition on your goto for the faux-fallthrough, goto is still unnecessary...
Code:
switch ( someStr )
{
case "ab":
case "a":
        // something for them both...
}

But its OK I know what you're on about tongue.gif (Crap example laughingsmiley.gif)
Ol' Sandy
(28 items)
 
"Zeus"
(12 items)
 
Elite Preview
(6 items)
 
CPUMotherboardGraphicsRAM
Intel Xeon E3-1230v3 Gigabyte GA-Z97X-UD5H-BK MSI Gaming GTX 980 Kingston 32GB (4x8) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Samsung EVO 1TB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 8 Pro 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2713HM Topre Realforce 87UB | Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Logitech G700 XTRAC Ripper XXL 
AudioAudioAudioAudio
Beyerdynamic DT-770 Pro 250ohm Schiit Bifrost DAC Schiit Asgard 2 HiVi Swan M50W 2.1 
CPUMotherboardRAMHard Drive
Intel Xeon E5-2620 Super Micro X9SRL-F-B 128GB 1333MHz LSI 9271-8i 
OSPowerCase
VMware ESXi 5.5 SeaSonic SS-400FL2 Fractal Define R3 
CPUMotherboardGraphicsRAM
Intel Core i5-3437U HP EliteBook Folio 9470m  Intel HD Graphics 4000  16GB DDR3 SDRAM 
Hard DriveOS
256GB SSD Windows 10 Insider Preview 
  hide details  
Reply
Ol' Sandy
(28 items)
 
"Zeus"
(12 items)
 
Elite Preview
(6 items)
 
CPUMotherboardGraphicsRAM
Intel Xeon E3-1230v3 Gigabyte GA-Z97X-UD5H-BK MSI Gaming GTX 980 Kingston 32GB (4x8) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Samsung EVO 1TB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 8 Pro 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2713HM Topre Realforce 87UB | Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Logitech G700 XTRAC Ripper XXL 
AudioAudioAudioAudio
Beyerdynamic DT-770 Pro 250ohm Schiit Bifrost DAC Schiit Asgard 2 HiVi Swan M50W 2.1 
CPUMotherboardRAMHard Drive
Intel Xeon E5-2620 Super Micro X9SRL-F-B 128GB 1333MHz LSI 9271-8i 
OSPowerCase
VMware ESXi 5.5 SeaSonic SS-400FL2 Fractal Define R3 
CPUMotherboardGraphicsRAM
Intel Core i5-3437U HP EliteBook Folio 9470m  Intel HD Graphics 4000  16GB DDR3 SDRAM 
Hard DriveOS
256GB SSD Windows 10 Insider Preview 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programmers' lounge. (Programming-related discussions only)