| Off Topic > Off Topic |
| Programming Megathread |
| << < (22/241) > >> |
| ZSNO:
--- Quote from: DrHitius on October 30, 2015, 05:44:58 PM ---why does everyone forget HLSL --- End quote --- So casual, doesn't even mention GLSL. You know, the language Blockland's shaders run on. |
| devildogelite:
--- Quote from: Otis Da HousKat on October 30, 2015, 04:38:57 PM ---The standard Arduino IDE is awful for a lot of reasons. It exists as a first timer's tool to compiling and flashing hardware. It works but it is very limiting once you're ready to explore deeper, and customization of the environment is nonexistent. I know there is some Eclipse plugins for Arduino if that's up your alley. I don't have much experience with Arduino development as an Arduino. I've used the boards before because they were available and easy, but I was flashing my own programs to them and not using the Arduino libraries, which once again have a lot of problems for people looking to go beyond the hobbyist level. --- End quote --- I mean I'm still only doing hobbyist stuff and fun little projects but I just really hate the Arduino IDE. I've never used eclipse that much except recently for a networking project in Java and I found eclipse to be pretty nice. I'll take a look at the eclipse one. I found an Arduino IDE plugin for Visual Studio which is what I have the most experience in but it seems like it's just cobbled together. |
| Kochieboy:
--- Code: ---/* A program that adds up the sum of fractions from 2 to 30 and compares it to 1, using nested loops. Written by Silico Deoxy on October 31, 2015 Version: 1.0 Language: C (gcc target) */ #include <stdio.h> int main(void){ int itsum; /* Used to mark the iteration at which the sum loop is at */ double sum, /* The sum of the fractions */ d; /* The denominator */ for (d=2;d<31;d++){ sum = 0; itsum = 1; while (itsum <= d){ sum = sum + (1 / d); itsum++; } if (sum == 1) printf("Adding %lf 1/%lf 's gives a result equal to 1\n", d, d); else if (sum < 1) printf("Adding %lf 1/%lf 's gives a result less than 1\n", d, d); else printf("Adding %lf 1/%lf 's gives a result greater than 1\n", d, d); } return 0; } --- End code --- So we are doing nested loops in our class and I wrote the code above. For some odd reason, I get some weird results for numbers that do not add up evenly into 1. Compile it and look for yourself, it's the craziest stuff. |
| ZSNO:
Yeah, precision of numbers is finite. If you replace your == with --- Code: ---if (sum - 1 < 0.000000000000001 && sum - 1 > -0.000000000000001) --- End code --- it gives the expected result. |
| Kochieboy:
--- Quote from: ZSNO on October 31, 2015, 11:08:56 PM ---Yeah, precision of numbers is finite. If you replace your == with --- Code: ---if (sum - 1 < 0.000000000000001 && sum - 1 > -0.000000000000001) --- End code --- it gives the expected result. --- End quote --- Heh, yeah, kinda wished our prof taught us that now. |
| Navigation |
| Message Index |
| Next page |
| Previous page |