From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Herman=2C_G=C3=A9za?= Newsgroups: gmane.emacs.devel Subject: Re: Improving JSON pretty printing, how to represent floats? Date: Fri, 05 Apr 2024 15:16:44 +0200 Message-ID: <877chc5417.fsf@gmail.com> References: <87msq8w2zm.fsf@gmail.com> <86bk6o56np.fsf@gnu.org> <87bk6o55ci.fsf@gmail.com> <867chc5526.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36971"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?Q?G=C3=A9za?= Herman , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Apr 05 15:32:52 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rsjgZ-0009NZ-9S for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Apr 2024 15:32:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rsjfv-0004GS-Dq; Fri, 05 Apr 2024 09:32:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rsjfu-0004GI-6Q for emacs-devel@gnu.org; Fri, 05 Apr 2024 09:32:10 -0400 Original-Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsjfs-00083R-9Q; Fri, 05 Apr 2024 09:32:09 -0400 Original-Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-56c5d05128dso2641424a12.0; Fri, 05 Apr 2024 06:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712323926; x=1712928726; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:references:from:to:cc:subject:date:message-id :reply-to; bh=vyiCOa9ISzci9g/jiHXDpYrRtJwjzRGfVCM968/iQHk=; b=ZzsQAyd5kfx486OFZ5WibHooknc/JklEqBJ81zy5kKE5SUqZxB04RHFW3zH8w8PpGJ tZy5DrThCfZ7TAmYB5ksAYkscihbb09UgzSLe0Ok/0UL0vEU5wnKVEPgr+2uHSFBdZqB AJPx3doOY/LbFzQiFTwQSCu8HPhLXI48ktdNf8ULdG/7GkKSHAFz0lZiU1Nih7p/XKgx 2ZEkwuRuiGT9f8vHyeF4NxfT6rWt0Gm//KSsRMic0ORyoNEoIyWXGCsylVoKjyuAzF15 KG0klxLO6s/7lU3ajTk9g12iolOx6KpeJ94aFLrb09Sh9Kpg09OEgR7BbJFFGjLj8zjc AVmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712323926; x=1712928726; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:references:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=vyiCOa9ISzci9g/jiHXDpYrRtJwjzRGfVCM968/iQHk=; b=m+IjCVED/BBtfo/E/xn+n2s/BeaSp22Rkwa5rG1HFfpWqZfz4oV1GnIy7tk3AxjQoJ at1H7xohNscU2TQPCDAVDTcyyWXvlzhMZcqi0PVVayX2M3oOQhisaNzzEV61RZkJLJTu gin6WSuoMGhzL3cFSXPJioqTDt1B8vhhX4NPkueiU3bGJBwLpCO6RVqg3OI2Z5gKrW7r yrViG0htCUjy5nRhnzNpjd5PBfKIp6oRLmfFbqBLKQZl7L/0bst2c+x5bGzMJzrTj2Sj PxEJ2ryl2npgcxCIg6buHKy9RpOh7gEcuCAsQFNDJpN9+UY4SSv4swOo0vykLwD7GQCS EQ/Q== X-Forwarded-Encrypted: i=1; AJvYcCXP1h5mDDDnMsSUKzOlcboJaEBsGsU4ByRYvVfRdOOngZynMy2gJpq2sOB7iX99vgyykuECnWRtAe4JVWtrPqcjFIwf X-Gm-Message-State: AOJu0YwXHdpFkENuOIAFnVJDaSu+A2leMWWUY8vo2h3V9sdDfXsA+kWo cRJXCG1S44icEG2ao4o1+gzghtYVENXQkPdTedZrX1V11MuEZqiTHMYs1usk X-Google-Smtp-Source: AGHT+IEPyZ8/9gqpwC9R9DV7bHKZNTyaMxIqEhyJpBLwFUOUX3AO8DBXVDK1WBVvME5WdUqi+NX/nA== X-Received: by 2002:a17:907:7da4:b0:a4e:2873:e94b with SMTP id oz36-20020a1709077da400b00a4e2873e94bmr1466561ejc.6.1712323925789; Fri, 05 Apr 2024 06:32:05 -0700 (PDT) Original-Received: from localhost (62-77-231-86.static.invitel.hu. [62.77.231.86]) by smtp.gmail.com with ESMTPSA id l13-20020a170906794d00b00a46a2779475sm830017ejo.101.2024.04.05.06.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 06:32:05 -0700 (PDT) In-reply-to: <867chc5526.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=geza.herman@gmail.com; helo=mail-ed1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:317546 Archived-At: Eli Zaretskii writes: >> From: Herman, G=C3=A9za >> Cc: G=C3=A9za Herman , >> emacs-devel@gnu.org >> Date: Fri, 05 Apr 2024 14:55:26 +0200 >> >> >> Eli Zaretskii writes: >> >> > The digits in 3.333333333333000000000000000001 after 16th=20 >> > digit >> > are meaningless: they aren't supported by IEEE floating-point >> > standard, so they are just numerical noise. Thus, talking=20 >> > about >> > "lossless" wrt them makes little sense to me. >> >> You mean the 64-bit binary format. IEEE-754 describes more=20 >> formats >> which have more precision, and also there are more formats used=20 >> in >> practice than what IEEE-754 describes. >> >> Plus, I don't think that the JSON standard mandates IEEE-754 >> numbers. It just describes numbers, so I think it's good=20 >> behavior >> to not change numbers during formatting. > > The fact that Emacs supports IEEE-754 on almost all platforms is > prominently documented in the ELisp reference manual, see the=20 > node > "Float Basics" there. I don't think it's relevant here. If I reformat a JSON, it should=20 really be a formatting operation, it shouldn't matter what kind of=20 floating point numbers a platform supports. We are not talking=20 about reading a JSON, but formatting it. What if I open a .json=20 file because I want to edit it a little bit (renaming some=20 members, etc.), but then I realize that the format of the json is=20 bad, so I reformat it. But I want to maintain the precision,=20 because I intend to use the .json in some other software which=20 supports arbitrary floating point precision.