Comments (6)
A dirty hack solution I used for now (Infix.fs lline 176):
| Approximation (Approximation.Real fp) ->
if fp >= 0.0 then write (fp.ToString("0.#########").Replace(".","§"))
else
if priority > 0 then write "("
write (fp.ToString("0.#########").Replace(".","§"));
if priority > 0 then write ")"
On the other side then § has to be replaced back to . again of course.
This shows one way to deal with this issue, namely to force it to not use the exponential notation. However this often results in much longer string lengths, so I guess a change in the parser that takes into account the format of the Invariant culture will be necessary in the end.
Best regards,
Patrick
from mathnet-symbolics.
Thanks for reporting this. Yes, format and parse are supposed to be symmetric (expect for some loss of precision when using approximations - but that's ok since they are approximations after all).
from mathnet-symbolics.
(slightly related: #29)
from mathnet-symbolics.
It seems, it's can be easy to fix if add one parameter for options
:
Just use
let options =
NumberLiteralOptions.AllowFraction
||| NumberLiteralOptions.AllowFractionWOIntegerPart
||| NumberLiteralOptions.AllowInfinity
||| NumberLiteralOptions.AllowExponent
instead of
let options = NumberLiteralOptions.AllowFraction ||| NumberLiteralOptions.AllowFractionWOIntegerPart ||| NumberLiteralOptions.AllowInfinity
in the Infix.fs#L57
(not tested yet)
from mathnet-symbolics.
Indeed, this is elegant and also fixes it. Thank you!
from mathnet-symbolics.
This seems to be fixed now in master and the next release. Thanks!
from mathnet-symbolics.
Related Issues (20)
- Processing does not end
- "not supported" exception with divide by zero in equation
- FSI
- Errors parsing and evaluating complex-valued string
- Evaluation of an expression dealing with Vector
- Bug: No control over culture for string formatting HOT 1
- Solving simple equations or HOT 3
- Expression.Zero.Equals() Bug? HOT 2
- Rational.Simplify gets stuck in endless loop HOT 3
- Problem with eager numeric calculation HOT 1
- Automatically escape special LaTeX characters in symbol names HOT 4
- What about cooperation? HOT 3
- Latex HOT 8
- Multiplication signs being removed by Latex.formatvisual function HOT 4
- Simplify a string of variables and numbers - vb HOT 2
- How to use variables in algebra problems using a string? HOT 2
- How to add Parsing and Evaluation of the min and max functions HOT 2
- Approximation.Real vs FloatingPoint.Real
- No effective way to generate large sums
- Order of expressions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathnet-symbolics.