Clicky

Fortran Wiki
nearest (Rev #2, changes)

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

Showing changes from revision #1 to #2: (追記) 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 (削除ここまで)(追記) Fortran 95 (追記ここまで)(追記) and later (追記ここまで)

Class

(削除) Elemental function (削除ここまで)(追記) Elemental function (追記ここまで)

Syntax

result = nearest(x, s)

Arguments

  • x - Shall be of type real.
  • s - (Optional) shall be of type real 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))") x, y, x - y
end program test_nearest

category: (削除) Intrinsics (削除ここまで)(追記) intrinsics (追記ここまで)

Revision from April 30, 2009 20:16:43 by Jason Blevins
Forward in time (to current) | Back in time (1 more) | See current | Hide changes | History | Rollback | View: Source | Linked from: Intrinsic procedures

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