[PATCH] fortran/69121 -- Make IEEE_SCALB generic

Steve Kargl sgk@troutmask.apl.washington.edu
Fri Dec 21 01:00:00 GMT 2018


The attached patch has been tested on x86_64-*-freebsd.

It provides the missing pieces for IEEE_SCALB to allow
it to be generic function.  Briefly, when FX contributed
IEEE_SCALB, he implemented a casting of the integer
argument to the default integer kind.  For integer(1)
and integer(2), this is a simple cast.  For integer(8)
and integer(16), he first checks to see if the value 
is in the range of default integer kind.  So, one
essentially has

ieee_scalb(x, 2_1) --> ieee_scalb(x, int(2_1, 4)) 
ieee_scalb(x, 2_8) --> ieee_scalb(x, int(max(min(2_8,huge(0)),-huge(0)), 4)

Unfortnately, the interface exposed by the IEEE_ARITHMETIC
module did not allow for non-default integer kind arguments.
The patch corrects that omission.

OK to commit?

2018-12-20  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/69121
	* libgfortran/ieee/ieee_arithmetic.F90: Provide missing functions
	in interface for IEEE_SCALB.

2018-12-20  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/69121
	* gfortran.dg/ieee/ieee_9.f90: New test.
-- 
Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ieee.diff
Type: text/x-diff
Size: 7957 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20181221/0c222289/attachment.bin>


More information about the Fortran mailing list