Giter Club home page Giter Club logo

cubico's People

Contributors

irperez avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jzielke

cubico's Issues

Add Virtual Measurements

Size -> Bytes, Megabytes, Gigabytes, etc.
Clock Speed -> Hertz, Megahertz, Gigahertz, etc.

Any others?

Enable Arbitrary Precision

Arbitrary Precision algorithms is what windows calculator uses to maintain accuracy in its calculations and avoids the floating point inaccuracies and make this an option not the rule.

Making this optional can provide performance when needed or accuracy when its needed.

Arbitrary precision has several algorithms with different pros and cons. I propose we try them all and run tests to see how they would benefit us. Maybe even make it a setting to choose which to use for performance reasons.

Here is the Karatsuba algorithm (pseudo code)
http://en.wikipedia.org/wiki/Karatsuba_algorithm

procedure karatsuba(num1, num2)
if (num1 < 10) or (num2 < 10)
return num1_num2
/_ calculates the size of the numbers /
m = max(size(num1), size(num2))
low1, low2 = lower half of num1, num2
high1, high2 = higher half of num1, num2
/
3 calls made to numbers approximately half the size _/
z0 = karatsuba(low1,low2)
z1 = karatsuba((low1+high1),(low2+high2))
z2 = karatsuba(high1,high2)
return (z2_10^(m))+((z1-z2-z0)*10^(m/2))+(z0)

Exception thrown: 'System.OverflowException' in mscorlib.dl

Hi Cubico,

You did a nice job on your application.

I am getting an error in a Web-Application project using v1.1.0.

A) In the Web-Application Cubico ATTEMPT 1 works and Cubico ATTEMPT 2 fails.
B) If I rollback your software to 1.0.1 Cubico ATTEMPT 1 works and Cubico ATTEMPT 2 works.

Any help is appreciated.

Thank you,
Dave
RocklinSoftware.com, Susanville, CA
SEE LAST POST.

This was in the Cubico code. Looked interesting. (? Cubico/Src/Cubico/UnitConverter.cs)
//TODO: Fix this; was Previously NaN
const double _failsafeValue = 0;
public Dictionary<string, Unit> _SymbolDictionary;
Dictionary<string, Symbol> _IndividualSymbolDictionary;
Dictionary<string, Unit> _UnitDictionary;
Dictionary<string, UnitType> _UnitTypeDictionary;
// Constructor, sets up the unit converter.

----- Web-Application Code
protected void Session_Start(object sender, EventArgs e) // WEBSITE
{
try
{
double value = Convert.ToDouble(2.2);
string c1 = "in";
string t1 = "cm";

            Cubico.UnitConverter target = new Cubico.UnitConverter();
            var v1 = target.ConvertUnits(value, c1, t1).ToString(); // CURRENT, TARGET
            var q1 = v1;
        }
        catch (Exception ex)
        {
            var message = ex.Message;
            throw;
        }

        if (Request.IsAuthenticated) // SETUP
        {
            using (ApplicationDbContext dbContext2 = new ApplicationDbContext())
            {
                try
                {
                    string email = "";
                    string id = User.Identity.GetUserId();

                    email = (from user in dbContext2.Users where user.Id == id select user.Email).First();
                    l.Initialize(Request.IsAuthenticated, User.Identity.GetUserId(), User.Identity.GetUserName(), email);
                }
                catch (Exception ex) // TODO: remove
                {
                    var message = ex.Message;
                    l.Set_AlertMessage("global error email");
                    l.Initialize(Request.IsAuthenticated, User.Identity.GetUserId(), User.Identity.GetUserName(), "global error, email");
                }
            }
        }
        else
        {
            l.Initialize(Request.IsAuthenticated, User.Identity.GetUserId(), User.Identity.GetUserName(), "");
        }

        try
        {
            double value = Convert.ToDouble(2.2);
            string c1 = "in";
            string t1 = "cm";

            Cubico.UnitConverter target = new Cubico.UnitConverter(); // FAILURE
            var v1 = target.ConvertUnits(value, c1, t1).ToString(); // CURRENT, TARGET
            var q1 = v1;
        }
        catch (Exception ex)
        {
            var message = ex.Message; // ERROR
            throw;
        }
    }

EXCEPTION THROWN: Exception thrown: 'System.OverflowException' in mscorlib.dll
BAD MESSAGE: "Value was either too large or too small for a Decimal."
BAD STACK TRACE: " at System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt)\r\n at System.Convert.ToDecimal(String value)\r\n at Cubico.UnitProvider.ProcessUnitConverterData2(RootObject RootObject) in c:\Users\Ivan\Source\Repos\Cubico\Src\Cubico\UnitProvider.cs:line 125\r\n at Cubico.UnitProvider.LoadJsonDataFile() in c:\Users\Ivan\Source\Repos\Cubico\Src\Cubico\UnitProvider.cs:line 115\r\n at Cubico.UnitConverter..ctor() in c:\Users\Ivan\Source\Repos\Cubico\Src\Cubico\UnitConverter.cs:line 27\r\n at Ii.Website.MvcApplication.Session_Start(Object sender, EventArgs e) in C:\Users\euser\Desktop\CODEBASE\Solution\Ii.Website\Global.asax.cs:line 64"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.