<commit_before>unit module Finance::CompoundInterest;

sub compound_interest ( Rat() $present_value, Rat() $interest_rate, Rat() $frequency, Rat() $time )  is export {
	$present_value * ( 1 + $interest_rate / $frequency ) ** ( $frequency * $time ); # returns future value
}

sub compound_interest_with_payments ( Rat() $payment_value, Rat $interest_rate, Rat() $total_periods ) is export {
	( ( 1 + $interest_rate ) ** $total_periods - 1 ) / $interest_rate  * $payment_value; # returns future value
}

sub ciwp_payment_period ( Rat() $final_value, Rat() $interest_rate, Rat() $payment_value ) is export {
	log($final_value * $interest_rate / $payment_value + 1 ) / log( 1 + $interest_rate )
}

sub ciwp_payment_size ( Rat() $final_value, Rat() $interest_rate, Rat() $total_periods ) is export {
	( $final_value * $interest_rate ) / ((1 + $interest_rate ) ** $total_periods - 1) # Returns mounthly payment size to reach the estimated final payment.
}<commit_msg>Fixed a type<commit_after>unit module Finance::CompoundInterest;

sub compound_interest ( Rat() $present_value, Rat() $interest_rate, Rat() $frequency, Rat() $time )  is export {
	$present_value * ( 1 + $interest_rate / $frequency ) ** ( $frequency * $time ); # returns future value
}

sub compound_interest_with_payments ( Rat() $payment_value, Rat $interest_rate, Rat() $total_periods ) is export {
	( ( 1 + $interest_rate ) ** $total_periods - 1 ) / $interest_rate  * $payment_value; # returns future value
}

sub ciwp_payment_period ( Rat() $final_value, Rat() $interest_rate, Rat() $payment_value ) is export {
	log($final_value * $interest_rate / $payment_value + 1 ) / log( 1 + $interest_rate )
}

sub ciwp_payment_size ( Rat() $final_value, Rat() $interest_rate, Rat() $total_periods ) is export {
	( $final_value * $interest_rate ) / ((1 + $interest_rate ) ** $total_periods - 1) # Returns monthly payment size to reach the estimated final payment.
}
{'fraction_non_alphanumeric': 0.1375, 'fraction_numerical': 0.007291666666666667, 'mean_word_length': 5.137380191693291, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5085407', 'n_tokens_mistral': 626, 'n_tokens_neox': 610, 'n_words': 174}