From 674ad928d742bba00b8e229f2e9ee48379293940 Mon Sep 17 00:00:00 2001 From: Pawel Baran Date: Mon, 4 Nov 2024 11:56:58 +0100 Subject: [PATCH 1/7] RoundWithTolerance renamed to RoundToFloor --- BHoM_Engine/Query/NumericalApproximation.cs | 2 +- ...{RoundWithTolerance.cs => RoundToFloor.cs} | 28 ++++++------------- 2 files changed, 9 insertions(+), 21 deletions(-) rename BHoM_Engine/Query/{RoundWithTolerance.cs => RoundToFloor.cs} (90%) diff --git a/BHoM_Engine/Query/NumericalApproximation.cs b/BHoM_Engine/Query/NumericalApproximation.cs index dc2a66ff0..1a2e4790a 100644 --- a/BHoM_Engine/Query/NumericalApproximation.cs +++ b/BHoM_Engine/Query/NumericalApproximation.cs @@ -93,7 +93,7 @@ public static double NumericalApproximation(this double number, string fullName { double tolerance = NumericTolerance(customNumericTolerances, globalNumericTolerance, fullName, false); if (tolerance != double.MaxValue) - number = Query.RoundWithTolerance(number, tolerance); + number = Query.RoundToFloor(number, tolerance); } // 2) Check significantFigures. diff --git a/BHoM_Engine/Query/RoundWithTolerance.cs b/BHoM_Engine/Query/RoundToFloor.cs similarity index 90% rename from BHoM_Engine/Query/RoundWithTolerance.cs rename to BHoM_Engine/Query/RoundToFloor.cs index 38c4f04d9..feb393da6 100644 --- a/BHoM_Engine/Query/RoundWithTolerance.cs +++ b/BHoM_Engine/Query/RoundToFloor.cs @@ -20,19 +20,9 @@ * along with this code. If not, see . */ -using BH.oM.Base; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Security.Cryptography; -using System.Reflection; using BH.oM.Base.Attributes; +using System; using System.ComponentModel; -using BH.Engine.Base; -using System.Collections; -using System.Data; namespace BH.Engine.Base { @@ -42,7 +32,7 @@ public static partial class Query /**** Public Methods ****/ /***************************************************/ - [Description("Rounds a number using the given tolerance, rounding (to floor) to the nearest tolerance multiplier." + + [Description("Rounds a number using the given tolerance, rounding to floor to the nearest tolerance multiplier." + "Supports any fractional, integer, positive or negative numbers." + "\nSome examples:" + "\n\t RoundWithTolerance(12, 20) ==> 0" + @@ -53,7 +43,7 @@ public static partial class Query "\nand so on.")] [Input("number", "Number to be rounded.")] [Input("tolerance", "Tolerance to use for rounding.")] - public static double RoundWithTolerance(this double number, double tolerance) + public static double RoundToFloor(this double number, double tolerance) { if (tolerance < 0) { @@ -79,10 +69,10 @@ public static double RoundWithTolerance(this double number, double tolerance) /***************************************************/ - // NOTE: Although we could be satisfied with just one method "RoundWithTolerance" from the UI perspective, + // NOTE: Although we could be satisfied with just one method "RoundToFloor" from the UI perspective, // we also need a dedicated method for Integers, to avoid a performance hit when using this method from other parts of the code, e.g. in Hash(). - [Description("Rounds an integer number using the given tolerance, rounding (to floor) to the nearest tolerance multiplier." + + [Description("Rounds an integer number using the given tolerance, rounding to floor to the nearest tolerance multiplier." + "\nSome examples:" + "\n\t RoundWithTolerance(12, 20) ==> 0" + "\n\t RoundWithTolerance(121, 2) ==> 120" + @@ -90,7 +80,7 @@ public static double RoundWithTolerance(this double number, double tolerance) "\nand so on.")] [Input("number", "Number to be rounded.")] [Input("tolerance", "Tolerance to use for rounding.")] - public static int RoundWithTolerance(this int number, double tolerance) + public static int RoundToFloor(this int number, double tolerance) { if (tolerance < 1) return number; @@ -127,9 +117,7 @@ private static int FlooredIntegerDivision(int a, int b) } return a / b; } + + /***************************************************/ } } - - - - From 319ffc11bfe0dc66693371c6b921fa56b78c7738 Mon Sep 17 00:00:00 2001 From: Pawel Baran Date: Mon, 4 Nov 2024 11:57:38 +0100 Subject: [PATCH 2/7] #3429 fixed --- BHoM_Engine/Query/RoundToFloor.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/BHoM_Engine/Query/RoundToFloor.cs b/BHoM_Engine/Query/RoundToFloor.cs index feb393da6..081dbbb57 100644 --- a/BHoM_Engine/Query/RoundToFloor.cs +++ b/BHoM_Engine/Query/RoundToFloor.cs @@ -55,13 +55,6 @@ public static double RoundToFloor(this double number, double tolerance) if (tolerance == double.MinValue || tolerance == 0 || Double.IsNaN(tolerance) || Double.IsNaN(number) || Double.IsInfinity(number) || Double.IsInfinity(tolerance)) return number; - // First check if the tolerance can be converted into fractional digits, i.e. is a number in the form of 10^someExp. - // This avoids imprecisions with the approximation formula below. - int fractionalDigits = Math.Abs(System.Convert.ToInt32(Math.Log10(tolerance))); - if (tolerance < 1 && Math.Pow(10, -fractionalDigits) == tolerance) - // If so, just return Math.Round(). - return Math.Round(number, fractionalDigits); - // Otherwise, perform the approximation with the given tolerance. int unitStep = number > 0 ? 1 : -1; // Useful to deal with negative numbers. return tolerance * Math.Floor(number * unitStep / tolerance) * unitStep; From 6f244a5c329666b8d637c6c71b1b35cf84cd2ea3 Mon Sep 17 00:00:00 2001 From: Pawel Baran Date: Mon, 4 Nov 2024 14:07:12 +0100 Subject: [PATCH 3/7] code bugfixed and descriptions aligned --- BHoM_Engine/Query/RoundToFloor.cs | 56 +++++++++++-------------------- 1 file changed, 20 insertions(+), 36 deletions(-) diff --git a/BHoM_Engine/Query/RoundToFloor.cs b/BHoM_Engine/Query/RoundToFloor.cs index 081dbbb57..d442f3d42 100644 --- a/BHoM_Engine/Query/RoundToFloor.cs +++ b/BHoM_Engine/Query/RoundToFloor.cs @@ -35,11 +35,13 @@ public static partial class Query [Description("Rounds a number using the given tolerance, rounding to floor to the nearest tolerance multiplier." + "Supports any fractional, integer, positive or negative numbers." + "\nSome examples:" + - "\n\t RoundWithTolerance(12, 20) ==> 0" + - "\n\t RoundWithTolerance(121, 2) ==> 120" + - "\n\t RoundWithTolerance(1.2345, 1.1) ==> 1.1" + - "\n\t RoundWithTolerance(0.014, 0.01) ==> 0.01" + - "\n\t RoundWithTolerance(0.014, 0.02) ==> 0" + + "\n\t RoundToFloor(12, 20) ==> 0" + + "\n\t RoundToFloor(121, 2) ==> 120" + + "\n\t RoundToFloor(1.2345, 1.1) ==> 1.1" + + "\n\t RoundToFloor(0.014, 0.01) ==> 0.01" + + "\n\t RoundToFloor(-0.014, 0.01) ==> -0.02" + + "\n\t RoundToFloor(0.015, 0.01) ==> 0.01" + + "\n\t RoundToFloor(0.014, 0.02) ==> 0" + "\nand so on.")] [Input("number", "Number to be rounded.")] [Input("tolerance", "Tolerance to use for rounding.")] @@ -52,12 +54,11 @@ public static double RoundToFloor(this double number, double tolerance) } // If the tolerance is the smallest possible double, or if the inputs are invalid, just return. - if (tolerance == double.MinValue || tolerance == 0 || Double.IsNaN(tolerance) || Double.IsNaN(number) || Double.IsInfinity(number) || Double.IsInfinity(tolerance)) + if (number == 0 || tolerance == 0 || Double.IsNaN(tolerance) || Double.IsNaN(number) || Double.IsInfinity(number) || Double.IsInfinity(tolerance)) return number; // Otherwise, perform the approximation with the given tolerance. - int unitStep = number > 0 ? 1 : -1; // Useful to deal with negative numbers. - return tolerance * Math.Floor(number * unitStep / tolerance) * unitStep; + return tolerance * Math.Floor(number / tolerance); } /***************************************************/ @@ -67,48 +68,31 @@ public static double RoundToFloor(this double number, double tolerance) [Description("Rounds an integer number using the given tolerance, rounding to floor to the nearest tolerance multiplier." + "\nSome examples:" + - "\n\t RoundWithTolerance(12, 20) ==> 0" + - "\n\t RoundWithTolerance(121, 2) ==> 120" + - "\n\t RoundWithTolerance(-40, 20) ==> -40" + + "\n\t RoundToFloor(12, 20) ==> 0" + + "\n\t RoundToFloor(121, 2) ==> 120" + + "\n\t RoundToFloor(-35, 20) ==> -40" + "\nand so on.")] [Input("number", "Number to be rounded.")] [Input("tolerance", "Tolerance to use for rounding.")] public static int RoundToFloor(this int number, double tolerance) { - if (tolerance < 1) - return number; - - if (number > 0 && tolerance > number) - return 0; - if (tolerance < 0) { BH.Engine.Base.Compute.RecordError("Tolerance cannot be less than 0."); return 0; } - int unitStep = number > 0 ? 1 : -1; - int flooredIntegerTolerance = (int)tolerance; - return FlooredIntegerDivision(number * unitStep, flooredIntegerTolerance) * flooredIntegerTolerance * unitStep; - } - - /***************************************************/ - /**** Private Methods ****/ - /***************************************************/ + // If the tolerance is the smallest possible double, or if the inputs are invalid, just return. + if (number == 0 || tolerance == double.MinValue || tolerance == 0 || Double.IsNaN(tolerance) || number == int.MinValue || number == int.MaxValue || Double.IsInfinity(tolerance)) + return number; - private static int FlooredIntegerDivision(int a, int b) - { - if (a < 0) + if ((int)tolerance != tolerance) { - if (b > 0) - return (a - b + 1) / b; - } - else if (a > 0) - { - if (b < 0) - return (a - b - 1) / b; + BH.Engine.Base.Compute.RecordError("Tolerance needs to be an integer value."); + return 0; } - return a / b; + + return (int)(Math.Floor(number / tolerance) * tolerance); } /***************************************************/ From 992eda2b67c2345fffe95b7947e6f2a544bd595a Mon Sep 17 00:00:00 2001 From: Pawel Baran Date: Mon, 4 Nov 2024 14:07:22 +0100 Subject: [PATCH 4/7] versioning added --- BHoM_Engine/Query/RoundToFloor.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BHoM_Engine/Query/RoundToFloor.cs b/BHoM_Engine/Query/RoundToFloor.cs index d442f3d42..0debfe6c8 100644 --- a/BHoM_Engine/Query/RoundToFloor.cs +++ b/BHoM_Engine/Query/RoundToFloor.cs @@ -32,6 +32,7 @@ public static partial class Query /**** Public Methods ****/ /***************************************************/ + [PreviousVersion("8.0", "BH.Engine.Base.Query.RoundWithTolerance(System.Double, System.Double)")] [Description("Rounds a number using the given tolerance, rounding to floor to the nearest tolerance multiplier." + "Supports any fractional, integer, positive or negative numbers." + "\nSome examples:" + @@ -66,6 +67,7 @@ public static double RoundToFloor(this double number, double tolerance) // NOTE: Although we could be satisfied with just one method "RoundToFloor" from the UI perspective, // we also need a dedicated method for Integers, to avoid a performance hit when using this method from other parts of the code, e.g. in Hash(). + [PreviousVersion("8.0", "BH.Engine.Base.Query.RoundWithTolerance(System.Int32, System.Double)")] [Description("Rounds an integer number using the given tolerance, rounding to floor to the nearest tolerance multiplier." + "\nSome examples:" + "\n\t RoundToFloor(12, 20) ==> 0" + From 41304c0e9da8f3263a220403d9c28866fcd7fd12 Mon Sep 17 00:00:00 2001 From: Pawel Baran Date: Mon, 4 Nov 2024 14:07:35 +0100 Subject: [PATCH 5/7] Round and RoundToCeiling added --- BHoM_Engine/Query/Round.cs | 130 ++++++++++++++++++++++++++++ BHoM_Engine/Query/RoundToCeiling.cs | 100 +++++++++++++++++++++ 2 files changed, 230 insertions(+) create mode 100644 BHoM_Engine/Query/Round.cs create mode 100644 BHoM_Engine/Query/RoundToCeiling.cs diff --git a/BHoM_Engine/Query/Round.cs b/BHoM_Engine/Query/Round.cs new file mode 100644 index 000000000..eca060d11 --- /dev/null +++ b/BHoM_Engine/Query/Round.cs @@ -0,0 +1,130 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2024, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ + +using BH.oM.Base.Attributes; +using System; +using System.ComponentModel; + +namespace BH.Engine.Base +{ + public static partial class Query + { + /***************************************************/ + /**** Public Methods ****/ + /***************************************************/ + + [Description("Rounds a number using the given tolerance, rounding to the nearest tolerance multiplier." + + "Supports any fractional, integer, positive or negative numbers." + + "\nSome examples:" + + "\n\t Round(12, 20) ==> 20" + + "\n\t Round(121, 2) ==> 122" + + "\n\t Round(1.2345, 1.1) ==> 1.1" + + "\n\t Round(0.014, 0.01) ==> 0.01" + + "\n\t Round(-0.014, 0.01) ==> -0.01" + + "\n\t Round(0.015, 0.01) ==> 0.02" + + "\n\t Round(0.014, 0.02) ==> 0.02" + + "\nand so on.")] + [Input("number", "Number to be rounded.")] + [Input("tolerance", "Tolerance to use for rounding.")] + public static double Round(this double number, double tolerance) + { + if (tolerance < 0) + { + BH.Engine.Base.Compute.RecordError("Tolerance cannot be less than 0."); + return default(double); + } + + // If the tolerance is the smallest possible double, or if the inputs are invalid, just return. + if (number == 0 || tolerance == 0 || Double.IsNaN(tolerance) || Double.IsNaN(number) || Double.IsInfinity(number) || Double.IsInfinity(tolerance)) + return number; + + // First check if the tolerance can be converted into fractional digits, i.e. is a number in the form of 10^someExp. + // This avoids imprecisions with the approximation formula below. If so, just return Math.Round(). + int fractionalDigits = Math.Abs(System.Convert.ToInt32(Math.Log10(tolerance))); + if (tolerance < 1 && Math.Pow(10, -fractionalDigits) == tolerance) + return Math.Round(number, fractionalDigits); + + // Otherwise, perform the approximation with the given tolerance. + //int unitStep = number > 0 ? 1 : -1; // Useful to deal with negative numbers. + return RoundNumericValue(number, tolerance); + } + + /***************************************************/ + + // NOTE: Although we could be satisfied with just one method "Round" from the UI perspective, + // we also need a dedicated method for Integers, to avoid a performance hit when using this method from other parts of the code, e.g. in Hash(). + + [Description("Rounds an integer number using the given tolerance, rounding to the nearest tolerance multiplier." + + "\nSome examples:" + + "\n\t Round(12, 20) ==> 20" + + "\n\t Round(121, 2) ==> 122" + + "\n\t Round(-35, 20) ==> -40" + + "\nand so on.")] + [Input("number", "Number to be rounded.")] + [Input("tolerance", "Tolerance to use for rounding.")] + public static int Round(this int number, double tolerance) + { + if (tolerance < 0) + { + BH.Engine.Base.Compute.RecordError("Tolerance cannot be less than 0."); + return 0; + } + + // If the tolerance is the smallest possible double, or if the inputs are invalid, just return. + if (number == 0 || tolerance == double.MinValue || tolerance == 0 || Double.IsNaN(tolerance) || number == int.MinValue || number == int.MaxValue || Double.IsInfinity(tolerance)) + return number; + + if ((int)tolerance != tolerance) + { + BH.Engine.Base.Compute.RecordError("Tolerance needs to be an integer value."); + return 0; + } + + return (int)(RoundNumericValue(number, tolerance)); + } + + /***************************************************/ + /**** Private Methods ****/ + /***************************************************/ + + private static double RoundNumericValue(double value, double accuracy) + { + bool neg = value < 0; + if (neg) + value = -value; + + decimal decV = (decimal)value; + decimal decA = (decimal)accuracy; + decimal diff = decV % decA; + if (diff >= decA / 2m) + diff = -(decA - diff); + + double res = (double)(decV - diff); + if (neg) + res = -res; + + return res; + } + + /***************************************************/ + } +} diff --git a/BHoM_Engine/Query/RoundToCeiling.cs b/BHoM_Engine/Query/RoundToCeiling.cs new file mode 100644 index 000000000..b15cc46f8 --- /dev/null +++ b/BHoM_Engine/Query/RoundToCeiling.cs @@ -0,0 +1,100 @@ +/* + * This file is part of the Buildings and Habitats object Model (BHoM) + * Copyright (c) 2015 - 2024, the respective contributors. All rights reserved. + * + * Each contributor holds copyright over their respective contributions. + * The project versioning (Git) records all such contribution source information. + * + * + * The BHoM is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3.0 of the License, or + * (at your option) any later version. + * + * The BHoM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this code. If not, see . + */ + +using BH.oM.Base.Attributes; +using System; +using System.ComponentModel; + +namespace BH.Engine.Base +{ + public static partial class Query + { + /***************************************************/ + /**** Public Methods ****/ + /***************************************************/ + + [Description("Rounds a number using the given tolerance, rounding to ceiling to the nearest tolerance multiplier." + + "Supports any fractional, integer, positive or negative numbers." + + "\nSome examples:" + + "\n\t RoundToCeiling(12, 20) ==> 20" + + "\n\t RoundToCeiling(121, 2) ==> 122" + + "\n\t RoundToCeiling(1.2345, 1.1) ==> 2.2" + + "\n\t RoundToCeiling(0.014, 0.01) ==> 0.02" + + "\n\t RoundToCeiling(-0.014, 0.01) ==> -0.01" + + "\n\t RoundToCeiling(0.015, 0.01) ==> 0.02" + + "\n\t RoundToCeiling(0.014, 0.02) ==> 0.02" + + "\nand so on.")] + [Input("number", "Number to be rounded.")] + [Input("tolerance", "Tolerance to use for rounding.")] + public static double RoundToCeiling(this double number, double tolerance) + { + if (tolerance < 0) + { + BH.Engine.Base.Compute.RecordError("Tolerance cannot be less than 0."); + return default(double); + } + + // If the tolerance is the smallest possible double, or if the inputs are invalid, just return. + if (number == 0 || tolerance == 0 || Double.IsNaN(tolerance) || Double.IsNaN(number) || Double.IsInfinity(number) || Double.IsInfinity(tolerance)) + return number; + + // Otherwise, perform the approximation with the given tolerance. + return tolerance * Math.Ceiling(number / tolerance); + } + + /***************************************************/ + + // NOTE: Although we could be satisfied with just one method "RoundToCeiling" from the UI perspective, + // we also need a dedicated method for Integers, to avoid a performance hit when using this method from other parts of the code, e.g. in Hash(). + + [Description("Rounds an integer number using the given tolerance, rounding to ceiling to the nearest tolerance multiplier." + + "\nSome examples:" + + "\n\t RoundToCeiling(12, 20) ==> 20" + + "\n\t RoundToCeiling(121, 2) ==> 122" + + "\n\t RoundToCeiling(-35, 20) ==> -20" + + "\nand so on.")] + [Input("number", "Number to be rounded.")] + [Input("tolerance", "Tolerance to use for rounding.")] + public static int RoundToCeiling(this int number, double tolerance) + { + if (tolerance < 0) + { + BH.Engine.Base.Compute.RecordError("Tolerance cannot be less than 0."); + return 0; + } + + // If the tolerance is the smallest possible double, or if the inputs are invalid, just return. + if (number == 0 || tolerance == double.MinValue || tolerance == 0 || Double.IsNaN(tolerance) || number == int.MinValue || number == int.MaxValue || Double.IsInfinity(tolerance)) + return number; + + if ((int)tolerance != tolerance) + { + BH.Engine.Base.Compute.RecordError("Tolerance needs to be an integer value."); + return 0; + } + + return (int)(Math.Ceiling(number / tolerance) * tolerance); + } + + /***************************************************/ + } +} From 4480cbefa010752f5cba9055ccd7c0a0fd711977 Mon Sep 17 00:00:00 2001 From: Pawel Baran Date: Mon, 4 Nov 2024 14:24:35 +0100 Subject: [PATCH 6/7] UTs added --- .ci/Datasets/BHoM_Engine/Query/Round.json | 1 + .ci/Datasets/BHoM_Engine/Query/RoundToCeiling.json | 1 + .ci/Datasets/BHoM_Engine/Query/RoundToFloor.json | 1 + 3 files changed, 3 insertions(+) create mode 100644 .ci/Datasets/BHoM_Engine/Query/Round.json create mode 100644 .ci/Datasets/BHoM_Engine/Query/RoundToCeiling.json create mode 100644 .ci/Datasets/BHoM_Engine/Query/RoundToFloor.json diff --git a/.ci/Datasets/BHoM_Engine/Query/Round.json b/.ci/Datasets/BHoM_Engine/Query/Round.json new file mode 100644 index 000000000..ecf1cf1f4 --- /dev/null +++ b/.ci/Datasets/BHoM_Engine/Query/Round.json @@ -0,0 +1 @@ +{ "_t" : "BH.oM.Data.Library.Dataset", "SourceInformation" : { "_t" : "BH.oM.Data.Library.Source", "SourceLink" : "", "Title" : "Round", "Author" : "Pawel Baran", "ItemReference" : "", "Version" : "", "Publisher" : "", "Schema" : "", "Language" : "", "Location" : "", "Copyright" : "", "Contributors" : "", "Confidence" : "Undefined", "BHoM_Guid" : "90e8498f-3d97-4ac9-9dd0-67926e15d8a7", "Name" : "" }, "TimeOfCreation" : { "$date" : 1730726648330 }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.UnitTest", "Method" : { "_t" : "System.Reflection.MethodBase", "TypeName" : "{ \"_t\" : \"System.Type\", \"Name\" : \"BH.Engine.Base.Query, BHoM_Engine, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null\", \"_bhomVersion\" : \"8.0\" }", "MethodName" : "Round", "Parameters" : ["{ \"_t\" : \"System.Type\", \"Name\" : \"System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"8.0\" }", "{ \"_t\" : \"System.Type\", \"Name\" : \"System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"8.0\" }"], "_bhomVersion" : "8.0" }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [12.0, 20.0], "Outputs" : [20.0], "BHoM_Guid" : "f6b32e78-f113-4fc9-942d-9fc6920be7eb", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [121.0, 2.0], "Outputs" : [122.0], "BHoM_Guid" : "dc1eaa58-b440-42c4-8d68-9161c9780186", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [1.2344999999999999, 1.1000000000000001], "Outputs" : [1.1000000000000001], "BHoM_Guid" : "0b1db6b7-07af-480b-86da-63a771eb4194", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.014, 0.01], "Outputs" : [0.01], "BHoM_Guid" : "af5461e9-a918-4886-9da8-b941b0f811c2", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-0.014, 0.01], "Outputs" : [-0.01], "BHoM_Guid" : "d9bd8235-c886-4db7-9dfa-9ccdfcc9767c", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.014999999999999999, 0.01], "Outputs" : [0.02], "BHoM_Guid" : "9971abce-7b9e-4aa7-8757-303311ef4997", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.014, 0.02], "Outputs" : [0.02], "BHoM_Guid" : "b237a312-49c6-4992-8f61-c021ffca123c", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 0.0], "Outputs" : [2.0], "BHoM_Guid" : "b204c2fd-9ba0-4ef8-b102-391ec89841d1", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 0.33333333333333331], "Outputs" : [1.999999999999998], "BHoM_Guid" : "88d0b25c-2a65-4bea-812f-1a245312b157", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 0.66666666666666663], "Outputs" : [2.0000000000000009], "BHoM_Guid" : "cd831a59-80bc-462b-9aa7-3f642a631145", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 1.0], "Outputs" : [2.0], "BHoM_Guid" : "eab0d62e-0aa0-41f0-ab1f-91ab487f4776", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 1.3333333333333333], "Outputs" : [2.6666666666666599], "BHoM_Guid" : "61cf895c-869e-4feb-b6a4-02b4b725c432", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 1.6666666666666665], "Outputs" : [1.6666666666666701], "BHoM_Guid" : "09e6136d-c926-4ea7-a2c1-bfeeed8ff6c7", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-3.5, 2.0], "Outputs" : [-4.0], "BHoM_Guid" : "be07b1c2-dc49-4e20-aff8-cd58ed144596", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-3.0, 2.0], "Outputs" : [-4.0], "BHoM_Guid" : "6169f811-3730-4977-8ab6-d1c1e178cdfe", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-2.5, 2.0], "Outputs" : [-2.0], "BHoM_Guid" : "63b7e9f0-40db-4a31-9a01-2f6294dd7684", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-2.0, 2.0], "Outputs" : [-2.0], "BHoM_Guid" : "f888a79e-c889-4e8c-a522-f7360e21ca1f", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-1.5, 2.0], "Outputs" : [-2.0], "BHoM_Guid" : "77b9f1c4-27a8-4eba-af76-7be8e47e37b1", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-1.0, 2.0], "Outputs" : [-2.0], "BHoM_Guid" : "d887e0a9-3801-4891-92b1-ca63d599ca6f", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-0.5, 2.0], "Outputs" : [0.0], "BHoM_Guid" : "9b405899-fc88-401d-8dc1-3873de218dbd", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.0, 2.0], "Outputs" : [0.0], "BHoM_Guid" : "fa30126a-beb4-46d7-8a33-1a8fbf96bc45", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.5, 2.0], "Outputs" : [0.0], "BHoM_Guid" : "917b586d-989b-4712-8289-c2cadec3a708", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [1.0, 2.0], "Outputs" : [2.0], "BHoM_Guid" : "17f58d2a-74b6-48a9-b8d6-805488f99040", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [1.5, 2.0], "Outputs" : [2.0], "BHoM_Guid" : "36591ba9-b249-4a52-a771-c9fa80db9856", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 2.0], "Outputs" : [2.0], "BHoM_Guid" : "0a2cf9ae-9153-40bb-9027-3177c22a4135", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.5, 2.0], "Outputs" : [2.0], "BHoM_Guid" : "c8ac6222-4918-4017-b787-71a0b4c67e48", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [3.0, 2.0], "Outputs" : [4.0], "BHoM_Guid" : "4e8d7003-76c8-4c7e-8d48-afcc8839d2ab", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [3.5, 2.0], "Outputs" : [4.0], "BHoM_Guid" : "48b86885-b449-4bfa-a848-647377476636", "Name" : "" }], "BHoM_Guid" : "da537a28-bcb2-4696-a6c2-ca8e7f775a61", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.UnitTest", "Method" : { "_t" : "System.Reflection.MethodBase", "TypeName" : "{ \"_t\" : \"System.Type\", \"Name\" : \"BH.Engine.Base.Query, BHoM_Engine, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null\", \"_bhomVersion\" : \"8.0\" }", "MethodName" : "Round", "Parameters" : ["{ \"_t\" : \"System.Type\", \"Name\" : \"System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"8.0\" }", "{ \"_t\" : \"System.Type\", \"Name\" : \"System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"8.0\" }"], "_bhomVersion" : "8.0" }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [12, 20.0], "Outputs" : [20], "BHoM_Guid" : "88e3cc32-5a13-4598-af4d-e114f2e3c4ce", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [121, 2.0], "Outputs" : [122], "BHoM_Guid" : "cbea8b5f-a68f-4add-8806-9122261ab5d3", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-35, 20.0], "Outputs" : [-40], "BHoM_Guid" : "c3cd87e2-2d91-491b-b84a-d87cb92e1b20", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-5, 3.0], "Outputs" : [-6], "BHoM_Guid" : "f1953b96-1c23-465d-877e-3f6e4a82f052", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-4, 3.0], "Outputs" : [-3], "BHoM_Guid" : "67f47638-4064-465c-b59e-9d9f202b2b29", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-3, 3.0], "Outputs" : [-3], "BHoM_Guid" : "2f9af6f7-4d23-4730-bc2f-894cdf4d054a", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-2, 3.0], "Outputs" : [-3], "BHoM_Guid" : "cb8e6456-f89a-4d82-8393-fac29d582c72", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-1, 3.0], "Outputs" : [0], "BHoM_Guid" : "cb4bb881-896a-4d43-8ec9-5dc675fe8f76", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0, 3.0], "Outputs" : [0], "BHoM_Guid" : "9e07d7ed-b17f-4534-9254-a24dd85317da", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [1, 3.0], "Outputs" : [0], "BHoM_Guid" : "e507150b-1414-4b50-af20-a5f0a3e9211c", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2, 3.0], "Outputs" : [3], "BHoM_Guid" : "32839e0d-a9ca-4ce5-a162-667bb2ae2b6d", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [3, 3.0], "Outputs" : [3], "BHoM_Guid" : "07c4fa8e-5998-4006-8853-b6a6dd7dd139", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [4, 3.0], "Outputs" : [3], "BHoM_Guid" : "317af04c-9e78-489a-bcf6-ccdc9ceb8f68", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [5, 3.0], "Outputs" : [6], "BHoM_Guid" : "c5041cf3-4579-43b9-adf2-16c514fd0b3e", "Name" : "" }], "BHoM_Guid" : "a2a43d08-ebb1-4a34-ae75-8b52fc6424fc", "Name" : "" }], "BHoM_Guid" : "e6c40881-7c22-4d01-87e8-153fe4948e8d", "Name" : "Round", "_bhomVersion" : "8.0" } \ No newline at end of file diff --git a/.ci/Datasets/BHoM_Engine/Query/RoundToCeiling.json b/.ci/Datasets/BHoM_Engine/Query/RoundToCeiling.json new file mode 100644 index 000000000..6ef382451 --- /dev/null +++ b/.ci/Datasets/BHoM_Engine/Query/RoundToCeiling.json @@ -0,0 +1 @@ +{ "_t" : "BH.oM.Data.Library.Dataset", "SourceInformation" : { "_t" : "BH.oM.Data.Library.Source", "SourceLink" : "", "Title" : "RoundToCeiling", "Author" : "Pawel Baran", "ItemReference" : "", "Version" : "", "Publisher" : "", "Schema" : "", "Language" : "", "Location" : "", "Copyright" : "", "Contributors" : "", "Confidence" : "Undefined", "BHoM_Guid" : "f40678e3-86b2-441a-9805-aacd27b56d9a", "Name" : "" }, "TimeOfCreation" : { "$date" : 1730726648330 }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.UnitTest", "Method" : { "_t" : "System.Reflection.MethodBase", "TypeName" : "{ \"_t\" : \"System.Type\", \"Name\" : \"BH.Engine.Base.Query, BHoM_Engine, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null\", \"_bhomVersion\" : \"8.0\" }", "MethodName" : "RoundToCeiling", "Parameters" : ["{ \"_t\" : \"System.Type\", \"Name\" : \"System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"8.0\" }", "{ \"_t\" : \"System.Type\", \"Name\" : \"System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"8.0\" }"], "_bhomVersion" : "8.0" }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [12.0, 20.0], "Outputs" : [20.0], "BHoM_Guid" : "aa62d485-0030-4fc7-b7ef-ce6821a0a58a", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [121.0, 2.0], "Outputs" : [122.0], "BHoM_Guid" : "37a3b245-6489-4012-8f62-cbd03845c38d", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [1.2344999999999999, 1.1000000000000001], "Outputs" : [2.2000000000000002], "BHoM_Guid" : "17b49100-a3df-46d6-a1b5-90a62d230790", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.014, 0.01], "Outputs" : [0.02], "BHoM_Guid" : "3525f048-780e-44f8-8a9f-db1c15be80e1", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-0.014, 0.01], "Outputs" : [-0.01], "BHoM_Guid" : "c9093cc1-dc43-4b4f-9ff0-6f39e47e6ab7", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.014999999999999999, 0.01], "Outputs" : [0.02], "BHoM_Guid" : "23ab0987-ead7-45d3-b853-83b9f54c98fe", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.014, 0.02], "Outputs" : [0.02], "BHoM_Guid" : "d47a2f0d-2631-46a6-a44c-29d044066f9d", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 0.0], "Outputs" : [2.0], "BHoM_Guid" : "d8920b41-ce79-42d2-bc2e-cdea1a99d65e", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 0.33333333333333331], "Outputs" : [2.0], "BHoM_Guid" : "10343647-d2dc-4653-9a51-4dabb02babcc", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 0.66666666666666663], "Outputs" : [2.0], "BHoM_Guid" : "82c09cb4-8295-4d70-9233-17fb87420d1b", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 1.0], "Outputs" : [2.0], "BHoM_Guid" : "1d59d300-ad86-4c39-8f2a-4e521034c8bb", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 1.3333333333333333], "Outputs" : [2.6666666666666665], "BHoM_Guid" : "031ceb79-bb8d-435b-9343-85438282c163", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 1.6666666666666665], "Outputs" : [3.333333333333333], "BHoM_Guid" : "018e2707-319b-4437-8cff-5f5febc95b87", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-3.5, 2.0], "Outputs" : [-2.0], "BHoM_Guid" : "2928c19e-0e9b-43d6-8c36-bed0b3aaa7d8", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-3.0, 2.0], "Outputs" : [-2.0], "BHoM_Guid" : "20170544-154b-4236-8188-d112ecd36310", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-2.5, 2.0], "Outputs" : [-2.0], "BHoM_Guid" : "1e4e7986-19f5-455d-bbae-e81c8c0b52e3", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-2.0, 2.0], "Outputs" : [-2.0], "BHoM_Guid" : "73b1111a-bcf9-4226-889c-05b441f70259", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-1.5, 2.0], "Outputs" : [0.0], "BHoM_Guid" : "3fdb0e1a-fc37-4854-9da5-0b4040afe06f", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-1.0, 2.0], "Outputs" : [0.0], "BHoM_Guid" : "8d44c69f-8940-4b65-ba1b-eec99d3a7f01", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-0.5, 2.0], "Outputs" : [0.0], "BHoM_Guid" : "37ef8f71-dfcc-476c-b4f9-33238cdffe93", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.0, 2.0], "Outputs" : [0.0], "BHoM_Guid" : "54814c67-27e3-4a3a-a0fc-51f8b3bdcc0c", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.5, 2.0], "Outputs" : [2.0], "BHoM_Guid" : "6393d53e-2053-4d90-80e8-bfcb7d789414", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [1.0, 2.0], "Outputs" : [2.0], "BHoM_Guid" : "aed73a26-5c41-40a1-83e1-dfdd4fdf9a88", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [1.5, 2.0], "Outputs" : [2.0], "BHoM_Guid" : "70654231-b691-4960-b762-4bcc6b5d9087", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 2.0], "Outputs" : [2.0], "BHoM_Guid" : "5e18b777-334a-4981-b9fe-a9af93c9db07", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.5, 2.0], "Outputs" : [4.0], "BHoM_Guid" : "264cc880-333d-4035-b38a-1de6013c77f6", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [3.0, 2.0], "Outputs" : [4.0], "BHoM_Guid" : "96e8db14-de76-4b7e-b0a2-1c70de2f2142", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [3.5, 2.0], "Outputs" : [4.0], "BHoM_Guid" : "a1d2a7ee-f055-488e-83d0-def317cd319e", "Name" : "" }], "BHoM_Guid" : "1a13e07c-5d41-49ac-ade4-be849399f867", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.UnitTest", "Method" : { "_t" : "System.Reflection.MethodBase", "TypeName" : "{ \"_t\" : \"System.Type\", \"Name\" : \"BH.Engine.Base.Query, BHoM_Engine, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null\", \"_bhomVersion\" : \"8.0\" }", "MethodName" : "RoundToCeiling", "Parameters" : ["{ \"_t\" : \"System.Type\", \"Name\" : \"System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"8.0\" }", "{ \"_t\" : \"System.Type\", \"Name\" : \"System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"8.0\" }"], "_bhomVersion" : "8.0" }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [12, 20.0], "Outputs" : [20], "BHoM_Guid" : "18826de7-1d25-4001-a8fc-d82f5b03917d", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [121, 2.0], "Outputs" : [122], "BHoM_Guid" : "3d70ef93-61b9-4082-a140-fd8f2bea30a8", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-35, 20.0], "Outputs" : [-20], "BHoM_Guid" : "c79c2657-b038-404b-8201-ffa183e09acd", "Name" : "" }], "BHoM_Guid" : "05d926ca-1843-4039-8424-58d389ac3700", "Name" : "" }], "BHoM_Guid" : "4971bdaa-71fb-42cf-8926-0fdee9dac3c6", "Name" : "RoundToCeiling", "_bhomVersion" : "8.0" } \ No newline at end of file diff --git a/.ci/Datasets/BHoM_Engine/Query/RoundToFloor.json b/.ci/Datasets/BHoM_Engine/Query/RoundToFloor.json new file mode 100644 index 000000000..8a75dc899 --- /dev/null +++ b/.ci/Datasets/BHoM_Engine/Query/RoundToFloor.json @@ -0,0 +1 @@ +{ "_t" : "BH.oM.Data.Library.Dataset", "SourceInformation" : { "_t" : "BH.oM.Data.Library.Source", "SourceLink" : "", "Title" : "RoundToFloor", "Author" : "Pawel Baran", "ItemReference" : "", "Version" : "", "Publisher" : "", "Schema" : "", "Language" : "", "Location" : "", "Copyright" : "", "Contributors" : "", "Confidence" : "Undefined", "BHoM_Guid" : "dc3874c7-fae5-4bdd-af21-fac096edfe20", "Name" : "" }, "TimeOfCreation" : { "$date" : 1730726648330 }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.UnitTest", "Method" : { "_t" : "System.Reflection.MethodBase", "TypeName" : "{ \"_t\" : \"System.Type\", \"Name\" : \"BH.Engine.Base.Query, BHoM_Engine, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null\", \"_bhomVersion\" : \"8.0\" }", "MethodName" : "RoundToFloor", "Parameters" : ["{ \"_t\" : \"System.Type\", \"Name\" : \"System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"8.0\" }", "{ \"_t\" : \"System.Type\", \"Name\" : \"System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"8.0\" }"], "_bhomVersion" : "8.0" }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [12.0, 20.0], "Outputs" : [0.0], "BHoM_Guid" : "4313c050-b410-4bde-bc53-c9e71c2cb784", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [121.0, 2.0], "Outputs" : [120.0], "BHoM_Guid" : "2f973b07-5996-48eb-83be-0717be358920", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [1.2344999999999999, 1.1000000000000001], "Outputs" : [1.1000000000000001], "BHoM_Guid" : "12c54dce-6265-45f8-aac9-417453e90e0d", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.014, 0.01], "Outputs" : [0.01], "BHoM_Guid" : "65000816-1226-4de2-8d6d-201019b20c3e", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-0.014, 0.01], "Outputs" : [-0.02], "BHoM_Guid" : "cca32a03-185f-4c97-bd09-8569a9545d21", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.014999999999999999, 0.01], "Outputs" : [0.01], "BHoM_Guid" : "dce86e3f-a150-4afe-a908-613a3cecea50", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.014, 0.02], "Outputs" : [0.0], "BHoM_Guid" : "cda056e5-557c-4122-afe2-183ba2ed3fc8", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 0.0], "Outputs" : [2.0], "BHoM_Guid" : "42bddc17-735d-436e-986d-6affdba4182f", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 0.33333333333333331], "Outputs" : [2.0], "BHoM_Guid" : "ed690c2e-b28f-47d9-b5f0-7868e32a7653", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 0.66666666666666663], "Outputs" : [2.0], "BHoM_Guid" : "048638f6-2b17-48f7-829f-fbaf08f333b4", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 1.0], "Outputs" : [2.0], "BHoM_Guid" : "98f69a5c-6156-47b3-b18f-b0f462f27652", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 1.3333333333333333], "Outputs" : [1.3333333333333333], "BHoM_Guid" : "ef3607ed-5f04-4030-8bc8-f3e5d810e8c7", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 1.6666666666666665], "Outputs" : [1.6666666666666665], "BHoM_Guid" : "e2fd38d6-0b26-4b18-8cd9-eaa9869c2df4", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-3.5, 2.0], "Outputs" : [-4.0], "BHoM_Guid" : "a553019a-a0c9-4484-af54-615e07802fce", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-3.0, 2.0], "Outputs" : [-4.0], "BHoM_Guid" : "2595b162-2313-43a2-8ab5-b35c470eb536", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-2.5, 2.0], "Outputs" : [-4.0], "BHoM_Guid" : "df79ec31-481f-4ca5-97b8-1b659c063afc", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-2.0, 2.0], "Outputs" : [-2.0], "BHoM_Guid" : "f496c1d7-5c1d-433f-b2b6-06e59d4e3e06", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-1.5, 2.0], "Outputs" : [-2.0], "BHoM_Guid" : "cc6a0f8d-8097-4839-bf2c-f43ba1e3bc54", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-1.0, 2.0], "Outputs" : [-2.0], "BHoM_Guid" : "41be4649-fe6c-4071-8996-34249ae9147e", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-0.5, 2.0], "Outputs" : [-2.0], "BHoM_Guid" : "c6ce4c8b-ae6d-4de7-a193-b8bcbf49eaab", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.0, 2.0], "Outputs" : [0.0], "BHoM_Guid" : "12c21fcb-7451-4f8e-b895-cd0b3372807f", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0.5, 2.0], "Outputs" : [0.0], "BHoM_Guid" : "23a23eb9-f094-4391-a98e-596046adf977", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [1.0, 2.0], "Outputs" : [0.0], "BHoM_Guid" : "54f537c8-0e35-42f0-9a03-bc4336ef6067", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [1.5, 2.0], "Outputs" : [0.0], "BHoM_Guid" : "0ae39610-c8b2-4a17-a452-33ac06ac6ed6", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.0, 2.0], "Outputs" : [2.0], "BHoM_Guid" : "06bb3c03-f965-4f31-8875-04c451ccbe5f", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2.5, 2.0], "Outputs" : [2.0], "BHoM_Guid" : "eac7ce61-848a-4c15-a294-42b3ce192ae3", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [3.0, 2.0], "Outputs" : [2.0], "BHoM_Guid" : "9bd290c0-dc81-4fcf-a788-640eb845c019", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [3.5, 2.0], "Outputs" : [2.0], "BHoM_Guid" : "149b368b-6a80-4a00-90f6-369286fbbbef", "Name" : "" }], "BHoM_Guid" : "f4776d46-c1c4-411b-88eb-978246c7de30", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.UnitTest", "Method" : { "_t" : "System.Reflection.MethodBase", "TypeName" : "{ \"_t\" : \"System.Type\", \"Name\" : \"BH.Engine.Base.Query, BHoM_Engine, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null\", \"_bhomVersion\" : \"8.0\" }", "MethodName" : "RoundToFloor", "Parameters" : ["{ \"_t\" : \"System.Type\", \"Name\" : \"System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"8.0\" }", "{ \"_t\" : \"System.Type\", \"Name\" : \"System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"8.0\" }"], "_bhomVersion" : "8.0" }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [12, 20.0], "Outputs" : [0], "BHoM_Guid" : "8bd24ec8-f7cc-4156-bb8e-cd3b9dde96e0", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [121, 2.0], "Outputs" : [120], "BHoM_Guid" : "c32f7c9d-d6cd-4e4b-9082-c99b43f38465", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-35, 20.0], "Outputs" : [-40], "BHoM_Guid" : "c216bce1-f8cf-446a-9fa3-c9f69fd98c50", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-5, 3.0], "Outputs" : [-6], "BHoM_Guid" : "7a757517-1a9f-4d92-9a9c-a739868eb2c6", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-4, 3.0], "Outputs" : [-6], "BHoM_Guid" : "689af816-eda9-4031-be6e-26b8da690e93", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-3, 3.0], "Outputs" : [-3], "BHoM_Guid" : "2c4a5073-6b96-4e90-b1fc-55feb72a9fb2", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-2, 3.0], "Outputs" : [-3], "BHoM_Guid" : "431753e2-fe42-459e-abf5-40473eeb9479", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [-1, 3.0], "Outputs" : [-3], "BHoM_Guid" : "9230a5aa-400e-4602-80cd-8e5a61758630", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [0, 3.0], "Outputs" : [0], "BHoM_Guid" : "3296f81f-91b6-47c8-881d-151dc9ba4f37", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [1, 3.0], "Outputs" : [0], "BHoM_Guid" : "f5bceca9-dfec-4ecb-88a9-e1ce525c3fbf", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [2, 3.0], "Outputs" : [0], "BHoM_Guid" : "ab969185-d7a8-467d-8076-feda02a37b35", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [3, 3.0], "Outputs" : [3], "BHoM_Guid" : "bfe12d20-f927-491b-9bcd-c3ea21e59279", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [4, 3.0], "Outputs" : [3], "BHoM_Guid" : "db67d6e1-f35c-4915-9d87-e4dd867a40e2", "Name" : "" }, { "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [5, 3.0], "Outputs" : [3], "BHoM_Guid" : "cc8ad87e-4680-41e7-a1f6-633d470a6cf0", "Name" : "" }], "BHoM_Guid" : "b671a445-2603-4dc6-b570-6cc8ae779947", "Name" : "" }], "BHoM_Guid" : "5e83fa1a-72c7-4194-a432-111015769da0", "Name" : "RoundToFloor", "_bhomVersion" : "8.0" } \ No newline at end of file From bfb872a50ca86f222a50c0c10b4a8faba7c372e9 Mon Sep 17 00:00:00 2001 From: Alessio Lombardi Date: Tue, 5 Nov 2024 09:30:51 +0000 Subject: [PATCH 7/7] Diffing NumericalApproximation to use Query.Round Co-Authored-By: Pawel Baran --- BHoM_Engine/Query/NumericalApproximation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BHoM_Engine/Query/NumericalApproximation.cs b/BHoM_Engine/Query/NumericalApproximation.cs index 1a2e4790a..cb0fe1fc7 100644 --- a/BHoM_Engine/Query/NumericalApproximation.cs +++ b/BHoM_Engine/Query/NumericalApproximation.cs @@ -93,7 +93,7 @@ public static double NumericalApproximation(this double number, string fullName { double tolerance = NumericTolerance(customNumericTolerances, globalNumericTolerance, fullName, false); if (tolerance != double.MaxValue) - number = Query.RoundToFloor(number, tolerance); + number = Query.Round(number, tolerance); } // 2) Check significantFigures.