diff --git a/src/client/Directory.Build.props b/src/client/Directory.Build.props index 5ab199510..04f55f947 100644 --- a/src/client/Directory.Build.props +++ b/src/client/Directory.Build.props @@ -13,6 +13,7 @@ false Debug true + 11 diff --git a/src/client/spark/Spark.csproj b/src/client/spark/Spark.csproj index 218d31433..570ae9e63 100644 --- a/src/client/spark/Spark.csproj +++ b/src/client/spark/Spark.csproj @@ -1,6 +1,6 @@ - net6.0-windows + net7.0-windows true Blue Trading Systems Blue Trading Systems @@ -34,7 +34,6 @@ - diff --git a/src/client/spark/view/Controls/TickUpDown/TickUpDownHelper.cs b/src/client/spark/view/Controls/TickUpDown/TickUpDownHelper.cs index afaf37e98..5e5b56c3b 100644 --- a/src/client/spark/view/Controls/TickUpDown/TickUpDownHelper.cs +++ b/src/client/spark/view/Controls/TickUpDown/TickUpDownHelper.cs @@ -5,6 +5,7 @@ namespace mbts.ui.controls { using System; using System.Diagnostics.CodeAnalysis; + using System.Numerics; static class TickUpDownHelper { public const string @@ -13,7 +14,7 @@ namespace mbts.ui.controls { public static string? format( T? new_value, string curr_text, TickDisplaySettingsImmutable? settings = null) - where T : struct, IFloatingPoint { + where T : struct, IFloatingPointIeee754 { if (T.TryParse(curr_text, null, out var from_text)) { if (!from_text.Equals(new_value)) { return format(new_value, settings); @@ -25,7 +26,7 @@ namespace mbts.ui.controls { } public static string format(T? value, TickDisplaySettingsImmutable? settings = null) - where T : struct, IFloatingPoint { + where T : struct, IFloatingPointIeee754 { if (!value.HasValue) { return string.Empty; } @@ -39,7 +40,7 @@ namespace mbts.ui.controls { string? text, [NotNullWhen(true)] out T? result, TickDisplaySettingsImmutable? settings = null - ) where T : IFloatingPoint { + ) where T : IFloatingPointIeee754 { if (text is null) { result = default; return false; diff --git a/src/client/spark/view/Controls/TickUpDown/TickUpDownNullableNumeric.cs b/src/client/spark/view/Controls/TickUpDown/TickUpDownNullableNumeric.cs index 62fd2deda..c6d99d4ff 100644 --- a/src/client/spark/view/Controls/TickUpDown/TickUpDownNullableNumeric.cs +++ b/src/client/spark/view/Controls/TickUpDown/TickUpDownNullableNumeric.cs @@ -11,6 +11,7 @@ namespace mbts.ui.controls { using System; using System.Linq; + using System.Numerics; using System.Windows; using System.Windows.Controls; using System.Windows.Input; diff --git a/src/client/spark/view/Spark/Shell/CalculatorLogic.cs b/src/client/spark/view/Spark/Shell/CalculatorLogic.cs index ab5939a37..ea3740108 100644 --- a/src/client/spark/view/Spark/Shell/CalculatorLogic.cs +++ b/src/client/spark/view/Spark/Shell/CalculatorLogic.cs @@ -9,6 +9,7 @@ using Spark.Core.Disposables; using System; + using System.Numerics; using System.Reactive.Linq; using System.Windows.Input; diff --git a/src/client/spark/view/Utility/IDisplayTranslator.cs b/src/client/spark/view/Utility/IDisplayTranslator.cs index 0a6eddda6..c8d64692e 100644 --- a/src/client/spark/view/Utility/IDisplayTranslator.cs +++ b/src/client/spark/view/Utility/IDisplayTranslator.cs @@ -7,6 +7,7 @@ using Spark.Core.Disposables; using System; using System.Collections.Generic; +using System.Numerics; using System.Reactive.Linq; namespace mbts.ui { diff --git a/src/client/spark_api/data/ticks/TickExtensions.cs b/src/client/spark_api/data/ticks/TickExtensions.cs index fd7a92bbe..5492c8920 100644 --- a/src/client/spark_api/data/ticks/TickExtensions.cs +++ b/src/client/spark_api/data/ticks/TickExtensions.cs @@ -11,6 +11,7 @@ namespace mbts { using System; using System.Collections.Generic; using System.Globalization; + using System.Numerics; public static class TickExtensions { static string _nan_text => TickDisplaySettings.Default.nan_text; @@ -109,20 +110,20 @@ namespace mbts { public static string format_without_decimal_part(this TickFactors tick, double value) => format(tick, value, double.NaN, false, _nan_text, true); - public static string format(this TickFactors tick, T value) where T : IFloatingPoint => + public static string format(this TickFactors tick, T value) where T : IFloatingPointIeee754 => format(tick, value, T.NaN, false, _nan_text); public static string format(this TickFactors tick, T value, bool show_commas) - where T : IFloatingPoint => + where T : IFloatingPointIeee754 => format(tick, value, T.NaN, show_commas, _nan_text); public static string format(this TickDisplaySettings settings, T value) - where T : IFloatingPoint => + where T : IFloatingPointIeee754 => format(settings.tick_factors, value, settings); public static string format( this bts.api.domain.TickDisplaySettingsImmutable settings, T value) - where T : IFloatingPoint => + where T : IFloatingPointIeee754 => settings.to_tick_display_settings().format(value); public static string format(this TickFactors tick, T value, TickDisplaySettings settings) @@ -149,7 +150,7 @@ namespace mbts { bool show_commas, string nan_text, bool show_decimal_part = true) - where T : IFloatingPoint => + where T : IFloatingPointIeee754 => tick.format( value, TickDisplaySettings.Default.with( @@ -196,7 +197,7 @@ namespace mbts { parse(display_settings.tick_factors, text, display_settings); public static T parse(this TickDisplaySettings display_settings, string text) - where T : IFloatingPoint => + where T : IFloatingPointIeee754 => parse(display_settings.tick_factors, text, display_settings); #nullable disable @@ -204,7 +205,7 @@ namespace mbts { parse(tick, text, display_settings); public static T parse(this TickFactors tick, string text, TickDisplaySettings display_settings) - where T : IFloatingPoint { + where T : IFloatingPointIeee754 { if (display_settings is null) { return parse(tick, text, T.NaN, _nan_text); } @@ -213,7 +214,9 @@ namespace mbts { return parse(tick, text, display_multiplier, nan_text); } - public static T parse(this TickFactors tick, string text, T display_multiplier, string nan_text) where T : IFloatingPoint => + public static T parse( + this TickFactors tick, string text, T display_multiplier, string nan_text) + where T : IFloatingPointIeee754 => tick?.is_valid() ?? false ? _parse(tick, text, display_multiplier, nan_text) : _parse_no_tick(text, display_multiplier, nan_text); @@ -223,37 +226,37 @@ namespace mbts { string text, T display_multiplier, string nan_text - ) where T : IFloatingPoint => + ) where T : IFloatingPointIeee754 => regional_tick.is_valid() ? _parse(regional_tick, text, display_multiplier, nan_text) : _parse_no_tick(text, display_multiplier, nan_text); public static T tick(this TickFactors tick, T value, int count) - where T : IFloatingPoint => + where T : IFloatingPointIeee754 => count < 0 ? tick.tickdown(value, (uint)-count) : tick.tickup(value, (uint)count); public static T tick(this bts.api.domain.TickFactorsImmutable tick, T value, int count) - where T : IFloatingPoint => + where T : IFloatingPointIeee754 => tick.to_tick_factors().tick(value, count); public static T tick( this bts.api.domain.TickDisplaySettingsImmutable settings, T value, int count) - where T : IFloatingPoint => + where T : IFloatingPointIeee754 => settings.HasTickFactors ? settings.TickFactors.tick(value, count) : throw new ArgumentException( "Can't tick because 'settings.HasTickFactors' is false", nameof(settings)); public static T tickup(this TickFactors tick, T input, uint count = 1) - where T : IFloatingPoint => + where T : IFloatingPointIeee754 => tickup(tick, input, count, TickUtils.precision_const()); public static T tickup(this TickFactors tick, T input, uint count, T precision) - where T : IFloatingPoint => + where T : IFloatingPointIeee754 => tickup>(tick, input, count, precision); public static T tickup(this TickFactors tick, T input, uint count, T precision) - where T : IFloatingPoint + where T : IFloatingPointIeee754 where TFromUInt32 : IConverter { if (!precision.is_real_positive()) { throw new ArgumentException("Must be a real positive number.", nameof(precision)); @@ -262,7 +265,7 @@ namespace mbts { return input; } var tuf = tick.tick_unit_frac(); - var ieeer = T.IEEERemainder(input, tuf); + var ieeer = T.Ieee754Remainder(input, tuf); input -= ieeer; if (ieeer < -precision) { count--; @@ -271,15 +274,18 @@ namespace mbts { return _round_tick(tuf, result); } - public static T tickup(this RegionalTickFactors regional_tick, T input) where T : IFloatingPoint => + public static T tickup( + this RegionalTickFactors regional_tick, T input) where T : IFloatingPointIeee754 => regional_tick.tickup(input, 1); - public static T tickup(this RegionalTickFactors regional_tick, T input, uint count) where T : IFloatingPoint => + public static T tickup( + this RegionalTickFactors regional_tick, T input, uint count) + where T : IFloatingPointIeee754 => regional_tick.tickup(input, count, TickUtils.precision_const()); public static T tickup( this RegionalTickFactors regional_tick, T input, uint count, T precision) - where T : IFloatingPoint { + where T : IFloatingPointIeee754 { if (!precision.is_real_positive()) { throw new ArgumentException("Must be a real positive number.", nameof(precision)); } @@ -292,7 +298,7 @@ namespace mbts { T ltie = regional_tick.low_tick_inclusive_end.as_type(); if (input < ltie) { tuf = regional_tick.low_tick.tick_unit_frac(); - var ieeer = T.IEEERemainder(input, tuf); + var ieeer = T.Ieee754Remainder(input, tuf); input -= ieeer; if (ieeer < -precision) count--; val = input + tuf * count.as_type(); @@ -303,7 +309,7 @@ namespace mbts { } } else { tuf = regional_tick.high_tick.tick_unit_frac(); - var ieeer = T.IEEERemainder(input, tuf); + var ieeer = T.Ieee754Remainder(input, tuf); input -= ieeer; if (ieeer < -precision) count--; val = input + tuf * count.as_type(); @@ -312,21 +318,21 @@ namespace mbts { } public static T tickdown(this TickFactors tick, T input, uint count = 1) - where T : IFloatingPoint => + where T : IFloatingPointIeee754 => tickdown(tick, input, count, TickUtils.precision_const()); public static T tickdown(this TickFactors tick, T input, uint count, T precision) - where T : IFloatingPoint => + where T : IFloatingPointIeee754 => tickdown>(tick, input, count, precision); public static T tickdown(this TickFactors tick, T input, uint count, T precision) - where T : IFloatingPoint + where T : IFloatingPointIeee754 where TFromUInt32 : IConverter { if (!input.is_real()) { return input; } var tuf = tick.tick_unit_frac(); - var ieeer = T.IEEERemainder(input, tuf); + var ieeer = T.Ieee754Remainder(input, tuf); input -= ieeer; if (ieeer > precision) { count--; @@ -336,21 +342,22 @@ namespace mbts { } public static T tickdown(this RegionalTickFactors regional_tick, T input) - where T : IFloatingPoint, IComparisonOperators => + where T : IFloatingPointIeee754 => regional_tick.tickdown(input, 1); public static T tickdown(this RegionalTickFactors regional_tick, T input, uint count) - where T : IFloatingPoint, IComparisonOperators => + where T : IFloatingPointIeee754 => tickdown(regional_tick, input, count, TickUtils.precision_const()); public static T tickdown( - this RegionalTickFactors regional_tick, T input, uint count, T precision) where T : IFloatingPoint => + this RegionalTickFactors regional_tick, T input, uint count, T precision) + where T : IFloatingPointIeee754 => tickdown, NumericCastOutConverter, NumericCastInConverter>( regional_tick, input, count, precision); public static T tickdown( this RegionalTickFactors regional_tick, T input, uint count, T precision) - where T : IFloatingPoint + where T : IFloatingPointIeee754 where TFromDouble : IConverter where TFromUInt32 : IConverter where TToUInt16 : IConverter { @@ -365,7 +372,7 @@ namespace mbts { T low_tick_inclusive_end = TFromDouble.convert(regional_tick.low_tick_inclusive_end); if (input > low_tick_inclusive_end) { tuf = regional_tick.high_tick.tick_unit_frac(); - var ieeer = T.IEEERemainder(input, tuf); + var ieeer = T.Ieee754Remainder(input, tuf); input -= ieeer; if (ieeer > precision) count--; val = input - tuf * TFromDouble.convert(count); @@ -377,7 +384,7 @@ namespace mbts { } } else { tuf = regional_tick.low_tick.tick_unit_frac(); - var ieeer = T.IEEERemainder(input, tuf); + var ieeer = T.Ieee754Remainder(input, tuf); input -= ieeer; if (ieeer > precision) count--; val = input - tuf * TFromDouble.convert(count); @@ -483,7 +490,7 @@ namespace mbts { return display_digits(tick.tick_base); } - public static int display_digits(T tick_base) where T : IFloatingPoint { + public static int display_digits(T tick_base) where T : IFloatingPoint, ILogarithmicFunctions { var log_tick_base = T.Log10(tick_base); var floor = T.Floor(log_tick_base); var dec = log_tick_base - floor; @@ -500,14 +507,14 @@ namespace mbts { } static string _format_no_tick(T value, T display_multiplier, bool show_commas) - where T : IFloatingPoint { + where T : INumberBase { if (!display_multiplier.is_nan()) { value *= display_multiplier; } return value.ToString(show_commas ? "#,0" : "0", null); } - static T _parse_no_tick(string text, T display_multiplier, string nan_text) where T : IFloatingPoint { + static T _parse_no_tick(string text, T display_multiplier, string nan_text) where T : IFloatingPointIeee754 { if (text == nan_text) { return T.NaN; } @@ -515,7 +522,7 @@ namespace mbts { result.safe_divide(display_multiplier) : T.NaN; } - static T _get_integer_part(string integer_text) where T : IFloatingPoint { + static T _get_integer_part(string integer_text) where T : IFloatingPointIeee754 { if (integer_text.is_null_or_white_space()) { return T.Zero; } @@ -524,7 +531,7 @@ namespace mbts { result : T.NaN; } - static T _get_numerator_part(string numerator_text, T tick_base) where T : IFloatingPoint { + static T _get_numerator_part(string numerator_text, T tick_base) where T : IFloatingPointIeee754 { if (string.IsNullOrEmpty(numerator_text)) { return T.Zero; } @@ -554,7 +561,7 @@ namespace mbts { static T _parse( RegionalTickFactors regional_tick, string text, T display_multiplier, string nan_text) - where T : IFloatingPoint { + where T : IFloatingPointIeee754 { T result = _parse(regional_tick.low_tick, text, display_multiplier, nan_text); T ltie = regional_tick.low_tick_inclusive_end.as_type() @@ -566,7 +573,7 @@ namespace mbts { } static T _parse(TickFactors tick, string text, T display_multiplier, string nan_text) - where T : IFloatingPoint { + where T : IFloatingPointIeee754 { if (text.is_null_or_white_space() || text == nan_text) { return T.NaN; } @@ -584,7 +591,7 @@ namespace mbts { } static T _parse(TickFactors tick, T integer_part, string numerator_part_text) - where T : IFloatingPoint { + where T : IFloatingPointIeee754 { T tick_base = tick.tick_base.as_type(); T numerator_part = _get_numerator_part(numerator_part_text, tick_base); return integer_part + numerator_part / tick_base; @@ -657,7 +664,7 @@ namespace mbts { } } - static T _round_tick(T tick_unit_frac, T input) where T : IFloatingPoint => - input - T.IEEERemainder(input, tick_unit_frac); + static T _round_tick(T tick_unit_frac, T input) where T : IFloatingPointIeee754 => + input - T.Ieee754Remainder(input, tick_unit_frac); } } diff --git a/src/client/spark_api/data/ticks/TickUtils.cs b/src/client/spark_api/data/ticks/TickUtils.cs index 3a6f91e0d..0dd5235a3 100644 --- a/src/client/spark_api/data/ticks/TickUtils.cs +++ b/src/client/spark_api/data/ticks/TickUtils.cs @@ -9,6 +9,7 @@ using Spark.Core; using System; using System.Collections.Generic; using System.Linq; +using System.Numerics; namespace mbts.spark { static class TickUtils { diff --git a/src/client/spark_api/spark_api.csproj b/src/client/spark_api/spark_api.csproj index 51bb8bf2f..67795f234 100644 --- a/src/client/spark_api/spark_api.csproj +++ b/src/client/spark_api/spark_api.csproj @@ -1,6 +1,6 @@ - net6.0 + net7.0 Blue Trading Systems Blue Trading Systems @@ -20,7 +20,6 @@ - diff --git a/src/client/spark_api_server/spark_api_server.csproj b/src/client/spark_api_server/spark_api_server.csproj index 7fcc70927..965e4a08d 100644 --- a/src/client/spark_api_server/spark_api_server.csproj +++ b/src/client/spark_api_server/spark_api_server.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net7.0 enable x64 x64 diff --git a/src/client/spark_core/Collections/Extensions/DictionaryExtensions.cs b/src/client/spark_core/Collections/Extensions/DictionaryExtensions.cs index e186e5678..69c98d0e5 100644 --- a/src/client/spark_core/Collections/Extensions/DictionaryExtensions.cs +++ b/src/client/spark_core/Collections/Extensions/DictionaryExtensions.cs @@ -61,9 +61,6 @@ namespace System.Collections.Generic { public static IDictionary as_idictionary(this Dictionary dictionary) => dictionary; - public static IReadOnlyDictionary AsReadOnly(this IDictionary dictionary) => - new ReadOnlyDictionary(dictionary); - public static void Difference(this IDictionary left, IDictionary right, out IEnumerable> exclusive_left, diff --git a/src/client/spark_core/Collections/Extensions/EnumerableExtensions.cs b/src/client/spark_core/Collections/Extensions/EnumerableExtensions.cs index 54d5db4bb..dc3271c63 100644 --- a/src/client/spark_core/Collections/Extensions/EnumerableExtensions.cs +++ b/src/client/spark_core/Collections/Extensions/EnumerableExtensions.cs @@ -13,6 +13,7 @@ namespace System.Collections.Generic { using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; using System.Linq; + using System.Numerics; using System.Reactive.Linq; using System.Runtime.Versioning; diff --git a/src/client/spark_core/spark_core.csproj b/src/client/spark_core/spark_core.csproj index 8880d9389..142a2c514 100644 --- a/src/client/spark_core/spark_core.csproj +++ b/src/client/spark_core/spark_core.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 true x64 x64 @@ -15,7 +15,6 @@ - diff --git a/src/client/spark_core/utils/Exceptions/ExceptionAssert.cs b/src/client/spark_core/utils/Exceptions/ExceptionAssert.cs index e2dbe49ba..19c73dc6d 100644 --- a/src/client/spark_core/utils/Exceptions/ExceptionAssert.cs +++ b/src/client/spark_core/utils/Exceptions/ExceptionAssert.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Numerics; namespace mbts.utils { static class ExceptionAssert { diff --git a/src/client/spark_core/utils_api/MathUtils.cs b/src/client/spark_core/utils_api/MathUtils.cs index 8ed43237a..4f50340e7 100644 --- a/src/client/spark_core/utils_api/MathUtils.cs +++ b/src/client/spark_core/utils_api/MathUtils.cs @@ -5,6 +5,7 @@ namespace bts.utils { using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; + using System.Numerics; public static class MathUtils { public const double EPSILON = 1E-12; @@ -14,7 +15,7 @@ namespace bts.utils { public static readonly IComparer epsilon_comparer = new ErrorMarginComparer(EPSILON); public static T abs_diff(T x, T y) - where T : ISubtractionOperators, IComparisonOperators => + where T : ISubtractionOperators, IComparisonOperators => x > y ? (x - y) : (y - x); public static IComparer error_margin_comparer(double error_margin) => @@ -36,14 +37,14 @@ namespace bts.utils { epsilon_equals(x, y, NormalNumericOps.epsilon); public static bool epsilon_equals(T x, T y, T epsilon) - where T : ISubtractionOperators, IComparisonOperators => + where T : ISubtractionOperators, IComparisonOperators => abs_diff(x, y) < epsilon; public static bool marginal_equals(double x, double y) => marginal_equals(x, y, EPSILON); public static bool marginal_equals(T x, T y, T margin) - where T : ISubtractionOperators, IComparisonOperators => + where T : ISubtractionOperators, IComparisonOperators => (x > y ? (x - y) : (y - x)) < margin; public static bool is_nan(T value) where T : INumber => @@ -132,7 +133,7 @@ namespace bts.utils { public static T nan_diff(T a, T b) where T : IFloatingPoint => T.IsNaN(a) ? -b : T.IsNaN(b) ? a : a - b; - public static bool is_within_range(T value, T min, T max) where T : IComparisonOperators => + public static bool is_within_range(T value, T min, T max) where T : IComparisonOperators => value >= min && value <= max; public static T weighted_average(T x, T x_weight, T y, T y_weight) where T : IFloatingPoint { @@ -145,7 +146,7 @@ namespace bts.utils { return x + (y - x) * (x_weight / (x_weight + y_weight)); } - public static T within_range(T value, T min, T max) where T : IComparisonOperators { + public static T within_range(T value, T min, T max) where T : IComparisonOperators { if (value < min) { return min; } @@ -156,7 +157,7 @@ namespace bts.utils { } public static T within_range( - T value, T? min = null, T? max = null) where T : struct, IComparisonOperators { + T value, T? min = null, T? max = null) where T : struct, IComparisonOperators { if (min.HasValue && value < min.Value) { return min.Value; } diff --git a/src/client/spark_core/utils_api/NumericCastConverter.cs b/src/client/spark_core/utils_api/NumericCastConverter.cs index 81058f480..9914b31ea 100644 --- a/src/client/spark_core/utils_api/NumericCastConverter.cs +++ b/src/client/spark_core/utils_api/NumericCastConverter.cs @@ -2,6 +2,7 @@ namespace Spark.Core { using bts; using System; + using System.Numerics; public class NumericCastConverter : IConverter, @@ -213,7 +214,7 @@ namespace Spark.Core { IConverter, IConverter, IConverter - where T : INumber { + where T : INumberBase { static readonly Func _to_int16; static readonly Func _to_uint16; @@ -342,7 +343,9 @@ namespace Spark.Core { static decimal IConverter.convert(T value) => _to_decimal(value); } - public class NumericCastConverter : IConverter where TIn : INumber where TOut : INumber { + public class NumericCastConverter : IConverter + where TIn : INumberBase + where TOut : INumberBase { static readonly Func _convert; static NumericCastConverter() { diff --git a/src/client/spark_core/utils_api/NumericExtensions.cs b/src/client/spark_core/utils_api/NumericExtensions.cs index 6423a33cf..37c217f6d 100644 --- a/src/client/spark_core/utils_api/NumericExtensions.cs +++ b/src/client/spark_core/utils_api/NumericExtensions.cs @@ -3,44 +3,45 @@ namespace bts.utils { using System; using System.Collections.Generic; + using System.Numerics; public static class NumericExtensions { - public static TOut as_type(this short value) where TOut : INumber => + public static TOut as_type(this short value) where TOut : INumberBase => as_type(value); - public static TOut as_type(this ushort value) where TOut : INumber => + public static TOut as_type(this ushort value) where TOut : INumberBase => as_type(value); - public static TOut as_type(this int value) where TOut : INumber => + public static TOut as_type(this int value) where TOut : INumberBase => as_type(value); - public static TOut as_type(this uint value) where TOut : INumber => + public static TOut as_type(this uint value) where TOut : INumberBase => as_type(value); - public static TOut as_type(this long value) where TOut : INumber => + public static TOut as_type(this long value) where TOut : INumberBase => as_type(value); - public static TOut as_type(this ulong value) where TOut : INumber => + public static TOut as_type(this ulong value) where TOut : INumberBase => as_type(value); - public static TOut as_type(this float value) where TOut : INumber => + public static TOut as_type(this float value) where TOut : INumberBase => as_type(value); - public static TOut as_type(this double value) where TOut : INumber => + public static TOut as_type(this double value) where TOut : INumberBase => as_type(value); public static TOut as_type(this TIn value) - where TIn : INumber - where TOut : INumber => + where TIn : INumberBase + where TOut : INumberBase => NumericCastConverter.convert(value); - public static T abs(this T value) where T : INumber => + public static T abs(this T value) where T : INumberBase => T.Abs(value); - public static bool is_nan(this T value) where T : IFloatingPoint => + public static bool is_nan(this T value) where T : INumberBase => T.IsNaN(value); - public static T if_nan(this T d, T if_nan) where T : IFloatingPoint => + public static T if_nan(this T d, T if_nan) where T : INumberBase => d.is_nan() ? if_nan : d; public static bool is_int(this T value) where T : IFloatingPoint => @@ -71,15 +72,15 @@ namespace bts.utils { MathUtils.marginal_equals(x, y, margin); public static bool is_within_range( - this T value, T min, T max) where T : IComparisonOperators => + this T value, T min, T max) where T : IComparisonOperators => MathUtils.is_within_range(value, min, max); public static T within_range( - this T value, T min, T max) where T : IComparisonOperators => + this T value, T min, T max) where T : IComparisonOperators => MathUtils.within_range(value, min, max); public static T within_range( - this T value, T? min = null, T? max = null) where T : struct, IComparisonOperators => + this T value, T? min = null, T? max = null) where T : struct, IComparisonOperators => MathUtils.within_range(value, min, max); public static bool is_real(this T value) where T : IFloatingPoint => @@ -118,7 +119,7 @@ namespace bts.utils { /// If only is real, returns . /// If neither term is real, returns NaN. /// - public static T add_real(this T a, T b) where T : IFloatingPoint => + public static T add_real(this T a, T b) where T : IFloatingPointIeee754 => new[] { a, b }.sum_real(true); /// @@ -129,7 +130,7 @@ namespace bts.utils { /// If only is real, returns - /// If neither term is real, returns NaN. /// - public static T subtract_real(this T a, T b) where T : IFloatingPoint => + public static T subtract_real(this T a, T b) where T : IFloatingPointIeee754 => new[] { a, -b }.sum_real(true); /// @@ -187,7 +188,7 @@ namespace bts.utils { /// contains no real numbers /// public static T sum_real(this IEnumerable values, bool nan_if_none = false) - where T : IFloatingPoint { + where T : IFloatingPointIeee754 { return nan_if_none ? nan_if_none_impl() : normal_impl(); T normal_impl() { diff --git a/src/client/spark_sdk/spark_sdk.csproj b/src/client/spark_sdk/spark_sdk.csproj index e1091d859..b83956513 100644 --- a/src/client/spark_sdk/spark_sdk.csproj +++ b/src/client/spark_sdk/spark_sdk.csproj @@ -1,9 +1,9 @@  - net6.0 + net7.0 Exe true - $(OutputPath)\net6.0 + $(OutputPath)\net7.0 true true $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage @@ -40,19 +40,19 @@ - + - - + + - ..\..\lib\net6.0\spark_api.dll + ..\..\lib\net7.0\spark_api.dll - + diff --git a/src/client/spark_test/spark_test.csproj b/src/client/spark_test/spark_test.csproj index e4101256d..dd8e88633 100644 --- a/src/client/spark_test/spark_test.csproj +++ b/src/client/spark_test/spark_test.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 x64 x64 diff --git a/src/client/spark_websocket/spark_websocket.csproj b/src/client/spark_websocket/spark_websocket.csproj index f79105e6d..750b01124 100644 --- a/src/client/spark_websocket/spark_websocket.csproj +++ b/src/client/spark_websocket/spark_websocket.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 enable x64 x64 diff --git a/src/client/sparkcmd/sparkcmd.csproj b/src/client/sparkcmd/sparkcmd.csproj index cde307957..68ef42d0f 100644 --- a/src/client/sparkcmd/sparkcmd.csproj +++ b/src/client/sparkcmd/sparkcmd.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net7.0 win10-x64;ubuntu.16.04-x64 Blue Trading Systems Blue Trading Systems diff --git a/tools/cpp.build.props b/tools/cpp.build.props index b35c7897b..165f8b725 100644 --- a/tools/cpp.build.props +++ b/tools/cpp.build.props @@ -2,44 +2,44 @@ $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory))) - $(BuildRoot)\$(Configuration)\bin\net6.0\ - $(BuildRoot)\$(Configuration)\bin\net6.0-windows\ + $(BuildRoot)\$(Configuration)\bin\net7.0\ + $(BuildRoot)\$(Configuration)\bin\net7.0-windows\ None