lib/torch/inspector.rb in torch-rb-0.6.0 vs lib/torch/inspector.rb in torch-rb-0.7.0

- old
+ new

@@ -94,11 +94,14 @@ end else ret = "%.#{PRINT_OPTS[:precision]}f" % value end elsif @complex_dtype - p = PRINT_OPTS[:precision] - raise NotImplementedYet + # TODO use float formatter for each part + precision = PRINT_OPTS[:precision] + imag = value.imag + sign = imag >= 0 ? "+" : "-" + ret = "%.#{precision}f#{sign}%.#{precision}fi" % [value.real, value.imag.abs] else ret = value.to_s end # Ruby throws error when negative, Python doesn't " " * [@max_width - ret.size, 0].max + ret