# How apply Subtraction operator to extrema() function

**URL:** <https://discourse.julialang.org/t/how-apply-subtraction-operator-to-extrema-function/65255>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 25, 2021, 8:06am UTC](https://discourse.julialang.org/t/how-apply-subtraction-operator-to-extrema-function/65255 "2021-07-25T08:06:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HerAdri](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heradri/32/5816_2.png) [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Post date:** [July 25, 2021, 8:06am UTC](https://discourse.julialang.org/t/how-apply-subtraction-operator-to-extrema-function/65255/1 "2021-07-25T08:06:49Z")

</div>

How apply Subtraction operator to extrema() function

```julia
julia> extrema(2:10)
(2, 10)
julia> -(2,10)
-8

julia> -extrema(2:10)
ERROR: MethodError: no method matching -(::Tuple{Int64, Int64})
Closest candidates are:
  -(::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) at int.jl:85
  -(::T, ::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} at int.jl:86
  -(::Union{UInt16, UInt32, UInt8}, ::BigInt) at gmp.jl:531
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[106]:1

julia> y=extrema(2:10)
(2, 10)
julia> -(y)
ERROR: MethodError: no method matching -(::Tuple{Int64, Int64})
Closest candidates are:
  -(::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) at int.jl:85
  -(::T, ::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} at int.jl:86
  -(::Union{UInt16, UInt32, UInt8}, ::BigInt) at gmp.jl:531
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[105]:1

julia> extrema(2:8)
(2, 8)
julia> -(ans)
ERROR: MethodError: no method matching -(::Tuple{Int64, Int64})
Closest candidates are:
  -(::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) at int.jl:85
  -(::T, ::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} at int.jl:86
  -(::Union{UInt16, UInt32, UInt8}, ::BigInt) at gmp.jl:531
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[132]:1

```

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [July 25, 2021, 8:29am UTC](https://discourse.julialang.org/t/how-apply-subtraction-operator-to-extrema-function/65255/2 "2021-07-25T08:29:22Z")

</div>

```julia
julia> -(extrema(2:10)...)
-8

```
