Loading [MathJax]/extensions/tex2jax.js
MRFFL: MR Fortran Finance Library 2024-12-28
Computational Tools For Finance
All Namespaces Files Functions Variables
mrffl_percentages Module Reference

Simple functions for working with percentages. More...

Functions/Subroutines

elemental real(kind=rk) function, public percentage_to_fraction (p)
 Convert a percentage to a fraction.
 
elemental real(kind=rk) function, public fraction_to_percentage (f)
 Convert a fraction to a percentage.
 
elemental real(kind=rk) function, public percentage_of (v, p)
 Compute the percentage of a value.
 
elemental real(kind=rk) function, public add_percentage (v, p)
 Add a percentage of a value to that value.
 
elemental real(kind=rk) function, public percentage_change (v_from, v_to)
 Compute the percentage change.
 
elemental real(kind=rk) function, public percentage_of_total (v_total, v_part)
 Compute the percentage of a total.
 

Detailed Description

Simple functions for working with percentages.

Function/Subroutine Documentation

◆ percentage_to_fraction()

elemental real(kind=rk) function, public mrffl_percentages::percentage_to_fraction ( real(kind=rk), intent(in) p)

◆ fraction_to_percentage()

elemental real(kind=rk) function, public mrffl_percentages::fraction_to_percentage ( real(kind=rk), intent(in) f)

Convert a fraction to a percentage.

Definition at line 62 of file mrffl_percentages.f90.

References fraction_to_percentage().

Referenced by fraction_to_percentage(), percentage_change(), and percentage_of_total().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ percentage_of()

elemental real(kind=rk) function, public mrffl_percentages::percentage_of ( real(kind=rk), intent(in) v,
real(kind=rk), intent(in) p )

Compute the percentage of a value.

Definition at line 70 of file mrffl_percentages.f90.

References percentage_of(), and percentage_to_fraction().

Referenced by mrffl_us_inflation::inf_aggregate(), percentage_of(), and mrffl_us_taxes::tax().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_percentage()

elemental real(kind=rk) function, public mrffl_percentages::add_percentage ( real(kind=rk), intent(in) v,
real(kind=rk), intent(in) p )

Add a percentage of a value to that value.

Definition at line 79 of file mrffl_percentages.f90.

References add_percentage(), and percentage_to_fraction().

Referenced by add_percentage(), and mrffl_us_inflation::inf_adj().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ percentage_change()

elemental real(kind=rk) function, public mrffl_percentages::percentage_change ( real(kind=rk), intent(in) v_from,
real(kind=rk), intent(in) v_to )

Compute the percentage change.

WARNING: We do not check to make sure that (v_to-v_from) is non-zero

Definition at line 89 of file mrffl_percentages.f90.

References fraction_to_percentage(), and percentage_change().

Referenced by mrffl_us_inflation::inf_aggregate(), and percentage_change().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ percentage_of_total()

elemental real(kind=rk) function, public mrffl_percentages::percentage_of_total ( real(kind=rk), intent(in) v_total,
real(kind=rk), intent(in) v_part )

Compute the percentage of a total.

WARNING: We do not check to make sure that (v_total) is non-zero

Definition at line 99 of file mrffl_percentages.f90.

References fraction_to_percentage(), percentage_of_total(), and mrffl_config::zero_epsilon.

Referenced by mrffl_us_taxes::effective_tax_rate(), and percentage_of_total().

Here is the call graph for this function:
Here is the caller graph for this function: