# Double kind coefficients as double kind rationals

**URL:** <https://fortran-lang.discourse.group/t/double-kind-coefficients-as-double-kind-rationals/3906>\
**Category:** Help\
**Created:** [July 3, 2022, 1:29am UTC](https://fortran-lang.discourse.group/t/double-kind-coefficients-as-double-kind-rationals/3906 "2022-07-03T01:29:44Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![alozada](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/alozada/32/298_2.png) [@alozada](https://fortran-lang.discourse.group/u/alozada)\
**Post date:** [July 3, 2022, 2:52am UTC](https://fortran-lang.discourse.group/t/double-kind-coefficients-as-double-kind-rationals/3906/3 "2022-07-03T02:52:07Z")

</div>

> [@dsejas](#):
>
> I am wondering if there is a “best-practice” way to do this, specially from the numerical point of view. If there is any other advice you could give me on this type of code, it is much appreciated.

Maybe,  
for coefficients (fixed), you could use an array with the attribute `parameter`  
example:  
` real(dk), parameter :: coeff(*) = [0.1_dk, 0.2_dk, 0.3_dk]`  
or  
` real(dk), parameter :: coeff(3) = (/0.1_dk, 0.2_dk, 0.3_dk/)`

`a(1) = coeff(1) + coeff(2) * x + coeff(3) * x**2`

you can also consult the post: [Fortran Best Practice Minibook - #2 by Beliavsky](https://fortran-lang.discourse.group/t/fortran-best-practice-minibook/1790/2)

---

_[View the full topic](https://fortran-lang.discourse.group/t/double-kind-coefficients-as-double-kind-rationals/3906)._
