gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
dc_units::operator(/) Interface Reference

Public Member Functions

type(units) function dcunitsdiv (u1, u2)

Detailed Description

Definition at line 103 of file dc_units.f90.

Member Function/Subroutine Documentation

◆ dcunitsdiv()

type(units) function dc_units::operator(/)::dcunitsdiv ( type(units), intent(in) u1,
type(units), intent(in) u2 )

Divide two UNITS

Parameters
[in]u1Dividend UNITS variable
[in]u2Divisor UNITS variable
Returns
Quotient of two UNITS

Definition at line 212 of file dc_units.f90.

213 type(UNITS), intent(in):: u1, u2
214 integer:: n, n1
215 character(TOKEN), allocatable:: name(:)
216 real(DP), allocatable:: power(:)
217 if (abs(u2%factor) < tiny(u2%factor)) then
218 result%factor = sign(u1%factor, 1.0_dp) * &
219 & sign(u2%factor, 1.0_dp) * &
220 & huge(1.0_dp)
221 else
222 result%factor = u1%factor / u2%factor
223 endif
224 result%nelems = u1%nelems + u2%nelems
225 result%offset = ""
226 n = result%nelems
227 if (n == 0) then
228 nullify(result%name, result%power)
229 return
230 endif
231 allocate(name(n), power(n))
232 n1 = u1%nelems
233 if (n1 >= 1) then
234 name(1:n1) = u1%name(1:n1)
235 power(1:n1) = u1%power(1:n1)
236 endif
237 n1 = n1 + 1
238 if (n >= n1) then
239 name(n1:n) = u2%name(1:u2%nelems)
240 power(n1:n) = -u2%power(1:u2%nelems)
241 endif
242 call units_simplify(result, name, power)
243 deallocate(name, power)

The documentation for this interface was generated from the following file: