Bill Allombert on Thu, 18 Jan 2024 23:42:32 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: print() does output numbers in scientific notation violating JSON number spec
|
- To: pari-dev@pari.math.u-bordeaux.fr
- Subject: Re: print() does output numbers in scientific notation violating JSON number spec
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Thu, 18 Jan 2024 23:42:04 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1705617726; c=relaxed/relaxed; bh=ur2vHAl558FpMa/yy3aAdStaBWrdMaWD60dQMaFBn1g=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=riTgkocdla8oWloRr2dE871YmnMNHWBQFPCokqwsrUi3TixE69WV0QJfdzcSvxTpJV7BHkgPDYVpVdtK0hbT2RLd2X7/5orlMGXX3ds2UTi3ZFdYFYk0FOR15sTC1KF+uLLIhz29khGZya6XfKG86e0PG3amk+sJom3gRROr3Qux8Im+aeZwOhNXanYByb7MW32jz1y/qhap7LD0yZUbBTbgytxZJVjoOhiJwQ0l/61DZpxg1SXNDLQJDF69P4mkghXhdqK8Duz38iCUijoKkwgfeayR4puOIKsiiZkF4dUHG1rZYvVpuGMfhdrdiLbsaGeACL8XmvJFTmNoMxL2JvEpRuTC/SOFP/MaCFF3kuTyPyxK7iB+PBJ968RihWcQyygmhy7wQXuQSD6aagx4Dn3HhLNHSZF7AJnQsLZPjpBip/sPQmJz9eDGmhsPpWS3MVUs2Bgz4qnZH1K69mWJm9fKPMX0UG+JpxAQeovtMwaExC00ZpB0yw3xC7qGRHN8HcdhQwt4gLqxcDbTb018M/ijChsSZZdEH6/FoG++qgNze4RaLiIWr+tM+mcTJctlOT2CXyV1Y1c4RXrj3ry/JYPisXlCx4VsolALFitlP6l++5ErcwXrHNUqGronDu9LEO+j/ozJqsBz/tfOlf5mUfbnFcenrDMjaBsD6IWH+4M=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1705617726; cv=none; b=AQYLCNjNGFHtXiuhFFZMIb9vSjXizfdLdfImltCFMnwpOTqOsy2d4qmOlLnhLGtrfgSxgfr8BQ/AdBP1rB9ZM8d+igEXlcDdjd7j37ZTY8hPYBOAy++hDDAYgloyBwscgdNp8H9RjrQ1hcQQ6vmrRK2viSswJo+Gcts1ILBvmFOCtW/qOLyHa1JKzFD4diTALLqO4lodCKPG5WDnVnsT/sr9re/bO4yNnXajcEZKuO2fKpEGaDuAYgRkPiCDlrLRa4ijCqqE0GDdVcw2eX+S528viUfxu+sj4UKEMZlSWsOwZ/j/hKKLKyxuHB65MYb00ZDk+vbPfyXc7/px8tEjv6fp7YXZ0k7AgeS3Y2fyDypA0U/9YZDE120guW5kmhZ0hM9xAv/KQEchc3DPSsLxcohi3bWgfPSPTo86N5NpOiG/GkRmgR8dzZQG9pue1EG57aXLBzgE2VSfAN4rQhVOSAMpS4Y/ffkA0VuJSgNLqCIpfNN7OaEFaX7eBIoo1sfJTPUNOj4ZaD1W6ELYJ+RyL91KbYl74CyLetwL1ymXeXvUsW1thCruxBIarq0AwLDRXXQfv97Vhoa4o2N1W8F5J43c0M3g29s4K3CxQO4F1mMBUwP2nRULYVBO0sJKGFX6McwWbySPGyU7d2Kxolk3IDs3SFl/lBbXQjBDb9GFu5Q=
- Authentication-results: smail; arc=none
- Delivery-date: Thu, 18 Jan 2024 23:42:32 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1705617726; bh=ur2vHAl558FpMa/yy3aAdStaBWrdMaWD60dQMaFBn1g=; h=Date:From:To:Subject:References:In-Reply-To:From; b=o37TL/1JV/bsmdNjmZemstxipRXIs9WfRUmEfqbHxAPPDUEK57geFMDIZkPv8ixnW cAr4g+vp0ha6AMkNQljkc/yWBqAgRqitRFPPpprL4afpLUAwA+DI3t78rBT/p2ppXC Ej9KEt1ztzt0GQbHkJ2EaJDslQWySNSzBaQGVdIZIYegLiJw6p826pwL02rDzQMOme pRMpZl3+burxQaKniKikq3XDMo7T4N+naFkfu4nvvTb1xIVgtiPFahTCGkNgh41fmR LvDyh6oPGQNi9SOCIW8R/RImmPfSsDlbvd80Wqk/NYXpxc004v4JZZiM+Xe+1vnRhg kBoGhMY8anPssWBT+5nnq8BOUEqj9OJaGgqPHZfJsu5UEPK15FJdTeKzqq3SyNIk02 HFmJVfWw3fCDsEzJgZ60m544L8j9BAcj26a4z6QBbYlz2U1fRVyuf2UZnmMFYzkBiI 2FM97kcumF4MdKsFJi9/jRU6HEYGPsNE7Fl7wKjd7k89ZkFt8Tkvbc5ssLMzOBNoDd seBaW2cY8MWw/bKfHGJOn+9Smh818KSAwttEQrlE2BvTZVe9cFME8nxcXGwBDMNtDD nF7sy4D5T6ZUOZIuzckImchqypq1z8Ew15MRnYMV86FZyT6EwatSn/ELIxpRG19r/4 Mn4VEd3KXU5INna0yx8V+1sk=
- In-reply-to: <2d45d7370dc9943ba5d32f6ec843691b@stamm-wilbrandt.de>
- Mail-followup-to: pari-dev@pari.math.u-bordeaux.fr
- References: <2d45d7370dc9943ba5d32f6ec843691b@stamm-wilbrandt.de>
On Thu, Jan 18, 2024 at 11:09:49PM +0100, hermann@stamm-wilbrandt.de wrote:
> From latest JSON rfc:
>
> ? version
> %2 = [2, 15, 4]
> ? print(0.00001)
> 1.0000000000000000000000000000000000000 E-5
> ?
>
> I use PARI/GP to write a JSON file, that is read by JavaScript/nodejs.
> And that errors out on reading above number.
> If I manually remove the space, "1.0000000000000000000000000000000000000E-5"
> can be processed easily.
You can do
default(output,0)
(\o0)
? \o0
? print(0.00001)
1.0000000000000000000000000000000000000E-5
> Is there an option to make PARI/GP produce "0.00001" as output instead of
> scientific representation?
? printf("%f",0.000000000000000000001)
0.0000000000000000000010000000000000000000000000000000000000
or even
? default(format,"f.38")
? print(0.00001)
0.000010000000000000000000000000000000000000
Cheers,
Bill