<commit_before>/**
 * Rust Tasks and Communication Tutorial - 2.2 Backgrounding computations: Futures
 * http://static.rust-lang.org/doc/master/tutorial-tasks.html#backgrounding-computations-futures
 *
 * @license MIT license <http://www.opensource.org/licenses/mit-license.php>
 */
extern mod extra;
extern mod fibonacci(name = "fibonacci", vers = "1.0", author = "eliovir");
#[cfg(not(test))]
use std::vec;

fn partial_sum(start: uint) -> f64 {
	// println(fmt!("partial_sum(%u)", start));
	let mut local_sum = 0f64;
	for num in range(start*100000, (start+1)*100000) {
		local_sum += (num as f64 + 1.0).pow(&-2.0);
	}
	local_sum
}
#[test]
fn test_partial_sum_5() {
	let param = 5u;
	let expected = 0.00000033f64;
	let actual = partial_sum(param);
	assert_approx_eq!(expected, actual);
}
#[cfg(not(test))]
fn main() {
	let n = 40;
	println("Setting spawn");
	/*
	 * Note that the future needs to be mutable so that it can save the result for next time get is called.
	 */<commit_msg>tutorial-tasks-02_2-backgrounding_computations.rs : correct obsolete syntax<commit_after>/**
 * Rust Tasks and Communication Tutorial - 2.2 Backgrounding computations: Futures
 * http://static.rust-lang.org/doc/master/tutorial-tasks.html#backgrounding-computations-futures
 *
 * @license MIT license <http://www.opensource.org/licenses/mit-license.php>
 */
extern mod extra;
extern mod fibonacci;
#[cfg(not(test))]
use std::vec;

fn partial_sum(start: uint) -> f64 {
	// println(fmt!("partial_sum(%u)", start));
	let mut local_sum = 0f64;
	for num in range(start*100000, (start+1)*100000) {
		local_sum += (num as f64 + 1.0).pow(&-2.0);
	}
	local_sum
}
#[test]
fn test_partial_sum_5() {
	let param = 5u;
	let expected = 0.00000033f64;
	let actual = partial_sum(param);
	assert_approx_eq!(expected, actual);
}
#[cfg(not(test))]
fn main() {
	let n = 40;
	println("Setting spawn");
	/*
	 * Note that the future needs to be mutable so that it can save the result for next time get is called.
	 */
{'fraction_non_alphanumeric': 0.15435222672064777, 'fraction_numerical': 0.04402834008097166, 'mean_word_length': 4.491666666666666, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '5444791', 'n_tokens_mistral': 773, 'n_tokens_neox': 703, 'n_words': 184}