# EVAL SQUARE ROOT FUNCTION failed

**URL:** <https://openfhe.discourse.group/t/eval-square-root-function-failed/439>\
**Category:** Library Questions\
**Created:** [March 28, 2023, 11:02am UTC](https://openfhe.discourse.group/t/eval-square-root-function-failed/439 "2023-03-28T11:02:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yhh](https://avatars.discourse-cdn.com/v4/letter/y/c57346/32.png) [@yhh](https://openfhe.discourse.group/u/yhh)\
**Post date:** [March 28, 2023, 11:02am UTC](https://openfhe.discourse.group/t/eval-square-root-function-failed/439/1 "2023-03-28T11:02:56Z")

</div>

Hi,  
I directly git clone the main branch of the project, and then I run the function-evaluation example, and failed at the second example. The output is

```auto
--------------------------------- EVAL SQUARE ROOT FUNCTION ---------------------------------
terminate called after throwing an instance of 'lbcrypto::math_error'
  what(): /tmp/tmp.c4KaOgOCJe/src/pke/lib/encoding/ckkspackedencoding.cpp:522 The decryption failed because the approximation error is too high. Check the parameters. 

```

I know there may be something wrong with the params, but I dont’ know what to change.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![narger](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/narger/32/420_2.png) [@narger](https://openfhe.discourse.group/u/narger)\
**Post date:** [March 28, 2023, 2:50pm UTC](https://openfhe.discourse.group/t/eval-square-root-function-failed/439/2 "2023-03-28T14:50:39Z")

</div>

Did you change anything in the function-evaluation example? I can run it without issues

---

<div class="post-metadata">

**Author:** ![yhh](https://avatars.discourse-cdn.com/v4/letter/y/c57346/32.png) [@yhh](https://openfhe.discourse.group/u/yhh)\
**Post date:** [March 29, 2023, 2:22am UTC](https://openfhe.discourse.group/t/eval-square-root-function-failed/439/3 "2023-03-29T02:22:54Z")

</div>

I didn’t change anything. 😭

---

<div class="post-metadata">

**Author:** ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)\
**Post date:** [March 29, 2023, 2:15pm UTC](https://openfhe.discourse.group/t/eval-square-root-function-failed/439/4 "2023-03-29T14:15:13Z")

</div>

Are you running in 128 bit or 64 bit? What’re your settings e.g. did you change the math backend, etc. This would help us recreate the issue. Thanks!

---

<div class="post-metadata">

**Author:** ![yhh](https://avatars.discourse-cdn.com/v4/letter/y/c57346/32.png) [@yhh](https://openfhe.discourse.group/u/yhh)\
**Post date:** [March 30, 2023, 2:29am UTC](https://openfhe.discourse.group/t/eval-square-root-function-failed/439/5 "2023-03-30T02:29:07Z")

</div>

64-bit. I didn’t set any CMake options, so I think I didn’t change the MathBackend.  
I download the main branch code zip from github, open it with CLion IDE, load the CMakelists, run the target function-evaluation and I get the errror.  
I use a server with Ubuntu20.04, CMake version 3.21.7, GDB version 9.2.

Or should I report on github, where i could upload the whole project?

Thanks for your time!

---

<div class="post-metadata">

**Author:** ![saroja](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@saroja](https://openfhe.discourse.group/u/saroja)\
**Post date:** [March 30, 2023, 2:57pm UTC](https://openfhe.discourse.group/t/eval-square-root-function-failed/439/6 "2023-03-30T14:57:33Z")

</div>

This is a bug that will be fixed in the next version release (v1.0.4). This is how you can fix the example if you need it now: [fixed the input ranges for function-evaluation.cpp by yspolyakov · Pull Request #335 · openfheorg/openfhe-development · GitHub](https://github.com/openfheorg/openfhe-development/pull/335).
