Convert a temperature value from another temperature scale into the Celsius temperature scale.

@param from TemperatureScale
@param temperature value from other scale
@return converted temperature value in degrees centigrade
357854
public static double convertToCelsius (TemperatureScale from, double temperature) {

        switch(from) {

            case FARENHEIT:
                return convertFarenheitToCelsius(temperature);
            case CELSIUS:
                return temperature;
            case KELVIN:
                return convertKelvinToCelsius(temperature);
            case RANKINE:
                return convertRankineToCelsius(temperature);
            default:
                throw(new RuntimeException("Invalid termpature conversion"));
        }
    }
185522
public static <F> AbstractJointConverter<F> of(final SerializableFunction<? super F, String> to,
			                                    final SerializableFunction<String, ? extends F> from) {
		return new AbstractJointConverter<F>() {
			@Override
			public String convertToString(F value, Locale locale) {
				return to.apply(value);
			}
			
			@Override
			public F convertToObject(String value, Locale locale) throws ConversionException {
				return from.apply(value);
			}
		};
	}
390177
public T delayScaleY(@FloatRange(from = 0.0) float end) {
        getDelayedProcessor().addProcess(SCALE_Y, end);
        return self();
    }
627621
public static double Scale(DoubleRange from, DoubleRange to, int x) {
        if (from.length() == 0) return 0;
        return ((to.length()) * (x - from.getMin()) / from.length() + to.getMin());
    }
357440
@VisibleForTesting
    protected static String createLabelText(
            final DistanceUnit scaleUnit, final double value, final DistanceUnit intervalUnit) {
        double scaledValue = scaleUnit.convertTo(value, intervalUnit);

        // assume that there is no interval smaller then 0.0001
        scaledValue = Math.round(scaledValue * 10000) / 10000;
        String decimals = Double.toString(scaledValue).split("\\.")[1];

        if (Double.valueOf(decimals) == 0) {
            return Long.toString(Math.round(scaledValue));
        } else {
            return Double.toString(scaledValue);
        }
    }
769604
public static long from(long otherTime, int timeScale)
    {
        TimeScaleData data = fromRangeCheck(otherTime, timeScale);
                
        return (otherTime + data.epochOffset) * data.units;
    }
441064
def _get_temperature(self, data):
        ''''''
        temp = (data[2] & ~(1 << 7)) + (data[3] / 100)
        sign = (data[2] >> 7) & 1
        if sign == 0:
            return round(temp, 2)
        return round(-1 * temp, 2)
688740
public static Decimal fromBigDecimal(BigDecimal bd, int precision, int scale) {
		bd = bd.setScale(scale, RoundingMode.HALF_UP);
		if (bd.precision() > precision) {
			return null;
		}

		long longVal = -1;
		if (precision <= MAX_COMPACT_PRECISION) {
			longVal = bd.movePointRight(scale).longValueExact();
		}
		return new Decimal(precision, scale, longVal, bd);
	}
16671
@Override
  public UnitValue convert(UnitValue value) {
    Unit src = value.unit();
    switch (src.category()) {
      case CONCENTR:
      case LIGHT:
        // Not available
        break;
        
      case ACCELERATION:
        return convert(value, Unit.METER_PER_SECOND_SQUARED, UnitFactors.ACCELERATION);
      case ANGLE:
        return convert(value, UnitFactorSets.ANGLE);
      case AREA:
        return convert(value, areaFactors());
      case CONSUMPTION:
        return convert(value, consumptionUnit());
      case DIGITAL:
        return convert(value, UnitFactorSets.DIGITAL_BYTES);
      case DURATION:
        return convert(value, UnitFactorSets.DURATION);
      case ELECTRIC:
        return convert(value, UnitFactorSets.ELECTRIC);
      case ENERGY:
        return convert(value, energyFactors());
      case FREQUENCY:
        return convert(value, UnitFactorSets.FREQUENCY);
      case LENGTH:
        return convert(value, lengthFactors());
      case MASS:
        return convert(value, massFactors());
      case POWER:
        return convert(value, UnitFactorSets.POWER);
      case PRESSURE:
        return convert(value, Unit.MILLIBAR);
      case SPEED:
        return convert(value, speedUnit());
      case TEMPERATURE:
        return convert(value, temperatureUnit());
      case VOLUME:
        return convert(value, volumeFactors());
    }
    
    return value;
  }
465239
def temperature_offset(self, offset):
        """"""
        _LOGGER.debug("Setting offset: %s", offset)
        # [-3,5 .. 0  .. 3,5 ]
        # [00   .. 07 .. 0e ]
        if offset < -3.5 or offset > 3.5:
            raise TemperatureException("Invalid value: %s" % offset)

        current = -3.5
        values = {}
        for i in range(15):
            values[current] = i
            current += 0.5

        value = struct.pack('BB', PROP_OFFSET, values[offset])
        self._conn.make_request(PROP_WRITE_HANDLE, value)
1028841
def temperature(self) -> Optional[ErrorValue]:
        """"""
        try:
            return ErrorValue(self._data['Temperature'], self._data.setdefault('TemperatureError', 0.0))
        except KeyError:
            return None
1134848
public static float[] copyOfRange(final float[] original, int from, final int to, final int step) {
        N.checkFromToIndex(from < to ? from : (to == -1 ? 0 : to), from < to ? to : from, original.length);

        if (step == 0) {
            throw new IllegalArgumentException("The input parameter 'by' can not be zero");
        }

        if (from == to || from < to != step > 0) {
            return N.EMPTY_FLOAT_ARRAY;
        }

        if (step == 1) {
            return copyOfRange(original, from, to);
        }

        from = from > to ? N.min(original.length - 1, from) : from;
        final int len = (to - from) / step + ((to - from) % step == 0 ? 0 : 1);
        final float[] copy = new float[len];

        for (int i = 0, j = from; i < len; i++, j += step) {
            copy[i] = original[j];
        }

        return copy;
    }
787102
int lastZeroInRange(int from, int to) {
		if (from < 0) throw new IllegalArgumentException();
		if (to < from) throw new IllegalArgumentException();
		from += start;
		to += start;
		if (to > finish) throw new IllegalArgumentException();
		return lastZeroInRangeAdj(from, to) - start;
	}
4339
public Matrix4 setToScale (IVector3 scale) {
        return setToScale(scale.x(), scale.y(), scale.z());
    }
9957
public static Range convert(final String source) {

        final Matcher matcher = rangePattern.matcher(source);

        if (!matcher.matches()) {
            return new Range();
        }

        final String from = matcher.group(1);
        final String to = matcher.group(2);

        final long start;

        if (from.equals("")) {
            start = 0;
        } else {
            start = parseLong(from);
        }

        final long end;
        if (to.equals("")) {
            end = -1;
        } else {
            end = parseLong(to);
        }

        return new Range(start, end);
    }
1101706
private static TimeScaleData getTimeScaleData(int scale)
    {
        if (scale < 0 || scale >= MAX_SCALE) {
            throw new IllegalArgumentException("scale out of range: " + scale);
        }
        
        return timeScaleTable[scale];
    }
1249844
public static int fromHours(int hours) {
        int refreshRate = hours * RefreshRate.SECONDS_PER_HOUR;

        RefreshRate.validateRefreshRate(refreshRate);

        return refreshRate;
    }