Skip to content

Commit e87fea3

Browse files
authored
Fix printing complexes with zero imaginary part (#3635)
1 parent a201ecb commit e87fea3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lua/entities/gmod_wire_expression2/core/complex.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ local atan2 = math.atan2
1818
local function format(value)
1919
local dbginfo
2020

21-
if abs(value[1]) < 0 then
22-
if abs(value[2]) < 0 then
21+
if abs(value[1]) <= 0 then
22+
if abs(value[2]) <= 0 then
2323
dbginfo = "0"
2424
else
2525
dbginfo = Round(value[2]*1000)/1000 .. "i"
@@ -28,7 +28,7 @@ local function format(value)
2828
if value[2] > 0 then
2929
dbginfo = Round(value[1]*1000)/1000 .. "+" .. Round(value[2]*1000)/1000 .. "i"
3030
elseif abs(value[2]) <= 0 then
31-
dbginfo = Round(value[1]*1000)/1000
31+
dbginfo = tostring(Round(value[1]*1000)/1000)
3232
elseif value[2] < 0 then
3333
dbginfo = Round(value[1]*1000)/1000 .. Round(value[2]*1000)/1000 .. "i"
3434
end

0 commit comments

Comments
 (0)