|
| 1 | +using System; |
| 2 | +using System.Numerics; |
| 3 | + |
| 4 | +#if WITH_NAME_SPACE |
| 5 | +namespace CScripting |
| 6 | +{ |
| 7 | +#endif |
| 8 | + |
| 9 | +public partial class CScripting |
| 10 | +{ |
| 11 | + #region abs |
| 12 | + //public const double e = Math.E; |
| 13 | + public const double pi = Math.PI; |
| 14 | + |
| 15 | + /// <summary> |
| 16 | + /// 将复数转为绝对值 |
| 17 | + /// </summary> |
| 18 | + /// <param name="num"></param> |
| 19 | + /// <returns></returns> |
| 20 | + public static double Abs(Complex num) => Abs(num.Magnitude); |
| 21 | + |
| 22 | + /// <see cref=" Math.Abs"/> |
| 23 | + public static decimal Abs(decimal value) => Abs(value); |
| 24 | + |
| 25 | + /// <see cref=" Math.Abs"/> |
| 26 | + public static double Abs(double value) => Abs(value); |
| 27 | + |
| 28 | + /// <see cref=" Math.Abs"/> |
| 29 | + public static short Abs(short value) => Abs(value); |
| 30 | + |
| 31 | + /// <see cref=" Math.Abs"/> |
| 32 | + public static int Abs(int value) => Abs(value); |
| 33 | + |
| 34 | + /// <see cref=" Math.Abs"/> |
| 35 | + public static long Abs(long value) => Abs(value); |
| 36 | + |
| 37 | + /// <see cref=" Math.Abs"/> |
| 38 | + public static sbyte Abs(sbyte value) => Abs(value); |
| 39 | + |
| 40 | + /// <see cref=" Math.Abs"/> |
| 41 | + public static float Abs(float value) => Abs(value); |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +#if OBSOLETE |
| 50 | + [Obsolete("This method is deprecated, use `Abs` instead.")] |
| 51 | +#endif |
| 52 | + public static double abs(Complex num) => Math.Abs(num.Magnitude); |
| 53 | + |
| 54 | +#if OBSOLETE |
| 55 | + [Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] |
| 56 | +#endif |
| 57 | + public static double abs(double num) => Math.Abs(num); |
| 58 | + |
| 59 | +#if OBSOLETE |
| 60 | + [Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] |
| 61 | +#endif |
| 62 | + public static decimal abs(decimal num) => Math.Abs(num); |
| 63 | + |
| 64 | +#if OBSOLETE |
| 65 | + [Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] |
| 66 | +#endif |
| 67 | + public static short abs(short num) => Math.Abs(num); |
| 68 | + |
| 69 | +#if OBSOLETE |
| 70 | + [Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] |
| 71 | +#endif |
| 72 | + public static int abs(int num) => Math.Abs(num); |
| 73 | +#if OBSOLETE |
| 74 | + [Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] |
| 75 | +#endif |
| 76 | + public static long abs(long num) => Math.Abs(num); |
| 77 | +#if OBSOLETE |
| 78 | + [Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] |
| 79 | +#endif |
| 80 | + public static sbyte abs(sbyte num) => Math.Abs(num); |
| 81 | + |
| 82 | +#if OBSOLETE |
| 83 | + [Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] |
| 84 | +#endif |
| 85 | + public static float abs(float num) => Math.Abs(num); |
| 86 | + |
| 87 | + #endregion |
| 88 | + |
| 89 | +} |
| 90 | +#if WITH_NAME_SPACE |
| 91 | +} |
| 92 | +#endif |
0 commit comments