five icon indicating copy to clipboard operation
five copied to clipboard

On the one hand

Open petty opened this issue 11 years ago • 9 comments

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?

petty avatar Jul 17 '14 19:07 petty

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()

Joezo avatar Jul 17 '14 21:07 Joezo

@Joezo You left pi :stuck_out_tongue_winking_eye:

dufferzafar avatar Jul 18 '14 10:07 dufferzafar

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

teuneboon avatar Jul 18 '14 12:07 teuneboon

@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')]

shackpank avatar Jul 18 '14 12:07 shackpank

#79

dufferzafar avatar Jul 18 '14 12:07 dufferzafar

@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:

rex avatar Jun 26 '15 19:06 rex

Most numbers already have their own NPM packages!

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

Number packages

  • For zero, use the integer-value-positive-zero package like this and then require it and do zero()
  • For one, use the-number-one. It's not a function so you just do one
  • For two, use the two package and do two()
  • For three, use the numeric-constant-three package and do three()
  • For four, use the always-four package and do four()
  • This package is for five.
  • For six, use the number-six package and do six()
  • For seven, use the se7en package and do seven()
  • For eight, it's a bit different. You have to use the eight-toolkit package and to get eight you do eightToolkit.constants.EIGHT or you can do const eight = require('eight-toolkit').constants.EIGHT and then just write eight
  • For nine, use the value-nine package and do nine()
  • For ten, it's not a function, use the the-number-ten package and do ten
  • For eleven, use the eleven package and do eleven()
  • For twelve, use the twlv package and do twelve()
  • For thirteen, use the always-thirteen package and do thirteen()
  • For 14, use the fourteen package and do fourteen (it's not a function)
  • For 15, use the number-fifteen package and do fifteen (also not a function)
  • For 16, use the sixteen-constant package and do sixteen (not a function)
  • For 17, use the seventeen-integer package and do seventeen() (a function)
  • For 18, use the eighteen-positive-number-interactions package and do eighteen() (a function)
  • For 19, use the nineteenify package and do nineteenify()
  • For 20, use the numbertwenty package and do twenty()
  • For 21, use the always-21 package and do twentyone()
  • For 22, use the twentytwo package and do twentytwo()
  • For 23, use the twenty-three-tools package and do twentyThreeTools.TWENTY_THREE (not a function)
  • For pi, require the get-intrinsic package and do const pi = GetIntrinsic("%Math.PI") and then to use pi do pi

Bonus: Other value packages

  • For false use the FalseJS package made by me, or, if you prefer a simpler method, use the false package by MDE and import it and call it f and use it like this: f()
  • For true use the true package by MDE, and import it as t and use it like this: t()
  • For null use the qc-core package and do qcCore.nullFn() for null.
  • For undefined use any noop function or use the undefined-is-a-function package and then run undefined() (for some reason you can name variables undefined in js)
  • For NaN use the nan-is-a-function package and then call it like this: _NaN()

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

tj-commits avatar Sep 11 '24 21:09 tj-commits

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())

tj-commits avatar Sep 11 '24 21:09 tj-commits

for three u can use numeric-constant-three on npm numeric-constant-three

tj-commits avatar Jun 08 '25 14:06 tj-commits