Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Type/Constant/ConstantFloatType.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ private function castFloatToString(float $value): string
$precisionBackup = ini_get('precision');
ini_set('precision', '-1');
try {
if (is_nan($value)) {
return 'NAN';
}

$valueStr = (string) $value;
if (is_finite($value) && !str_contains($valueStr, '.')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_finite is still required, because there is also INF, but this does not trigger the same warning

$valueStr .= '.0';
Expand Down
Loading