origin: [Genesis 38:9], coined 1741, New Latin; onanismus= from the son of Judah
noun (onanistic, adjective)
Somewhere between pleasuring yourself and being intimate with someone is "coitus interruptus" (yes, that is a technical term) -- although some also consider onanism a form of the former and use it to mean chronic masturbator.
The word originates from the biblical tale of Judah having two sons, the first named "Er" dies, and Onan takes up being the husband to his window (as was the custom); he was to produce an heir and carry forth the family name. Instead, he never completed the act of intimacy, and would always "spill his seed" upon the floor. The reasoning being that he wanted to inherit all of his brother's money, sharing none with any offspring, regardless of betraying his own family lineage.
Thus the practice became frowned upon, is associated with a selfish & wasteful act, and is negatively referred to as "onanism" with the person who commits it being an "onanist"; that is the root form of the word (as stated in the origin above), to learn more about Onan the man, certainly do refer to biblical text.