qwertie / graphingcalculator Goto Github PK
View Code? Open in Web Editor NEWGraphing Calculator in C# with LES
Graphing Calculator in C# with LES
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.