round Function

function round(x, size)

************80

! ROUND is called to add some noise to data.

Discussion:

This function simply adds plus or minus a perturbation value
to the input data.

Modified:

14 February 2007

Author:

Carl DeBoor

Reference:

Carl DeBoor,
A Practical Guide to Splines,
Springer, 2001,
ISBN: 0387953663,
LC: QA1.A647.v27.

Parameters:

Input. real ( kind = 8 ) X, the value to be perturbed.

Input, real ( kind = 8 ) SIZE, the size of the perturbation.

Output, real ( kind = 8 ) ROUND, the perturbed value.

Arguments

Type IntentOptional Attributes Name
real(kind=8) :: x
real(kind=8) :: size

Return Value real(kind=8)


Source Code

function round ( x, size )

  !*****************************************************************************80
  !
  !! ROUND is called to add some noise to data.
  !
  !  Discussion:
  !
  !    This function simply adds plus or minus a perturbation value
  !    to the input data.
  !
  !  Modified:
  !
  !    14 February 2007
  !
  !  Author:
  !
  !    Carl DeBoor
  !
  !  Reference:
  !
  !    Carl DeBoor,
  !    A Practical Guide to Splines,
  !    Springer, 2001,
  !    ISBN: 0387953663,
  !    LC: QA1.A647.v27.
  !
  !  Parameters:
  !
  !    Input. real ( kind = 8 ) X, the value to be perturbed.
  !
  !    Input, real ( kind = 8 ) SIZE, the size of the perturbation.
  !
  !    Output, real ( kind = 8 ) ROUND, the perturbed value.
  !
  implicit none

  real ( kind = 8 ), save :: flip = -1.0D+00
  real ( kind = 8 ) round
  real ( kind = 8 ) size
  real ( kind = 8 ) x

  flip = -flip
  round = x + flip * size

  return
end function round