Sha256: 24ac089d7c7a9550d884e146504faeb603d8bb7290bb3553ab31b7ea4ea34f23
Contents?: true
Size: 309 Bytes
Versions: 2
Compression:
Stored size: 309 Bytes
Contents
# frozen_string_literal: true # Redefine float with the apropriate options class Float def sigfig(digits) f = format("%.#{digits - 1}e", self) f = f.to_f i = f.to_i (i == f ? i : f).to_s end def hisigfig(digits) format("%.#{digits - 1}e", self).split('e')[0].delete('.') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pdground-0.1.2 | lib/pdground/extension.rb |
pdground-0.1.1 | lib/pdground/extension.rb |