[UP]


Manual Reference Pages  - sign (3)

NAME

sign(3f) - [FORTRAN:INTRINSIC:NUMERIC] Sign copying function

CONTENTS

Syntax
Description
Arguments
Return Value
Example
Standard
Class

SYNTAX

result = sign(a, b)

DESCRIPTION

sign(a,b) returns the value of A with the sign of B.

ARGUMENTS

A - Shall be of type INTEGER or REAL
B - Shall be of the same type and kind as A

RETURN VALUE

The kind of the return value is that of A and B. If B >= 0 then the result is abs(a), else it is -abs(a).

EXAMPLE

Sample program:

    program demo_sign
      print *, sign(-12,1)
      print *, sign(-12,0)
      print *, sign(-12,-1)

print *, sign(-12.,1.) print *, sign(-12.,0.) print *, sign(-12.,-1.) end program demo_sign

STANDARD

[[FORTRAN 77]] and later

CLASS

[[Elemental procedure|Elemental function]]


sign (3) March 19, 2019
Generated by manServer 1.08 from 5bd2281b-78e8-44b8-88a1-cfd990dbf6d9 using man macros.