C Library Functions  - scale (3)

NAME

SCALE(3) - [MODEL_COMPONENTS] Scale a real value by a whole power of the radix

SYNOPSIS

result = scale(x, i)

         elemental real(kind=KIND) function scale(x, i)

real(kind=KIND),intent(in) :: x integer(kind=**),intent(in) :: i

CHARACTERISTICS

o X is type real of any kind
o I is type an integer of any kind
o the result is real of the same kind as X

DESCRIPTION

SCALE(3) returns x * RADIX(X)**I.

It is almost certain the radix(base) of the platform is two, therefore SCALE(3) is generally the same as X*2**I

OPTIONS

o X : the value to multiply by RADIX(X)**I. Its type and kind is used to determine the radix for values with its characteristics and determines the characteristics of the result, so care must be taken the returned value is within the range of the characteristics of X.
o I : The power to raise the radix of the machine to

RESULT

The return value is X * RADIX(X)**I, assuming that value can be represented by a value of the type and kind of X.

EXAMPLES

Sample program:

    program demo_scale
    implicit none
    real :: x = 178.1387e-4
    integer :: i = 5
       print *, scale(x,i), x*radix(x)**i
    end program demo_scale

Results:

        0.570043862      0.570043862

STANDARD

Fortran 95

SEE ALSO

DIGITS(3), EPSILON(3), EXPONENT(3), FRACTION(3), HUGE(3), MAXEXPONENT(3), MINEXPONENT(3), NEAREST(3), PRECISION(3), RADIX(3), RANGE(3), RRSPACING(3), SET_EXPONENT(3), SPACING(3), TINY(3)

fortran-lang intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 scale (3) July 22, 2023
Generated by manServer 1.08 from 228ea8b2-6982-44b3-ae84-f44512282a59 using man macros.