mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 03:58:20 +00:00
fix ZAM "cat" of doubles/times to include trailing ".0" per normal BiF behavior
This commit is contained in:
parent
86d1812d49
commit
4cafacf90b
5 changed files with 48 additions and 15 deletions
|
@ -68,10 +68,18 @@ void FixedCatArg::RenderInto(ZVal* zframe, int slot, char*& res) {
|
|||
break;
|
||||
|
||||
case TYPE_DOUBLE:
|
||||
case TYPE_TIME:
|
||||
n = modp_dtoa2(z.AsDouble(), res, 6);
|
||||
case TYPE_TIME: {
|
||||
auto d = z.AsDouble();
|
||||
n = modp_dtoa2(d, res, 6);
|
||||
res += n;
|
||||
|
||||
if ( util::approx_equal(d, nearbyint(d), 1e-9) && std::isfinite(d) && ! strchr(tmp, 'e') ) {
|
||||
// disambiguate from integer
|
||||
*(res++) = '.';
|
||||
*(res++) = '0';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case TYPE_PATTERN:
|
||||
text = z.AsPattern()->AsPattern()->PatternText();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue