Here you can find the source of absNegativeZeros(float f)
Parameter | Description |
---|---|
f | a float |
public static float absNegativeZeros(float f)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww . ja v a2 s . co m * If {@code f} is -0.0f, return 0.0f; otherwise, return {@code f}. * * <ul> * <li>{@code f} may be any {@code float}.</li> * <li>The result is not negative zero.</li> * </ul> * * @param f a {@code float} * @return a {@code float} equal to {@code f} and not -0.0f */ public static float absNegativeZeros(float f) { return f == 0.0f ? 0.0f : f; } /** * If {@code d} is -0.0, return 0.0; otherwise, return {@code d}. * * <ul> * <li>{@code d} may be any {@code double}.</li> * <li>The result is not negative zero.</li> * </ul> * * @param d a {@code double} * @return a {@code double} equal to {@code d} and not -0.0 */ public static double absNegativeZeros(double d) { return d == 0.0 ? 0.0 : d; } }