# Spectral derivative in 2-d

**URL:** <https://fortran-lang.discourse.group/t/spectral-derivative-in-2-d/6978>\
**Category:** Help\
**Created:** [December 12, 2023, 5:39pm UTC](https://fortran-lang.discourse.group/t/spectral-derivative-in-2-d/6978 "2023-12-12T17:39:10Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![RonShepard](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@RonShepard](https://fortran-lang.discourse.group/u/RonShepard)\
**Post date:** [December 13, 2023, 3:05am UTC](https://fortran-lang.discourse.group/t/spectral-derivative-in-2-d/6978/7 "2023-12-13T03:05:28Z")

</div>

> [@alirezagh76](#):
>
> `ny = int(n/2.0) + 1`

That is an odd looking expression. It is equivalent to

```auto
ny = int( real(n) / 2.0 ) + 1

```

I’m not seeing why the conversion to real and then converting back to integer is necessary.

---

_[View the full topic](https://fortran-lang.discourse.group/t/spectral-derivative-in-2-d/6978)._
