Negate decimal methods that convert positive decimals into negative decimals and vice versa.
The negateDecimal class can be accessed in the src folder or by clicking here.
NegateDecimal negateDecimal = new NegateDecimal(); // One way of getting the negateDecimal class.
Returns a negative version of a positive double and vice versa.
negateDecimal.negateDouble(6.0); // Returns -6.0 as a double.
negateDecimal.negateDouble(156.415); // Returns -156.415 as a double.
negateDecimal.negateDouble(0.0); // Returns 0.0 as a double.
negateDecimal.negateDouble(-9.0); // Returns 9.0 as a double.
negateDecimal.negateDouble(-16.5); // Returns 16.5 as a double.
Returns a negative version of a positve float and vice versa.
negateDecimal.negateFloat(6.0f); // Returns -6.0 as a float.
negateDecimal.negateFloat(156.415f); // Returns -156.415 as a float.
negateDecimal.negateFloat(0.0f); // Returns 0.0 as a float.
negateDecimal.negateFloat(-9.0f); // Returns 9.0 as a float.
negateDecimal.negateFloat(-16.5f); // Returns 16.5 as a float.
This repository contains the MIT license. You must give credit if you are going to use its source code.