jar1
1
`typemin(T)`

says

The lowest value representable by the given (real) numeric DataType T.

Suppose we want to be more generic than a “(real) numeric” datatype. What should it say then?

How about

The minimum value representable by the given `DataType`

having a unique minimum value.

one might think from the docstring that

```
typemin(::T)
```

returns value `v`

such that

```
min(v, w) == v
```

for all `w`

where `typeof(w) <: T`

however unfortunately this isn’t always true…

Could we use `isless`

? Is this accurate?

The lowest value representable by the DataType `T`

as ordered by `[`isless`](@ref)`

; this value `isless`

than all other values of type `T`

.

1 Like

it would have to be `isless || isequal`

What’s an example of a datatype with multiple equal `typemin`

values?

Conversely, defining `typemax`

as

The highest value representable by the DataType `T`

as ordered by `[`

isless`](@ref)`

; this value `isless`

than no other values of type `T`

.

seems obvious but breaks in the presence of NaN.

```
julia> isless(typemax(Float64), NaN)
true
```

1 Like

good point, nvm

was trying to construct something with subnormals but they don’t work like I thought

but still, it’s not true for `DateTime`

as noticed by @Sukera `typemin`/`typemax` of `DateTime` is not actually the smallest/largest representable `DateTime` · Issue #50931 · JuliaLang/julia · GitHub

1 Like

I believe the proper predicate is typemax(T) means that !exists x such that `isless(typemax(T), x)`

1 Like

jar1
9
```
julia> isless(typemax(Float64), NaN)
true
```

Can we say “… in the well ordered subset of values of `T`

” or something like that?

Yes (I think that’s equivalent to what I wrote above, but it’s late). `x = NaN`

exists anyways.