Skip to content

[BUG] 1.0 / 0.0 interpreted as nan rather than inf. #5733

@oepir

Description

@oepir

Bug description

Actual behavior

Mojo treats 1.0 / 0.0 as nan rather than infinity. This can be seen running:

fn main():
    print("inf:", 1.0 / 0.0)

Expected behavior

The expected output isinf but instead nan is output. This suggests that some incorrect simplification/rewrite is performed by the compiler.

Steps to reproduce

Run the small program above.

System information

System
------------
       Pixi version: 0.48.2
           Platform: osx-arm64
   Virtual packages: __unix=0=0
                   : __osx=15.6.1=0
                   : __archspec=1=m1
          Cache dir: /Users/sduvan/Library/Caches/rattler/cache
       Auth storage: /Users/sduvan/.rattler/credentials.json
   Config locations: No config files found

Global
------------
            Bin dir: /Users/sduvan/.pixi/bin
    Environment dir: /Users/sduvan/.pixi/envs
       Manifest dir: /Users/sduvan/.pixi/manifests/pixi-global.toml

Workspace
------------
               Name: code
            Version: 0.1.0
      Manifest file: /Users/sduvan/mojo/code/pixi.toml
       Last updated: 01-01-2026 21:16:42

Environments
------------
        Environment: default
           Features: default
           Channels: https://conda.modular.com/max-nightly, conda-forge
   Dependency count: 1
       Dependencies: modular
   Target platforms: osx-arm64
    Prefix location: /Users/sduvan/mojo/code/.pixi/envs/default

mojo --version
Mojo 0.26.1.0.dev2026010105 (cb875d6f)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssue needs to be routed/triaged to a particular team stillbugSomething isn't workingmojoIssues that are related to mojo

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions