0

I have two questions: First one is, can you change Visual studios so it works in degrees permanently? I am using the pi/180 or 180/pi depending on what i need currently but sometimes i forget.

Second question is, my source code is below

double temp = Convert.ToDouble(Math.Atan(150/ 250));

Why does the system return the value of temp as 0? I did this calculations on my calculator and it is 0.5404... (I made sure my calculator was in radians mode when i did this). The double should be able to hold this value because later on it holds values which are similar to this.

  • 1
    1. It's not a VS setting, it's the code of the `Math.Atan()` method that calculates (or rather looks up) the value expecting the argument to be radians, you cannot change it. 2. It's not "rounding", `150/250` is an integer division resulting in `0`, you need to do `150d/250d` to do a floating point division (or `(double)150/250`). – René Vogt Aug 09 '16 at 17:09
  • You cannot change C# to work in degrees. Or VB. Visual Studio is an IDE, not a programming language. – Andrew Morton Aug 09 '16 at 17:09
  • @RenéVogt Thanks a lot man, i really appreciate it :) danke ver viel (The little german i know) – Bad programmer Aug 09 '16 at 17:32

0 Answers0