# CAS Best Practices

**URL:** https://discourse.julialang.org/t/cas-best-practices/58092
**Category:** Machine Learning
**Tags:** symbolic
**Created:** [March 27, 2021, 8:51pm UTC](https://discourse.julialang.org/t/cas-best-practices/58092 "2021-03-27T20:51:11Z")
**Posts on this page:** 1
**Showing post:** 61

<div class="post-metadata">

### Author: ![carette](https://avatars.discourse-cdn.com/v4/letter/c/51bf81/32.png) [@carette](https://discourse.julialang.org/u/carette)
#### Post date: [April 4, 2021, 3:14am UTC](https://discourse.julialang.org/t/cas-best-practices/58092/61 "2021-04-04T03:14:23Z")

</div>

I was warning that x-x is tricky. It’s actually fairly safe to transform it to 0\*x. For one, that’s type-safe, in the sense that x is still around, so you know the result’s type properly. (Polymorphic 0 is a major pain.)

If your numeric types include infinities, then this is required. If your numeric types only contain finite values, and will never contain anything other than classical numbers (vectors, matrices and series all have non-trivial claims to be kinds of numbers too) like the reals, complex, etc, that might be safe. But it depends very strongly on your meaning of ‘number’.

---

_[View the full topic](https://discourse.julialang.org/t/cas-best-practices/58092)._
