1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- //#define IsTestDownLevel1
- #define IsDriverUpperCos
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace FunctionSystem
- {
- public static class Level1
- {
- #if IsTestDownLevel1
- #region заглушки
- public static double Cos(double x) => 1;
- #endregion
- #elif IsDriverUpperCos
- #region
- public static double Cos(double x)
- {
- Console.WriteLine($"Sin - {Level0.Sin(x)}");
- return 0;
- }
- #endregion
- #else
- public static double Cos(double x)
- {
- x = ((x / (2 * Math.PI)) - Math.Truncate((x / (2 * Math.PI)))) * Math.PI * 2;
- if (x > Math.PI / 2 && x < Math.PI * 3 / 2)
- {
- return -(Math.Sqrt(1 - Math.Pow(Level0.Sin(x), 2)));
- }
- return Math.Sqrt(1 - Math.Pow(Level0.Sin(x), 2));
- }
- #endif
- }
- }
|