unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Panicz Maciej Godek <godek.maciek@gmail.com>
To: Guile User <guile-user@gnu.org>
Subject: Re: Double-precision floating point arithmetics behaves differently in Guile and in C
Date: Sun, 26 Sep 2021 13:55:20 +0200	[thread overview]
Message-ID: <CAMFYt2bV69zBtojZ819G102GG_EkK0PmfX0Pg-nApMN808mBVA@mail.gmail.com> (raw)
In-Reply-To: <CAMFYt2Z6zE0cm-419+VxS2uk792OVxX++Cnc5wBN-+M+jLRrbQ@mail.gmail.com>

I forgot to mention that I run Guile in an Emacs session running in a WSL
console on Windows 10.
The tests of the C code that I've been performing so far were executed in
an MSYS terminal, but I have just tried running them in WSL console, and
the radii get ridiculous values.

While the values used to generate the points are the following:

center '[-65.12 -50.54 88.66]:
radii: '[83.95 47.13 45.56]
rotation: '[[9.633871e-001   1.363818e-001   -2.308359e-001]
                [-1.734094e-001  9.735887e-001   -1.485064e-001]
                [2.044857e-001   1.830983e-001   9.615927e-001]]

and the values reconstructed in Guile are:

 (ellipsoid
  #:center (65.10194623013226 -88.58460232582514 -50.721825868168324)
  #:radii (83.94677717528019 45.56525864722978 47.12037877216948)
  #:rotation ((-0.9633227088329351 0.2307406879308479 0.13699669185777974)
                   (0.173638969876562 0.14674930301995573
0.9738142277679884)
                   (-0.20459439578586436 -0.961885324244193
0.18143251146545056)))

(the signs and the order of radii differ, but it seems that the rotation
matrix compensates for that)

in the case of MSYS (MinGW 64-bit) I get the following values:

approx_e.center = [90.13, -68.76, -42.46]
approx_e.radius = [178.83, 97.08, 100.43]
approx_e.rotation(3x3) =
        -9.634121049254586e-001 1.734020884333972e-001
 -2.043742444879810e-001
        -2.314281253565038e-001 -1.535574849495593e-001
9.606566096217422e-001
        -1.351966674037161e-001 -9.728061546592428e-001
-1.880692600613582e-001

but in the case of the WSL console, I get

approx_e.center = [90.13, -68.76, -42.46]
approx_e.radius = [1347844355973136335704668472606720.00,
731678657375689861259088782950400.00, 756961648396782369967223865344000.00]
approx_e.rotation(3x3) =
        -9.634121049254428e-01  1.734020884334219e-01
-2.043742444880351e-01
        -2.314281253566119e-01  -1.535574849499134e-01
 9.606566096216593e-01
        -1.351966674036449e-01  -9.728061546591822e-01
 -1.880692600617213e-01


  reply	other threads:[~2021-09-26 11:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26  8:45 Double-precision floating point arithmetics behaves differently in Guile and in C Panicz Maciej Godek
2021-09-26 11:55 ` Panicz Maciej Godek [this message]
2021-09-26 13:16   ` Eli Zaretskii
2021-09-26 16:48     ` Panicz Maciej Godek
2021-09-26 12:57 ` tomas
2021-09-26 19:11 ` Matt Wette
2021-09-27 14:04   ` Panicz Maciej Godek
2021-10-16  9:19     ` Maxime Devos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMFYt2bV69zBtojZ819G102GG_EkK0PmfX0Pg-nApMN808mBVA@mail.gmail.com \
    --to=godek.maciek@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).