[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/osc 8d2b124 3/8: Improve single precision floating poin
From: |
Stefan Monnier |
Subject: |
[elpa] externals/osc 8d2b124 3/8: Improve single precision floating point serialisation |
Date: |
Tue, 1 Dec 2020 18:00:15 -0500 (EST) |
branch: externals/osc
commit 8d2b12496602c233f8796ece694044d71b5f4f16
Author: Mario Lang <mlang@blind.guru>
Commit: Mario Lang <mlang@blind.guru>
Improve single precision floating point serialisation
* packages/osc/osc.el: Update copyright years and author email.
* (osc-insert-float32): Use `copysign' and `isnan'.
---
osc.el | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/osc.el b/osc.el
index 9f92b17..316b532 100644
--- a/osc.el
+++ b/osc.el
@@ -1,8 +1,8 @@
;;; osc.el --- Open Sound Control protocol library
-;; Copyright (C) 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
-;; Author: Mario Lang <mlang@delysid.org>
+;; Author: Mario Lang <mlang@blind.guru>
;; Version: 0.1
;; Keywords: comm, processes, multimedia
@@ -57,15 +57,13 @@
(defun osc-insert-float32 (value)
(let (s (e 0) f)
(cond
- ((string= (format "%f" value) (format "%f" -0.0))
- (setq s 1 f 0))
- ((string= (format "%f" value) (format "%f" 0.0))
- (setq s 0 f 0))
+ ((= value 0.0)
+ (setq s (if (< (copysign 1.0 value) 0) 1 0) f 0))
((= value 1.0e+INF)
(setq s 0 e 255 f (1- (expt 2 23))))
((= value -1.0e+INF)
(setq s 1 e 255 f (1- (expt 2 23))))
- ((string= (format "%f" value) (format "%f" 0.0e+NaN))
+ ((isnan value)
(setq s 0 e 255 f 1))
(t
(setq s (if (>= value 0.0)
- [elpa] branch externals/osc created (now b927860), Stefan Monnier, 2020/12/01
- [elpa] externals/osc 869841d 1/8: Add osc.el., Stefan Monnier, 2020/12/01
- [elpa] externals/osc 4652f37 7/8: * packages/osc/osc.el: Enable lexical-binding, Stefan Monnier, 2020/12/01
- [elpa] externals/osc 4b28a3c 4/8: Concatenate messages instead of using a temp-buffer and buffer-string, Stefan Monnier, 2020/12/01
- [elpa] externals/osc 8d2b124 3/8: Improve single precision floating point serialisation,
Stefan Monnier <=
- [elpa] externals/osc 1a81753 5/8: Support for binary blobs, Stefan Monnier, 2020/12/01
- [elpa] externals/osc 092b443 6/8: Release version 0.2, Stefan Monnier, 2020/12/01
- [elpa] externals/osc 970f417 2/8: * packages/osc/osc.el (osc-filter): Fix up old `cl' name., Stefan Monnier, 2020/12/01
- [elpa] externals/osc b927860 8/8: * .gitignore: New file, Stefan Monnier, 2020/12/01