# Output is zero after changing from ints to floats

**URL:** <https://discuss.pynq.io/t/output-is-zero-after-changing-from-ints-to-floats/343>\
**Category:** Support\
**Created:** [July 24, 2019, 10:16pm UTC](https://discuss.pynq.io/t/output-is-zero-after-changing-from-ints-to-floats/343 "2019-07-24T22:16:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjcarter95](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@mjcarter95](https://discuss.pynq.io/u/mjcarter95)\
**Post date:** [July 24, 2019, 10:16pm UTC](https://discuss.pynq.io/t/output-is-zero-after-changing-from-ints-to-floats/343/1 "2019-07-24T22:16:32Z")

</div>

Hi there,

I’m trying to get an (extremely basic) function to run on the PYNQ-Z2 board and I’m running into issues when moving from integers to floats. I am writing C++/HLS in Vivado HLS and using Vivado Design Suite to generate bitstreams.

The code is as follows

```auto
#define DATA_TYPE int

DATA_TYPE test(DATA_TYPE S, DATA_TYPE K, DATA_TYPE T, DATA_TYPE r, DATA_TYPE v) {
	return (S * K) + T + r + v;
}

void mult(DATA_TYPE *pCall, DATA_TYPE S, DATA_TYPE K, DATA_TYPE T, DATA_TYPE r, DATA_TYPE v) {

	*pCall = test(S, K, T, r, v);

}

```

And the HLS directives are  
 ![Untitled](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/1X/62e6efd978097c101f36e87cdf8513a34346085f.png)

I am using the MMIO module inside Jupyter to read/write to memory, when using the code above this works fine. However, when changing “DATA\_TYPE” from int to float, I receive an output of zero. Any ideas on why this would happen/steps to remedy would be much appreciated.

Cheers.

**EDIT** I’ve added bitstreams, tcl and hwh files along with the notebook to Google Drive, bitstreams etc. are zipped and labelled “integer” (correct output) and “float” (incorrect output).  
[https://drive.google.com/drive/folders/1-iyCcFJ8aFfSsacLm0aFKwG84c7laUuc?usp=sharing](https://drive.google.com/drive/folders/1-iyCcFJ8aFfSsacLm0aFKwG84c7laUuc?usp=sharing)

---

<div class="post-metadata">

**Author:** ![mjcarter95](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@mjcarter95](https://discuss.pynq.io/u/mjcarter95)\
**Post date:** [July 24, 2019, 10:17pm UTC](https://discuss.pynq.io/t/output-is-zero-after-changing-from-ints-to-floats/343/2 "2019-07-24T22:17:03Z")

</div>

Block design - couldn’t attach to main post.

 ![Untitled](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/1X/66507d73049458e8ac037e5e74217e87c20eeb0f.png)

---

<div class="post-metadata">

**Author:** ![NS\_Huang](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/ns_huang/32/151_2.png) [@NS\_Huang](https://discuss.pynq.io/u/NS_Huang)\
**Post date:** [July 25, 2019, 1:24pm UTC](https://discuss.pynq.io/t/output-is-zero-after-changing-from-ints-to-floats/343/3 "2019-07-25T13:24:15Z")

</div>

@mjcarter95

Do you know float type employs the IEEE 754 format ? It implies you should do some transform for the data you read back from HW in the PYNQ to the world of python to treat the data you read as float. Thanks

---

<div class="post-metadata">

**Author:** ![mjcarter95](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@mjcarter95](https://discuss.pynq.io/u/mjcarter95)\
**Post date:** [July 25, 2019, 4:10pm UTC](https://discuss.pynq.io/t/output-is-zero-after-changing-from-ints-to-floats/343/4 "2019-07-25T16:10:26Z")

</div>

@NS_Huang

Thanks for your reply - it was indeed the mixing of integers/floats that was causing the issue. Everything works okay assuming I am only transferring floats to and from the PL.

Cheers

---

<div class="post-metadata">

**Author:** ![jmlaniel](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/jmlaniel/32/3492_2.png) [@jmlaniel](https://discuss.pynq.io/u/jmlaniel)\
**Post date:** [September 5, 2022, 2:09am UTC](https://discuss.pynq.io/t/output-is-zero-after-changing-from-ints-to-floats/343/5 "2022-09-05T02:09:45Z")

</div>

I am trying to do the same thing but I can’t figure how to do conversion in Python. Could you ellaborate on the solution you implemented?
