Git Product home page Git Product logo

fibonacci's People

fibonacci's Issues

For loop with BigInteger

The for loop for printing the whole Fibonacci sequence to a given term number is not working. I think it's at least partly due to the failure for the i value in the loop, representing the term number, to increase over each loop. When I work on the code again tomorrow, I'll try to fix this, and fully transition from using a for loop to find the value of a specified term number to using a formula, using Phi or root 5.

Integer overflows

Due to integer overflows (if you don't know basically when a number exceeds the maximum size for the data type being used - https://en.wikipedia.org/wiki/Integer_overflow), the program can currently only run to the 92nd term. This is because after that the numbers generated exceed the maximum values for the long types I'm currently using to represent the numbers being added.

To fix this, I'm going to convert from using longs to using BigIntegers instead. I think that has a possibility of crashing the computer though because, as the name suggests, they can get quite big. Maybe I can put a limit on the time to run the for loop once? Or ideally the strain on hardware (like the CPU) and the state of the memory being used by Java. That's probably pretty difficult to implement though, so maybe just a maximum number of terms/loops (but that surely defeats the purpose of the program?).

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.