![]() |
|
[.NET] Trigonometric Function Calculator - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Trigonometric Function Calculator (/showthread.php?tid=4523105) |
Trigonometric Function Calculator - Cynn - Nov 4, 2014 Alright everyone...I managed to run into a logic error while trying to make a basic Trigonometric calculator...I'm honestly confused and currious to why this is happening. I'm fairly new to trig and thought I'd toy around with it a bit (I know VB.Net Isn't the best language for math 😝) Heres the code: PHP Code The error can be seen in the screenshot where the label says "tan θ = 0.110431526074847" The tangent should by no means be 0.110431526074847, It should be 9. If you have any advice (Other than "Don't do math in Vb.Net") I'd love to hear it. * - Malware - Nov 4, 2014 Your problem is when you set the value equal to like x / y, it should be y / x. Math error, not programming!
* - Cynn - Nov 4, 2014 (Nov 4, 2014 10:24 PM)Venomous Net Wrote: Your problem is when you set the value equal to like x / y, it should be y / x. Oh thanks man...Damn. As I said Im new to trig 😖 Its still quite strange that when I'm using test data I'm comming up with and incorrect awnser (My test data is also being tested on my TI-83 Plus) for example: tan θ should have equal 9 * - Malware - Nov 4, 2014 (Nov 4, 2014 10:34 PM)Cynic. Wrote: Oh thanks man...Damn. As I said Im new to trig 😖 Make sure you are in degrees and the function is correct! * - Hawk HF - Nov 5, 2014 Meh. Code lb_tan.Text = sin.ToStringCould be this. * - Cynn - Nov 5, 2014 (Nov 5, 2014 03:33 PM)Hawk HF Wrote: Meh.Holy shit 😯 thanks...I honestly wouldnt have caught this...damn. I feel really dumb now 🤨 * - SaketSaket - Nov 6, 2014 @OP why you are individually setting each label's value to 0... Try something like this... PHP Code Regards Saket * - Cynn - Nov 6, 2014 (Nov 6, 2014 12:16 AM)SaketSaket Wrote: @OP why you are individually setting each label's value to 0...I didn't realize you could do something like that...that's actually really awesome o.o thanks man 🙂 |