Clicky

Fortran Wiki
nearest (changes)

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Showing changes from revision #2 to #3: (追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)

Description

nearest(x, s) returns the processor-representable number nearest to x in the direction indicated by the sign of s.

Standard

Fortran 95 and later

Class

Elemental function

Syntax

(削除)

result = nearest(x, s)

(削除ここまで)
(追記)
result = nearest(x, s)
(追記ここまで)

Arguments

  • x - Shall be of type real.
  • s -(削除) (Optional) (削除ここまで)(追記) Shall (追記ここまで)(削除) shall (削除ここまで) be of typereal and not equal to zero.

Return value

The return value is of the same type as x. If s is positive, nearest returns the processor-representable number greater than x and nearest to it. If s is negative, nearest returns the processor-representable number smaller than x and nearest to it.

Example

program test_nearest
 real :: x, y
 x = nearest(42.0, 1.0)
 y = nearest(42.0, -1.0)
 write (*,(削除) "(3(G20.15))" (削除ここまで)(追記) "(3(g20.15))" (追記ここまで)) x, y, x - y
end program test_nearest

category: intrinsics

Revised on April 4, 2016 15:03:08 by Jason Blevins (128.146.137.52) (1039 characters / 0.0 pages)
Edit | Back in time (2 revisions) | Hide changes | History | Views: Print | TeX | Source | Linked from: Intrinsic procedures

AltStyle によって変換されたページ (->オリジナル) /