略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: UnderflowException

2024-11-13

The UnderflowException class

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

简介

Exception thrown when performing an invalid operation on an empty container, such as removing an element.

类摘要

class UnderflowException extends RuntimeException {
/* 继承的属性 */
protected string $message = "";
private string $string = "";
protected int $code;
protected string $file = "";
protected int $line;
private array $trace = [];
private ?Throwable $previous = null;
/* 继承的方法 */
final public Exception::getMessage(): string
final public Exception::getCode(): int
final public Exception::getFile(): string
final public Exception::getLine(): int
final public Exception::getTrace(): array
final public Exception::getTraceAsString(): string
public Exception::__toString(): string
private Exception::__clone(): void
}
add a noteadd a note

User Contributed Notes 1 note

up
-8
evguenia dot chagnon at gmail dot com
5 years ago
UnderflowException handles exceptions due to a value being too small to maintain precision, resulting in loss of accuracy. In PHP, this can occurs when using floats:

echo (1-0.9) // 0.1
echo (1-0.99) // 0.01
echo (1-0.999) // 0.001
echo (1-0.9999) // 9.9999999999989E-05
echo (1-0.99999) // 9.9999999999545E-06
echo (1-0.999999) // 1.0000000000288E-06

官方地址:https://www.php.net/manual/en/class.underflowexception.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3