[r6rs-discuss] [Formal] wrong sign function definition

From: Stanislav Ievlev <inger>
Date: Mon Sep 25 05:01:01 2006

Submitter: Stanislav Ievlev
Email address: inger_at_altlinux.org
Issue type: Defect
Priority: Trivial
Component: R5RS Compatibility
Report version: 5.91
Summary: Typo in definition of the sign function.

Function sign should be:
(define (sign n)
  (cond
     ((negative? n) -1)
     ((positive? n) 1)
     (else 0)))

Previous definition returns zero on negative numbers.
Received on Mon Sep 25 2006 - 02:42:33 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC