Here you can find the source of clipRecklessly(double val, double bounds)
public static double clipRecklessly(double val, double bounds)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from www. j a v a2s . co m*/ * Clips the given value within the given bounds. If {@code -bounds <= val <= bounds}, {@code * val} is returned unchanged. Otherwise, {@code -bounds} is returned if {@code val<bounds} and * {@code bounds} is returned if {@code val>bounds}. {@code bounds} must be non-negative, but this * is not enforced, so prefer using {@link #clip(double, double)} except in inner-loops. * * {@code NaN} values will be left unchanged, but positive and negative infinity will be clipped. */ public static double clipRecklessly(double val, double bounds) { if (val > bounds) { return bounds; } else if (val < -bounds) { return -bounds; } else { return val; } } }