Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stdlib/std.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ limitations under the License.

// Render floating point in scientific form
local render_float_sci(n__, zero_pad, blank, plus, ensure_pt, trailing, caps, prec) =
local exponent = if n__ == 0 then 0 else std.floor(std.log(std.abs(n__)) / std.log(10));
local exponent = if n__ == 0 then 0 else std.floor(std.log(std.abs(n__)) / std.log(10) + 1e-12);
local suff = (if caps then 'E' else 'e')
+ render_int(exponent < 0, std.abs(exponent), 3, 0, false, true, 10, '');
local mantissa = if exponent == -324 then
Expand Down Expand Up @@ -688,7 +688,7 @@ limitations under the License.
error 'Format required number at '
+ i + ', got ' + std.type(val)
else
local exponent = if val != 0 then std.floor(std.log(std.abs(val)) / std.log(10)) else 0;
local exponent = if val != 0 then std.floor(std.log(std.abs(val)) / std.log(10) + 1e-12) else 0;
if exponent < -4 || exponent >= fpprec then
render_float_sci(val,
zp,
Expand Down