Skip to content

Commit 3572857

Browse files
committed
Fix formating
1 parent fa68d69 commit 3572857

5 files changed

Lines changed: 174 additions & 174 deletions

File tree

convert.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@ func ToFloat8(f32 float32) Float8 {
4040
// - NaN is handled according to the conversion mode
4141
//
4242
// For finite numbers, the conversion follows these steps:
43-
// 1. Extract sign, exponent, and mantissa from the float32
44-
// 2. Adjust the exponent for the Float8 format (E4M3FN)
45-
// 3. Round the mantissa to 3 bits (plus implicit leading bit)
46-
// 4. Handle overflow/underflow according to the conversion mode
43+
// 1. Extract sign, exponent, and mantissa from the float32
44+
// 2. Adjust the exponent for the Float8 format (E4M3FN)
45+
// 3. Round the mantissa to 3 bits (plus implicit leading bit)
46+
// 4. Handle overflow/underflow according to the conversion mode
4747
//
4848
// Returns the converted Float8 value and an error if the conversion fails in strict mode.
4949
func ToFloat8WithMode(f32 float32, mode ConversionMode) (Float8, error) {
5050
// Handle special cases first
5151
if f32 == 0.0 {
5252
// Check the sign bit to distinguish between +0.0 and -0.0
5353
if math.Signbit(float64(f32)) {
54-
return NegativeZero, nil // -0.0
54+
return NegativeZero, nil // -0.0
5555
}
56-
return PositiveZero, nil // +0.0
56+
return PositiveZero, nil // +0.0
5757
}
5858

5959
if math.IsInf(float64(f32), 0) {

convert_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,14 @@ func TestConversionTable(t *testing.T) {
184184
output float32
185185
skip bool // Skip comparison for values that might vary
186186
}{
187-
{0x00, 0.0, false}, // +0.0
187+
{0x00, 0.0, false}, // +0.0
188188
{0x80, float32(math.Copysign(0, -1)), false}, // -0.0
189-
{0x3F, 1.0, true}, // 1.0 (approximate in float8)
190-
{0xBF, -1.0, true}, // -1.0 (approximate in float8)
191-
{0x78, float32(math.Inf(1)), false}, // +Inf (IEEE 754 E4M3FN)
192-
{0xF8, float32(math.Inf(-1)), false}, // -Inf (IEEE 754 E4M3FN)
193-
{0x7F, float32(math.NaN()), false}, // NaN (IEEE 754 E4M3FN)
194-
{0xFF, float32(math.NaN()), false}, // NaN (IEEE 754 E4M3FN)
189+
{0x3F, 1.0, true}, // 1.0 (approximate in float8)
190+
{0xBF, -1.0, true}, // -1.0 (approximate in float8)
191+
{0x78, float32(math.Inf(1)), false}, // +Inf (IEEE 754 E4M3FN)
192+
{0xF8, float32(math.Inf(-1)), false}, // -Inf (IEEE 754 E4M3FN)
193+
{0x7F, float32(math.NaN()), false}, // NaN (IEEE 754 E4M3FN)
194+
{0xFF, float32(math.NaN()), false}, // NaN (IEEE 754 E4M3FN)
195195
}
196196

197197
for _, tv := range testValues {

0 commit comments

Comments
 (0)