<commit_before><?php
/**
 * $Id$
 *
 * Conversion functions between different systems for measurement of mass
 *
 * Supported systems:
 * - Kilogram (kg)
 * - Pound (lb)
 *
 * References
 * ----------
 * http://en.wikipedia.org/wiki/Temperature_conversion_formulas
 *
 * @author <NAME>, 2009 <<EMAIL>>
 */

class mass
{
	function conv($from, $to, $val)
	{
		//XXX: the rounding is neccesary to work around PHP's handling of floats,
		//     or some will return .0000000000001 precision which make testcase fail
		switch ($to) {
			case 'kg': return round($this->toKilo($from, $val), 8);
			case 'lb': return round($this->toPound($from, $val), 8);
		}
	}

	function toKilo($s, $val)
	{
		switch ($s) {
			case 'kg': return $val;
			case 'lb': return $val * 0.45359237; //XXX verify!
		}
	}

	function toPound($s, $val)
	{
		switch ($s) {
			case 'kg': return $val / 0.45359237;
			case 'lb': return $val;
		}
	}

}

?><commit_msg>removed comment<commit_after><?php
/**
 * $Id$
 *
 * Conversion functions between different systems for measurement of mass
 *
 * Supported systems:
 * - Kilogram (kg)
 * - Pound (lb)
 *
 * References
 * ----------
 * http://en.wikipedia.org/wiki/Temperature_conversion_formulas
 *
 * @author <NAME>, 2009 <<EMAIL>>
 */

class mass
{
	function conv($from, $to, $val)
	{
		//XXX: the rounding is neccesary to work around PHP's handling of floats,
		//     or some will return .0000000000001 precision which make testcase fail
		switch ($to) {
			case 'kg': return round($this->toKilo($from, $val), 8);
			case 'lb': return round($this->toPound($from, $val), 8);
		}
	}

	function toKilo($s, $val)
	{
		switch ($s) {
			case 'kg': return $val;
			case 'lb': return $val * 0.45359237;
		}
	}

	function toPound($s, $val)
	{
		switch ($s) {
			case 'kg': return $val / 0.45359237;
			case 'lb': return $val;
		}
	}

}

?>
{'fraction_non_alphanumeric': 0.176056338028169, 'fraction_numerical': 0.04008667388949079, 'mean_word_length': 3.0682819383259914, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3921107', 'n_tokens_mistral': 777, 'n_tokens_neox': 664, 'n_words': 189}