Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
#define f 1/
Try it online!
16 13 bytes, if it needs to handle integer input also:
#define f 1./
So you can call it with f(3) instead of f(3.0).
f(3)
f(3.0)
Thanks to @hvd for golfing 3 bytes!
#define f(x) 1/x
Try it online!Try it online!
1616 13 bytes, if it needs to handle integer input also:
#define f(x) 1./x
#define f(x)1/x
16 bytes, if it needs to handle integer input also:
#define f(x)1./x