IndexRundeck: E6F40Created: Fri Jul 5 03:30:24 EDT 2024

RATIONAL_MOD

File: Rational.F90
Summary: !--------------------------------------------------------------------------- This module provides a class which implements rational numbers/arithmetic of the form q = w + n/d where {w,n,d} are integers. This representation, motivated by the treatment in ESMF, provides a large range as well as sufficient accuracy to represent most floating point values. Times in the model are subclasses of Rational {BaseTime, Time, TimeInterval}. This ensures that certain ratios are exact integers and prevents roundoff from inducing incorrect assertions about beginnings of cyclic periods (e.g. days). NOTE: arithmetic among nontrivial Rational objects can easily lead to integer overflow which is not detectable by most compilers.
Author : T. Clune ---------------------------------------------------------------------------
Version:

Subroutines:
add_fraction

ceiling

ceilingrational

divide_byint4

divide_byint8

divide_fraction

divide_intoint4

divide_intoint8

divide_realdp

equals_fraction

equals_intleft

equals_intright

floor

floorrational

greaterthan_fraction

greaterthanorequalto_fraction

greatestcommonfactor

lessthan_fraction

modulo

modulorational

multiply_fraction

multiply_intleft

multiply_intright

multiply_longleft

multiply_longright

newrational_default

newrational_default_n_over_d

newrational_defaultwhole

newrational_long

newrational_long_n_over_d

newrational_longwhole

newrational_real_dp

newrational_real_sp

newrational_string

nint

nintrational

rational

real

real_rational

reduce

subtract_fraction

toreal

tostring


Global Variables:
sp : used from kindparameters_mod

dp : used from kindparameters_mod

default_int : used from kindparameters_mod

long_int : used from kindparameters_mod

long : integer, parameter
Initial Value = max(DEFAULT_INT, LONG_INT)

Simplex Website Curator: Igor Aleinov — NASA Official: Gavin A. Schmidt

Contact GISS NASA Privacy PolicyAccessibility