# Infinity when division by zero - Shouldnt it still be "udefined"

**URL:** <https://cl.desmos.com/t/infinity-when-division-by-zero-shouldnt-it-still-be-udefined/5242>\
**Category:** Questions\
**Tags:** simplefunction\
**Created:** [November 23, 2023, 4:22pm UTC](https://cl.desmos.com/t/infinity-when-division-by-zero-shouldnt-it-still-be-udefined/5242 "2023-11-23T16:22:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbrigida](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/rbrigida/32/1449_2.png) [@rbrigida](https://cl.desmos.com/u/rbrigida)\
**Post date:** [November 23, 2023, 4:22pm UTC](https://cl.desmos.com/t/infinity-when-division-by-zero-shouldnt-it-still-be-udefined/5242/1 "2023-11-23T16:22:39Z")

</div>

This was brought up before, but I just wanted to show it in a real simple example. How is this possibly considered “defined” ? It really messes up some of my cL error checking code.

> **[Infinity vs undefined • Activity by Robert Brigida](https://classroom.amplify.com/activity/655f76cb3e23862071c9332d)**
>
> by Robert Brigida

f=simpleFunction(`\frac{x}{x-3}`)  
x=3  
fx1=f.evaluateAt(x)  
message=when isUndefined(fx1) “Not Defined”  
otherwise “Is Defined”

The message comes out to “Is Defined”. I always assumed division by zero was “undefined”  
What is the simplest work around? The function will not always be a rational function in my project, so parsing the function would be a silly amount of extra work.

If it is giving the answer as infinity, I should be able to add this condtional:  
when fx1\>999999999999999999999999 “Divison by 0”.  
(just kidding).

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [November 23, 2023, 7:33pm UTC](https://cl.desmos.com/t/infinity-when-division-by-zero-shouldnt-it-still-be-udefined/5242/2 "2023-11-23T19:33:18Z")

</div>

You can adapt your function like this [graph](https://www.desmos.com/calculator/hwpxaagtww). If you need to have it more generalized in your CL:

```auto
funcLatex=`\frac{x}{x-3}`
f=simpleFunction(`\left\{\left|${funcLatex}\right|<\infty:${funcLatex}\right\}`)

```

---

<div class="post-metadata">

**Author:** ![rbrigida](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/rbrigida/32/1449_2.png) [@rbrigida](https://cl.desmos.com/u/rbrigida)\
**Post date:** [November 28, 2023, 6:12pm UTC](https://cl.desmos.com/t/infinity-when-division-by-zero-shouldnt-it-still-be-udefined/5242/3 "2023-11-28T18:12:18Z")

</div>

My work around was to put the function value into the table, and then if the tableCell value was “Infinity” , then the error message would be given.

 ![Screenshot 2023-11-28 130748](https://canada1.discourse-cdn.com/flex031/uploads/desmos/original/2X/0/093ad85e08409145330aaa9be2a9893880e49716.png)

The slide is a “template” for finding derivatives. Pretty much any function can be put into the table, and then then derivative is checked at two inputs. I wanted to add code that would give me a heads up if there is a domain issue with the “test” values.

> **[New Derivative Template • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/655f7297d8a860e90f241df2)**
>
> by Robert Brigida

---

<div class="post-metadata">

**Author:** ![Mike\_Gleeson](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/mike_gleeson/32/650_2.png) [@Mike\_Gleeson](https://cl.desmos.com/u/Mike_Gleeson)\
**Post date:** [November 29, 2023, 2:08am UTC](https://cl.desmos.com/t/infinity-when-division-by-zero-shouldnt-it-still-be-udefined/5242/4 "2023-11-29T02:08:23Z")

</div>

Agree it’s pretty… well let’s stay “silly” instead of other word I was thinking of.

The simplest solution to this is to use numericValue for checking. Like this:

`fx1=numericValue("${f.evaluateAt(x)}")`

The documentation itself is incorrect in this regard. It [says](https://teacher.desmos.com/computation-layer/documentation#function:isDefined) that:

“isDefined takes _any_ type and returns a boolean for if it’s defined. For example, use with the numericValue of an expression”

I believe it _only_ truly works in these cases using numericValue and no other kind of check.

Here’s a rejig of your sample code to show it now works: [[Copy of] Infinity vs undefined • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/65669a04c37272b13f5144d2/edit#step=0e4476ea-a390-4feb-9b17-7649c6421cf3)

---

<div class="post-metadata">

**Author:** ![rbrigida](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/rbrigida/32/1449_2.png) [@rbrigida](https://cl.desmos.com/u/rbrigida)\
**Post date:** [November 29, 2023, 2:37pm UTC](https://cl.desmos.com/t/infinity-when-division-by-zero-shouldnt-it-still-be-udefined/5242/5 "2023-11-29T14:37:16Z")

</div>

Thanks. That’s pretty good. Similar idea to what I did with the table, but skipping the putting the value in the table step.
