Domanda

Is there a more elegant way of expressing positive and negative infinities in haskell other than let posInf = 1 / 0 and let negInf = -1 / 0 respectively?

È stato utile?

Soluzione

For Double and Float: no, not really. For other types: yes! Those types that do not yet have an infinity may be given one via PosInf and NegInf type constructors. Some types may also have their own special infinity, but to say more than that we'd need to know what type specifically you want to use.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top