emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Slashes inserted into Common Lisp code evaluation results
@ 2023-05-02  6:18 Nathan Van Ymeren
  2023-05-02 10:52 ` gerard.vermeulen
  0 siblings, 1 reply; 5+ messages in thread
From: Nathan Van Ymeren @ 2023-05-02  6:18 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

For my studies I’ve been using org as a superior form of jupyter notebook, and I do my assignments and whatnot using code blocks for computation.  My preferred language these days is Common Lisp, using the SBCL implementation.  Whereas languages like python default to using IEEE double-width floats, in Common Lisp the default type for a value like “1.0872” is a single-width float which sometimes introduces precision errors when computing many decimal places.

In Common Lisp (and probably in elisp too, but I don’t speak that dialect so idk) you can specify that a number should use double-precision floats by appending “d0” to the end, so for example 1.0872d0.

Here’s my problem:

When I specify double width floats, they appear with slashes embedded in the RESULTS blocks, like so:

#+begin_src lisp
  (+ 1 0.0002d0)
#+end_src

#+RESULTS:
: 1\.0002d0

Compare that to a single-precision float:

#+begin_src lisp
  (+ 1 0.0002)
#+end_src

#+RESULTS:
: 1.0002

What I’d like to make clear at this point is that *this is not how things look in the lisp interpreter*.  For example here’s a transcript of me doing this same thing, but not in org:

CL-USER> (+ 1 0.0002d0)
1.0002d0 (100.02d0%)

CL-USER> (+ 1 0.0002)
1.0002 (100.020004%)
CL-USER> 

You can see there’s no slash being emitted, so something in the plumbing between SBCL and org is inserting the slash.  I’m running org version 9.7_pre built from straight.el on an M-series MacBook Pro, though the same behaviour was present in the 9.x release I upgraded from.

Is this a bug?  If not, how do I suppress this behaviour?

Nate

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-03  7:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-02  6:18 Slashes inserted into Common Lisp code evaluation results Nathan Van Ymeren
2023-05-02 10:52 ` gerard.vermeulen
2023-05-03  6:00   ` Nathan Van Ymeren
2023-05-03  7:14     ` gerard.vermeulen
2023-05-03  7:45       ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).