Giter Club home page Giter Club logo

graphingcalculator's People

Contributors

qwertie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphingcalculator's Issues

Incorrect behavior with some international settings

Hi

First, thanks and nice job with this calculator, I like it!

Unfortunately there is a problem with international settings, for instance when decimal separator is a comma, such as with my French (France) settings.

When you initialize a calculator, you predefine some well-known constants in PrepareCalculators() in CalcForm.cs using:
var variables = ParseExprs("Variables", $"pi={Math.PI};tau={Math.PI*2};e={Math.E};phi=1.6180339887498948; {cbVariables.Text}");
On my system, string interpolation produces
"pi=3,14159265358979;tau=6,28318530717959;e=2,71828182845905;phi=1.6180339887498948; x=1"
Using commas, as specified in my formatting preferences.
But then ParseExprs fails with an exception
"Variables: Unexpected separator: ',' should be ';'\r\npi=3,14159265358979;tau=6,28318530717959;e=2,71828182845905;phi=1.6180339887498948; x=1\r\n----^"

If you don't mind retargeting project to .Net framework 4.6, you can simply use Invariant method of new class FormattableString:
var variables = ParseExprs("Variables", FormattableString.Invariant($"pi={Math.PI};tau={Math.PI*2};e={Math.E};phi=1.6180339887498948; {cbVariables.Text}"));
to fix the problem. Otherwise, you can rewrite it using String.Format providing Invariant culture.

Similar problem in SetRanges function, I would upgrade it to
var newRanges = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:G8}..{1:G8}; {2:G8}..{3:G8}; {4}", xRange.Lo, xRange.Hi, yRange.Lo, yRange.Hi, zRangeText);

to avoid the same problem.

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.