cqlsh: Fix display of -infinity

Patch by Adam Holmberg; reviewed by Tyler Hobbs for CASSANDRA-10523
This commit is contained in:
Adam Holmberg 2015-10-14 11:17:50 -05:00 committed by Tyler Hobbs
parent bc1058f8ea
commit 02f88e38e1
2 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,5 @@
2.1.12
* (cqlsh) Distinguish negative and positive infinity in output (CASSANDRA-10523)
* (cqlsh) allow custom time_format for COPY TO (CASSANDRA-8970)
* Don't allow startup if the node's rack has changed (CASSANDRA-10242)
* (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645)

View File

@ -156,7 +156,7 @@ def format_floating_point_type(val, colormap, float_precision, **_):
if math.isnan(val):
bval = 'NaN'
elif math.isinf(val):
bval = 'Infinity'
bval = 'Infinity' if val > 0 else '-Infinity'
else:
exponent = int(math.log10(abs(val))) if abs(val) > sys.float_info.epsilon else -sys.maxint - 1
if -4 <= exponent < float_precision: