Skip to content

Commit a71f150

Browse files
committed
Whitespace/test fixes
1 parent 302184e commit a71f150

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

base/div.jl

+11-11
Original file line numberDiff line numberDiff line change
@@ -117,47 +117,47 @@ function divrem(x::Integer, y::Integer, rnd::typeof(RoundNearest))
117117
(q, r) = divrem(x, y)
118118
if x >= 0
119119
if y >= 0
120-
r >= (y÷2) + (isodd(y) | iseven(q)) ? (q+true, r-y) : (q, r)
120+
r >= (y÷2) + (isodd(y) | iseven(q)) ? (q+true, r-y) : (q, r)
121121
else
122-
r >= -(y÷2) + (isodd(y) | iseven(q)) ? (q-true, r+y) : (q, r)
122+
r >= -(y÷2) + (isodd(y) | iseven(q)) ? (q-true, r+y) : (q, r)
123123
end
124124
else
125125
if y >= 0
126-
r <= -signed(y÷2) - (isodd(y)| iseven(q)) ? (q-true, r+y) : (q, r)
126+
r <= -signed(y÷2) - (isodd(y) | iseven(q)) ? (q-true, r+y) : (q, r)
127127
else
128-
r <= (y÷2) - (isodd(y) | iseven(q)) ? (q+true, r-y) : (q, r)
128+
r <= (y÷2) - (isodd(y) | iseven(q)) ? (q+true, r-y) : (q, r)
129129
end
130130
end
131131
end
132132
function divrem(x::Integer, y::Integer, rnd:: typeof(RoundNearestTiesAway))
133133
(q, r) = divrem(x, y)
134134
if x >= 0
135135
if y >= 0
136-
r >= (y÷2) + isodd(y) ? (q+true, r-y) : (q, r)
136+
r >= (y÷2) + isodd(y) ? (q+true, r-y) : (q, r)
137137
else
138-
r >= -(y÷2) + isodd(y) ? (q-true, r+y) : (q, r)
138+
r >= -(y÷2) + isodd(y) ? (q-true, r+y) : (q, r)
139139
end
140140
else
141141
if y >= 0
142142
r <= -signed(y÷2) - isodd(y) ? (q-true, r+y) : (q, r)
143143
else
144-
r <= (y÷2) - isodd(y) ? (q+true, r-y) : (q, r)
144+
r <= (y÷2) - isodd(y) ? (q+true, r-y) : (q, r)
145145
end
146146
end
147147
end
148148
function divrem(x::Integer, y::Integer, rnd::typeof(RoundNearestTiesUp))
149149
(q, r) = divrem(x, y)
150150
if x >= 0
151151
if y >= 0
152-
r >= (y÷2) + isodd(y) ? (q+true, r-y) : (q, r)
152+
r >= (y÷2) + isodd(y) ? (q+true, r-y) : (q, r)
153153
else
154-
r >= -(y÷2) + true ? (q-true, r+y) : (q, r)
154+
r >= -(y÷2) + true ? (q-true, r+y) : (q, r)
155155
end
156156
else
157157
if y >= 0
158-
r <= -signed(y÷2) - true ? (q-true, r+y) : (q, r)
158+
r <= -signed(y÷2) - true ? (q-true, r+y) : (q, r)
159159
else
160-
r <= (y÷2) - isodd(y) ? (q+true, r-y) : (q, r)
160+
r <= (y÷2) - isodd(y) ? (q+true, r-y) : (q, r)
161161
end
162162
end
163163
end

test/int.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@ end
332332
end
333333

334334
@test div(typemax(Int64), typemax(Int64)-1, RoundNearest) == 1
335-
@test div(-typemax(Int64), typemax(Int64)-1, RoundNearest) == -2
335+
@test div(-typemax(Int64), typemax(Int64)-1, RoundNearest) == -1
336336
@test div(typemax(Int64), 2, RoundNearest) == 4611686018427387904
337337
@test div(-typemax(Int64), 2, RoundNearestTiesUp) == -4611686018427387903
338+
@test div(typemax(Int)-2, typemax(Int), RoundNearest) == 1
338339
end

0 commit comments

Comments
 (0)