Giter VIP home page Giter VIP logo

Comments (2)

mehrdadmms avatar mehrdadmms commented on August 15, 2024

Hey, I was looking for "good first issues" as I'm looking for a new job and bumped into this issue.
Full disclosure, I have NO experience with Cairo but I used chatGPT to generate this based on the solidity code and the Babylonian method. Your project seems cool and I just wanted to help.
Also, here's my LinkedIn in case you have something that fits my skills

// Define the sqrt function using the Babylonian method
function sqrt(uint y) internal pure returns (uint z) {
    if (y > 3) {
        // Initialize z to y
        z = y;

        // Divide y by 2 and add 1 to get the first estimate, x
        uint x = y / 2 + 1;

        // Iterate until convergence
        while (x < z) {
            // Set z = x
            z = x;

            // Calculate the next estimate, x
            x = (y / x + x) / 2;
        }
    } else if (y != 0) {
        // If y <= 3, set z = 1
        z = 1;
    }

    // Create a new Cairo context for drawing
    cairo_t* cr = cairo_create(surface);

    // Draw the square root symbol using Cairo
    cairo_move_to(cr, 0, 0);
    cairo_line_to(cr, 10, 10);
    cairo_line_to(cr, 20, 0);
    cairo_stroke(cr);

    // Clean up the Cairo context
    cairo_destroy(cr);
}

from instaswap.

FelixGibson avatar FelixGibson commented on August 15, 2024

It's great. Can you rewrite it in cairo1 and add tests fot it? @mehrdadmms

from instaswap.

Related Issues (14)

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.