# Siemens ET200SP Long Real

**URL:** <https://forum.inductiveautomation.com/t/siemens-et200sp-long-real/25156>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [May 20, 2019, 3:23pm UTC](https://forum.inductiveautomation.com/t/siemens-et200sp-long-real/25156 "2019-05-20T15:23:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luca.mori](https://avatars.discourse-cdn.com/v4/letter/l/5daacb/32.png) [@luca.mori](https://forum.inductiveautomation.com/u/luca.mori)\
**Post date:** [May 20, 2019, 3:23pm UTC](https://forum.inductiveautomation.com/t/siemens-et200sp-long-real/25156/1 "2019-05-20T15:23:31Z")

</div>

Hi everyone,

I’m working with a Siemens ET200SP and I’m using the Siemens S7-1500 Ignitions Driver.

While everything else is working fine, I’m experiencing some trouble reading and writing LREAL Tags.

In Ignition the tags are declared as Float8.

If i write the value 0.0 from Ignition, i can see 0.0 in the PLC via TIA PORTAL and the same i can see in Ignition.

Writing the value 1000 from Ignition will produce a number wich is around 7.6e+21 in tia portal, but, i can see the correct value in Ignition.

I would like to understand if the problem is linked to the Siemens Driver, if I’m doing something wrong, if i choose the wrong driver for the PLC.

I tried to write on a REAL using in Ignition the Float4, and everything is working correctly.

Thanks

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 20, 2019, 3:27pm UTC](https://forum.inductiveautomation.com/t/siemens-et200sp-long-real/25156/2 "2019-05-20T15:27:25Z")

</div>

The driver doesn’t support LREAL types ☹

---

<div class="post-metadata">

**Author:** ![luca.mori](https://avatars.discourse-cdn.com/v4/letter/l/5daacb/32.png) [@luca.mori](https://forum.inductiveautomation.com/u/luca.mori)\
**Post date:** [May 20, 2019, 3:41pm UTC](https://forum.inductiveautomation.com/t/siemens-et200sp-long-real/25156/3 "2019-05-20T15:41:23Z")

</div>

Ok Thanks for the support Kevin,  
have a nice day.

---

<div class="post-metadata">

**Author:** ![cristihcd](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@cristihcd](https://forum.inductiveautomation.com/u/cristihcd)\
**Post date:** [April 11, 2023, 10:02am UTC](https://forum.inductiveautomation.com/t/siemens-et200sp-long-real/25156/4 "2023-04-11T10:02:42Z")

</div>

Hello,

For reading LREAL datatype from Siemens, you can read the individual words into 4 integer tags and use the script below to calculate the double value:

```auto
def words_to_double(word1, word2, word3, word4):
	# Combine the 4 16-bit words into a single 64-bit integer (big endian format)
	combined = (long(word1) << 48) | (long(word2) << 32) | (long(word3) << 16) | long(word4)

	# Extract sign, exponent, and mantissa from the 64-bit integer
	sign = (combined >> 63) & 1
	exponent = (combined >> 52) & 0x7FF
	mantissa = combined & ((1 << 52) - 1)

	# Handle special cases (zero, infinity, NaN)
	if exponent == 0:
		if mantissa == 0:
			return 0.0 if sign == 0 else -0.0
		else:
			# Denormalized number
			significand = float(mantissa) / float(1 << 52)
			return ((-1) **sign) * significand * (2** (1 - 1023))

	elif exponent == 0x7FF:
		if mantissa == 0:
			return float('inf') if sign == 0 else float('-inf')
		else:
			return float('nan')

	# Calculate the double-precision floating-point number
	significand = 1 + float(mantissa) / float(1 << 52)
	double_val = ((-1) **sign) * significand * (2** (exponent - 1023))

	return double_val

```

You can then write this into a memory tag (double)
