Make Core.Float a class. Add missing builtins for float support. (#5932)

Add missing builtins for float compound assignment, for building a
FloatType, and for converting a float literal to FloatType. Switch
`Core.Float` to being a class and add impls for the various
floating-point operators.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
This commit is contained in:
Richard Smith
2025-08-11 21:01:34 +00:00
committed by GitHub
co-authored by google-labs-jules[bot] Carbon Infra Bot
parent f616817b71
commit 694c00c7eb
66 changed files with 2158 additions and 583 deletions
@@ -67,7 +67,7 @@ fn F() {
// CHECK:STDOUT: --- fail_todo_import_unsupported_primitive_type.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %float: f64 = float_value 1.1000000000000001 [concrete]
// CHECK:STDOUT: %float: Core.FloatLiteral = float_value 1.1000000000000001 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -81,7 +81,7 @@ fn F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
// CHECK:STDOUT: %float: f64 = float_value 1.1000000000000001 [concrete = constants.%float]
// CHECK:STDOUT: %float: Core.FloatLiteral = float_value 1.1000000000000001 [concrete = constants.%float]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -89,7 +89,7 @@ fn F() {
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
// CHECK:STDOUT: %float: f64 = float_value 2 [concrete]
// CHECK:STDOUT: %float: Core.FloatLiteral = float_value 2 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -104,7 +104,7 @@ fn F() {
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %float: f64 = float_value 2 [concrete = constants.%float]
// CHECK:STDOUT: %float: Core.FloatLiteral = float_value 2 [concrete = constants.%float]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: