Giter VIP home page Giter VIP logo

100-test's Introduction

The 100 Test

A math question that evaluates to 100. Designed to test operator precedence.

TL;DR: 5 + 96 * 1 - 6 / 3 ^ 68 / 2 - 4 + 3 = 100

What is this?

The 100 Test is a simple test for programming languages and calculators alike for testing operator precedence. When correctly evaluated, the result should equal 100 (hence its name).

A way to visualize this test as a human is by adding brackets: 5 + (96 * 1) - ((6 / (3 ^ 68)) / 2) - 4 + 3

...or add another pair of brackets to clear up any ambiguity: (5 + (96 * 1) - ((6 / (3 ^ 68)) / 2) - 4) + 3

Either way, the result of this question is 100. All versions of this question should be equal to 100. If it isn't, then something is wrong with your language/calculator's operator precedence.

I got 66! Does that mean my language/calculator is busted?

Does your language use ^ for bitwise OR? One language that does this is Node.js. In which case, swap out ^ for ** since that seems to be the most common alternative for exponents. If that still doesn't work, try looking for a pow function instead.

Closing Remarks

This test was devised for Harmony, created by essentially smashing a numpad and then tweaking it slightly to equal 100 (instead of the original 97 that it produced).

Sometimes programming languages and calculators with high precision like to make a nice large 99.99999... which is a completely valid answer to this! It's just that most languages round it up because the rest of the decimal number is just 9s.

I am not a mathematician. I literally came up with this equation by smashing a numpad. There is probably an edge case I haven't thought about here.

100-test's People

Contributors

lewisakura avatar lostkagamine avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

lostkagamine

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.