(), correctly rounded to an integer, when the
result is about to . ok is false if
(no exact power of ten).
Since doubles of that size are integers (their spacing is 2 or more), the
rounded product or quotient is an integer, and only its exact rounding error
has to be added (rounded).
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Source Code
pure subroutine scaled(a,k,im,ok)real(dp),intent(in)::ainteger,intent(in)::kinteger(int64),intent(out)::imlogical,intent(out)::okreal(dp)::p,q,hi,lo,rim=0ok=abs(k)<=22if(.not.ok)return if(k>=0)then! a*p = hi + lo exactly:p=p10(k)call two_prod(a,p,hi,lo)im=int(hi,int64)+nint(lo,int64)else! a/p = q + r/p, with the remainder r = a - q*p computed exactly:p=p10(-k)q=a/pcall two_prod(q,p,hi,lo)r=(a-hi)-loim=int(q,int64)+nint(r/p,int64)end if end subroutine scaled