Is there an everyday practical application of is_infinite() in PHP?
I was having a look at all of PHP's math functions and noticed there's an is_infinite() function that returns wether or not the s开发者_高级运维upplied number is infinite. I'm curious wether there happens to be some widely used application for this in everyday web development outside of the scientifical field.
I'm sorry if this is too much of a hypothetical question but I reckon it could be interesting to know if there was.
in this case 'infinite' means "too big to fit into an float". So if you are doing any sort of calculations and you are storing them in floats, you might want to check if they are getting too large.
In web development you might need it if you are counting something (scores for a game) and you want to be sure it doesn't overflow.
Or maybe you have a userinput they can use to calculate certain things, and you want to be able to see "answer too large" instead of just giving a strange result.
精彩评论