jackdclark / five

Gives you five
https://five.js.org/
MIT License
1.53k stars 251 forks source link

On the one hand #73

Open petty opened 10 years ago

petty commented 10 years ago

On the one hand … this is great, quite literally.

But after searching Github, I’ve been unable to find the rest of the set. For example, what about three()? and what about constants, like pi()?

I understand that making all numbers overly complicated could take time, so what’s the ETA?

Joezo commented 10 years ago

The beauty of five is that you can make any number you want.

Want three()? Well that's just (five() * five() - five() - five()) / five() or (five() + five() + five())/five()

Want six()? five() + (five()/five())

Want zero()? five() - five()

dufferzafar commented 10 years ago

@Joezo You left pi :stuck_out_tongue_winking_eye:

teuneboon commented 10 years ago

@dufferzafar we can estimate pi: ( (five() * five() ) - ( ( five() + five() + five() ) / five() ) ) / ( five() + ( ( five() + five() ) / five() ) )

shackpank commented 10 years ago

@dufferzafar easiest way to get pi is through builtin Math object like this

var five = require('five');
Math[Buffer(((five() * five()) - (five() / five()) + ((five() * ((five() / five()) + (five() / five()))) * five() * five() * five()) * (five() - (five() / five())) + (five() * five())).toString(), 'hex').toString('utf8')]
dufferzafar commented 10 years ago

79

rex commented 9 years ago

@shackpank I have tears in my eyes and my belly hurts from laughing. Far and away the best response ever made to any question ever asked in the history of GitHub.

May five() live forever :rocket:

tj-commits commented 2 months ago

Most numbers already have their own NPM packages!

This is just a few (not all of them have github repos)

Number packages

Bonus: Other value packages

If you want me to recommend any more packages, just ask!

tj-commits commented 2 months ago

Also you can use the solution by @Joezo but with jQuery like this:


require('vanilla-javascript')
require('vapor-js-npm')
require('none')()

global.jQuery = require('jquery')
require('jquery-basic-arithmetic-plugin')
const five = require('five')

// then to get three do:
const THREE = jQuery.divide(jQuery.subtract(jQuery.multiply(five(), five()), five() , five()), five())