Git Product home page Git Product logo

Comments (6)

patham9 avatar patham9 commented on May 25, 2024

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.

cdrnet avatar cdrnet commented on May 25, 2024

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.

cdrnet avatar cdrnet commented on May 25, 2024

(slightly related: #29)

from mathnet-symbolics.

FoggyFinder avatar FoggyFinder commented on May 25, 2024

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.

patham9 avatar patham9 commented on May 25, 2024

Indeed, this is elegant and also fixes it. Thank you!

from mathnet-symbolics.

cdrnet avatar cdrnet commented on May 25, 2024

This seems to be fixed now in master and the next release. Thanks!

from mathnet-symbolics.

Related Issues (20)

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.