123456789101112131415161718192021222324252627282930313233343536 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CalculatorLib
- {
- public class Calculator
- {
- /// <summary>
- /// Вычисляет ответ задания
- /// </summary>
- /// <param name="x">Переменная x</param>
- /// <param name="y">Переменная y</param>
- /// <param name="z">Переменная z</param>
- /// <param name="success">Указатель на переменную успеха</param>
- /// <returns>Ответ задания</returns>
- public static double CalculateAnswer(double x, double y, double z, ref bool success)
- {
- double output = 0.00d;
- try
- {
- output += Math.Pow(2, Math.Pow(y, x));
- output += Math.Pow(Math.Pow(3, x), y);
- output -= (y * (Math.Atan(z) - Math.PI / 6)) / (Math.Abs(x) + 1 / (y * y - 1));
- success = true;
- }
- catch (DivideByZeroException)
- {
- success = false;
- }
- return output;
- }
- }
- }
|