From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?Windows-1252?Q?Vincent_Bela=EFche?= Newsgroups: gmane.emacs.devel Subject: RE: using ses programatically (was: a ses question) Date: Sun, 19 Nov 2023 23:18:12 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_PAXP192MB16082C40D983B07ECBAEDE4684B5APAXP192MB1608EURP_" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22229"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel , "boruch_baum@gmx.com" To: =?Windows-1252?Q?andr=E9s_ram=EDrez?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 20 04:21:04 2023 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 1r4uqN-0005XY-Qx for ged-emacs-devel@m.gmane-mx.org; Mon, 20 Nov 2023 04:21:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4upp-0004yL-Pb; Sun, 19 Nov 2023 22:20:29 -0500 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 1r4r8J-00045c-HF for emacs-devel@gnu.org; Sun, 19 Nov 2023 18:23:19 -0500 Original-Received: from mail-db8eur05olkn20812.outbound.protection.outlook.com ([2a01:111:f400:7e1a::812] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r4r8G-00057f-0P for emacs-devel@gnu.org; Sun, 19 Nov 2023 18:23:19 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AIQY4hP2MVYTrNxBUX07qHXoAabm5iEtooqGHhHndfEYrgQ6sQTgtg2ogfhazy5z2uw07Wsvv6Fqk6NwQL6blQEy/KB5PVhrTqV4WCtANb8HnPAeaLGbJzvQ16pS+/a+yOG7GnskZqfmKDOn7PZhrgjR2Y7QJNHHqV78yAB2SlhZbjcgCpHivr1gTIhr9PwJDKLvRomWnBisbDsRUz2q4joM4xtwvOgu+btx+ywh72MUYzHOlB9VRi4DS7q+9uihqaAQ0IzqBXUd+aizMyxrsZHjoTVwpajcJZwer2erjdH4msHABAV3y12iafD3G7fPotWhZSNsUWcapgc0pedVSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0opPrvBj8ECiYzcMYrnD6AfmsRxnitM46RluYmu8EIc=; b=dS/YZj80cQeOam5tlnl6vMHEjDVbjlYbMVb5co8p2IFftpHJyJ4Gpm9vTV47x+6aG4h8PPv8q106QhHbmNS1aF6ZfdEDrAmZGhTSycS5kb6ls26Sz/u2qm8f7O2Z+j0LaRibhUgUluwWBUtfVeYyjNNuVVJx2SkBf/8HUCfg7UqbtdxPCgGyvnHRKBpOC1EJrfsVHZlXeEVJ/0kPiNBjG/IQ/8wRq0ZKmyv61y9YSuK0hPbD9fTu1JPQb1HKRldB5vk4/a9zSJ3z+H4q2NqFKqvQNu2SdlYw34Bf1yZpOYypBabE4EPC23m4PSR4edZoY1upXszZjb4GEUoc93iLUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Original-Received: from PAXP192MB1608.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:28c::22) by DU0P192MB1595.EURP192.PROD.OUTLOOK.COM (2603:10a6:10:34f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.26; Sun, 19 Nov 2023 23:18:12 +0000 Original-Received: from PAXP192MB1608.EURP192.PROD.OUTLOOK.COM ([fe80::d4fd:99e8:e147:9752]) by PAXP192MB1608.EURP192.PROD.OUTLOOK.COM ([fe80::d4fd:99e8:e147:9752%5]) with mapi id 15.20.7002.026; Sun, 19 Nov 2023 23:18:12 +0000 Thread-Topic: using ses programatically (was: a ses question) Thread-Index: AQHaDyaIFxl+uTQAXkSovHGVyH2ZGrBrhKoNgABOFwCAAB8A5YAALdsAgBSj6giAAVoZAIAAPkBX In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: fr-FR x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [phtXRqcVc1l+iGcMlS/cEEyYpsRA/zCt] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PAXP192MB1608:EE_|DU0P192MB1595:EE_ x-ms-office365-filtering-correlation-id: 21a74f83-b15a-4f90-9ef2-08dbe955cce9 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rzqzq9WuqQKc/jBGFz4bESd3JIAqgReQFqcwqLc832InQoZ+qvveMcqGcA4S4E8f0GHuqaWj2nWgV4YK7YWGjVkmKdzR+JFKwjuqZt4Q5QAgBZ0BnNw2A1jLEb2JoX+FURo7akSy7PvJf+ppY4plD4X740QuKfOHLKnbg54PsADAEA849T7h2s5MtM2sZKMnOshBGQzDeMWLakshPveWvTp4uctMDAg5C89SoIxxvKXXMjPXzmko3X4OXAZRoCEoj5pkjYAKyCNcK+8r1yURtYQQnjJZDKAh10cTUQIG3LLKOojIgg6+z1b/iFvsn+44seIicIM2Qn3bEXVYfMyn2zJVF9TSZzzHhnAQF3wa5Rck+ypyQ+tuk7fq13q1mcI9kTdvypKjj3GPCrvPAz6mPhxxO+7D/iGF6ZIsSsmHtEwp/qYDYhm7WOn7OfeKs8A0IvZLetsEuXsHfwsbVLff/DnUllxHBx68mx6vJnsSNalyAkORw3p8Zl7iLOzJv1n2DM0M1/fH9592CVZTZRW/51zm47iLtNrCThN+2kDLAdtioGJusMAzXb7xEnVqW0+R x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?ndunkyLW8Uq1J+o+s/SGm5HVQuCbcM4LwXGuQBICLOepIN85xTUVXpo5?= =?Windows-1252?Q?0EMY9Y6QfTxPP09V59PHY3rmSDZdO9CQOu+gPDjDEytPp6spBCjYflV/?= =?Windows-1252?Q?2EqFOS0ex+k++zFMrHgOerPNq7hrUjSlAMIkfDIQJHdU3DCOmndaYAMw?= =?Windows-1252?Q?LTg2IoZGm1RHU201Op2mLLuri2NwDw9YzN3NkWYQNSwoBReoUOaZiMC2?= =?Windows-1252?Q?Uw3BPTT0Zo9OIIUnwE1niB3oKed3hGGgAlaABgRGlNdjnQbm/62nOLQO?= =?Windows-1252?Q?b71oIk+7/96O4l5WUMM3ab/ow39LLB7JCu+9hTiNE10TeAnTAxNfFtWD?= =?Windows-1252?Q?YUxy0pGpDwfov3fTd+VyMdCut7JgUspT+yCkF9T4Jj2hgehfEezUxG83?= =?Windows-1252?Q?56JQWxGPZ2W9RrcWaQAJmM8d3F0PqSsI97VznbvjVrB3ThWZEXrgleFr?= =?Windows-1252?Q?0povlS+FkrZgueeNyzp337YnsU5ALfxfoc3uWrs3BRgsJ2spFjYlF/+u?= =?Windows-1252?Q?CNItW3orOUZ6qzUKXMAC7WAlBeK2erYTYLdnQQ3ASOjG86iVZ2dyIhjW?= =?Windows-1252?Q?HHwyfpo8dvRumV8KujQ8O26k4xVYc269aTcJjbcidMDSAraUG2GHImqq?= =?Windows-1252? X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-fb43a.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PAXP192MB1608.EURP192.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 21a74f83-b15a-4f90-9ef2-08dbe955cce9 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Nov 2023 23:18:12.1819 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0P192MB1595 Received-SPF: pass client-ip=2a01:111:f400:7e1a::812; envelope-from=vincent.b.1@hotmail.fr; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, HTML_MESSAGE=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 19 Nov 2023 22:20:20 -0500 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:313032 Archived-At: --_000_PAXP192MB16082C40D983B07ECBAEDE4684B5APAXP192MB1608EURP_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hello, Maybe it is due to the order of summing, ses+ is defined as follows: (defun ses+ (&rest args) "Compute the sum of the arguments, ignoring blanks." (apply #'+ (apply #'ses-delete-blanks args))) But ses-delete-blanks will revert the order, so in the second case you sum = N6 N5 N4 N3 and not N3 N4 N5 N6. Have you tried to use in both case '+ or 'ses+, but not '+ in one case and = 'ses+ in the other case. BR, V. PS : Basically you are summing IEEE 754 floating point numbers, so there ar= e some minor rounding errors when converting form decimal to binary and vic= e versa, because IEEE 754 is using a 2 exponent. If you are doing some accounting maybe it is better to use Calc fixed point= numbers, so you would have interger summing and no rounding errors as Calc= is using a 10 exponent. Of course using Calc is less practical, this is one of my big todo to make = SES/Calc interaction easier. ________________________________ De : andr=E9s ram=EDrez Envoy=E9 : dimanche 19 novembre 2023 20:24 =C0 : Vincent Bela=EFche Cc : emacs-devel ; boruch_baum@gmx.com Objet : Re: using ses programatically (was: a ses question) Hi. Vincent. >>>>> "Vincent" =3D=3D Vincent Bela=EFche writes: Vincent> I attached an updated ses-setq macro. [...] I have just tested the last version of ses.el And I have found a trivial difference. When I code: --8<---------------cut here---------------start------------->8--- (ses-setq :: sf N7 (+ N3 N4 N5 N6)) (setq mysum (number-to-string (ses-cell-value 6 13))) (message (format "the sum: '%s'" mysum)) --8<---------------cut here---------------end--------------->8--- the output is: ,---- [ single digit output ] | the sum: =92192.6=92 `---- But then when code is: --8<---------------cut here---------------start------------->8--- (ses-setq :: sf N7 (apply 'ses+ (ses-range N3 N6))) (setq mysum (number-to-string (ses-cell-value 6 13))) (message (format "the sum: '%s'" mysum)) --8<---------------cut here---------------end--------------->8--- the output is: ,---- [ more than one digit decimal output ] | the sum: =92192.60000000000002=92 `---- Any idea why the difference? BTW: yesterday I have found a different issue when using keyboard macros for copying some specific cells to different lines on another buffer. But. Let's end this part for asking about that one. --_000_PAXP192MB16082C40D983B07ECBAEDE4684B5APAXP192MB1608EURP_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
Hello,

Maybe it is due to the order of summing, ses+ is defined as follows:

(defun ses+ (&= ;rest args)
  "Compute the sum of the argume= nts, ignoring blanks."
  (apply #'+ (apply #'ses-delete-blan= ks args)))

But ses-delete-blanks will revert the orde= r, so in the second case you sum N6 N5 N4 N3 and not N3 N4 N5 N6.

Have you tried to use in both case '+ or '= ses+, but not '+ in one case and 'ses+ in the other case.

BR,
  V.

PS : Basically you are summing IEEE 754 floating point numbers, so the= re are some minor rounding errors when converting form decimal to binary an= d vice versa, because IEEE 754 is using a 2 exponent.
If you are doing some accounting maybe it = is better to use Calc fixed point numbers, so you would have interger summi= ng and no rounding errors as Calc is using a 10 exponent.
Of course using Calc is less practical, th= is is one of my big todo to make SES/Calc interaction easier.


De : andr=E9s ram=EDrez <= ;rrandresf@hotmail.com>
Envoy=E9 : dimanche 19 novembre 2023 20:24
=C0 : Vincent Bela=EFche <vincent.b.1@hotmail.fr>
Cc : emacs-devel <emacs-devel@gnu.org>; boruch_baum@gmx.c= om <boruch_baum@gmx.com>
Objet : Re: using ses programatically (was: a ses question)
 
Hi. Vincent.

>>>>> "Vincent" =3D=3D Vincent Bela=EFche <vinc= ent.b.1@hotmail.fr> writes:


    Vincent> I attached an updated ses-setq macro.


[...]

I have just tested the last version of ses.el

And I have found a trivial difference.

When I code:
--8<---------------cut here---------------start------------->8---
      (ses-setq :: sf N7 (+ N3 N4 N5 N6))
      (setq mysum  (number-to-string (ses-cel= l-value 6 13)))
      (message (format "the sum: '%s'"&n= bsp; mysum))
--8<---------------cut here---------------end--------------->8---
the output is:
,---- [ single digit output ]
| the sum: =92192.6=92
`----

But then when code is:
--8<---------------cut here---------------start------------->8---
      (ses-setq :: sf N7 (apply 'ses+ (ses-range N= 3 N6)))
      (setq mysum  (number-to-string (ses-cel= l-value 6 13)))
      (message (format "the sum: '%s'"&n= bsp; mysum))
--8<---------------cut here---------------end--------------->8---
the output is:
,---- [ more than one digit decimal output ]
| the sum: =92192.60000000000002=92
`----

Any idea why the difference?

BTW: yesterday I have found a different issue when using keyboard
macros for copying some specific cells to different lines on another
buffer. But. Let's end this part for asking about that one.
--_000_PAXP192MB16082C40D983B07ECBAEDE4684B5APAXP192MB1608EURP_--