Giter Site home page Giter Site logo

Comments (4)

srvaldez avatar srvaldez commented on May 30, 2024 1

from fbc.

countingpine avatar countingpine commented on May 30, 2024

Related thread: https://freebasic.net/forum/viewtopic.php?f=3&t=26921&p=250211
Adding more zeroes before the decimal point further decrements the exponent, e.g. format(0, "0000e+0") -> 0000e-4.
It seems to follow the same pattern as if 0.1 were used, e.g. format(0.1, "0000e+0") -> 1000e-4.

Ideally the exponent should probably always be 0. Probably just need to make zero a special case...

from fbc.

countingpine avatar countingpine commented on May 30, 2024

I think I can fix this by simply preventing the line https://github.com/freebasic/fbc/blob/1.07.1/src/rtlib/str_format.c#L286 from executing when value is zero.
But I've found further oddities, e.g. with the format string 000e+0:
0.1234 -> 123e-3
0.0000 -> 000e-3 (or 000e+0 with the suggested fix)
1.2340 -> 001e+0

In the latter case it should presumably be 123e-2, but I don't currently have quick access to VB's Format to compare...

from fbc.

jayrm avatar jayrm commented on May 30, 2024

Fixed by #272

from fbc.

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.