Skip to content

Float addition/division issues #1588

Closed
Closed
@AlexWinder

Description

@AlexWinder

Hello,

We have found an issue with our PHP Docker environment since an update has been pushed for the latest version of PHP 8.4.

We are using the php:8.4-fpm-bookworm base image.

We have the following PHP code:

[
            $this->north,
            $this->south,
            $this->east,
            $this->west,
            ($this->east + $this->west),
            ($this->east + $this->west) / 2,
            ($this->east + $this->west) / 2.0
]

Where this doesn't return consistently, sometimes we get this output, which is correct:

[
        38.924993216059,
        38.907006783941,
        1.4595583969657,
        1.4364416030343,
        2.896,
        1.448,
        1.448
]

Other times we get this output, which is breaking division:

[
        38.924993216059,
        38.907006783941,
        1.4595583969657,
        1.4364416030343,
        1.369313176327556e-309,
        6.8465658816378e-310,
        6.8465658816378e-310
]

The output is not consistent and sometimes returns the correct output, sometimes not.

This was highlighted in our automation tests, and with no changes to our underlying code. If we make use of the php:8.4.7-fpm-bookworm then the output is consistent and is correct. This appears to have been introduced with the recent update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions