remove extflonums for compatibility with Racket CS (#3)

master
Matthew Butterick 2 years ago committed by GitHub
parent 4eab8a2e65
commit e694813d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      describe/describe-test.rkt
  2. 27
      describe/float-test-extended.rkt
  3. 15
      describe/main.rkt
  4. 4
      describe/scribblings/describe.scrbl

@ -47,15 +47,14 @@
(describe 0.0)
(describe 0.1e0)
(describe 0.1f0)
(describe 0.1t0)
(describe (* (! 10) 1.0))
(describe 6.0221313e23)
(describe 6.0221313f23)
(describe 6.0221313t23)
(describe (exact->inexact (! 40)))
(describe (sqrt 10))
(describe (sqrt -10))
(describe (+ (sqrt 10) (sqrt -10)))
;; no good in Racket CS, for whatever reason
;;(describe (sqrt -10))
;;(describe (+ (sqrt 10) (sqrt -10)))
;;; Strings

@ -1,27 +0,0 @@
#lang racket/base
(require racket/extflonum
"main.rkt")
(printf "--- Using literals (extended precision) ---~n")
(describe 0.1t0)
(describe 0.2t0)
(describe 0.3t0)
(describe 0.4t0)
(describe 0.5t0)
(describe 0.6t0)
(describe 0.7t0)
(describe 0.8t0)
(describe 0.9t0)
(describe 1.0t0)
(printf "--- Using summation (extended precision) ---~n")
(for/fold ((sum 0.0t0))
((i (in-range 10)))
(define new-sum (extfl+ sum 0.1t0))
(describe new-sum)
new-sum)
(printf "--- Using product (single precision) ---~n")
(for ((i (in-range 1 11)))
(describe (extfl* (->extfl i) 0.1t0)))

@ -71,7 +71,6 @@
;;; 2.0.1 09/26/13 Added bigfloat support to float->string. (MDW)
(require racket/contract/base
racket/extflonum
racket/math
racket/mpair)
@ -307,7 +306,7 @@
(format "~s is an exact number" z))))
;;; (float->string x) -> string?
;;; x : (or/c flonum? single-flonum? extflonum? bigfloat?)
;;; x : (or/c flonum? single-flonum? bigfloat?)
;;; Returns a string with the exact decimal representation of x. This is only
;;; guaranteed for floats - single, double, or extended precision, which are
;;; never repeating decimals.
@ -403,6 +402,16 @@
(else
(format "~s is a number" z))))
;;; 201223 Racket CS update
;;; Racket CS does not support extflonums
;;; so we remove racket/extflonum from dependencies
;;; and make the extflonum functions into no-ops
(define (extflonum? x) #false)
(define (extfl< . xs) #false)
(define (extfl> . xs) #false)
(define (extfl->exact x) 0)
;;; (extflonum-description x) -> string
;;; x : extflonum?
;;; Returns a string describing the extended precision floating point number, x.
@ -843,7 +852,7 @@
(integer->string
(-> exact-integer? string?))
(float->string
(-> (or/c flonum? single-flonum? extflonum?) string?))
(-> (or/c flonum? single-flonum?) string?))
(description
(-> any/c string?))
(describe

@ -14,7 +14,7 @@
This library provides functions to describe Racket objects. Currently, the following types of objects are described:
@margin-note{This is not the official version of Describe. It is the 1.5 version from PLaneT, retooled to use Racket's new package system, and with bigfloat support disabled (because of bugs related to v.5.3.x compatability.) The canonical version of Describe is on the @link["http://planet.racket-lang.org/display.ss?package=describe.plt&owner=williams" "PLaneT server"]. — MB}
@margin-note{This is not the official version of Describe. It is the 1.5 version from PLaneT, retooled to use Racket's current package system, but with bigfloats disabled (because of incompatibility with v.5.3) and extflonums disabled (because of incompatibility with Racket CS). Under Racket CS, I've found that complex numbers with inexact coefficients for the imaginary part also seem to crash. Maybe stay away from those. The canonical version of Describe is on the @link["http://planet.racket-lang.org/display.ss?package=describe.plt&owner=williams" "PLaneT server"]. — MB}
@itemize{
@item{Booleans}
@ -80,7 +80,7 @@ Examples:
@scheme[(integer->string (expt 10 150))] -> "at least 10^102"
@defproc[(float->string (x (or/c flonum? single-flonum? extflonum?))) string?]{
@defproc[(float->string (x (or/c flonum? single-flonum?))) string?]{
Returns a string with the exact decimal value of the floating-point number @scheme[x]. This works for single precision, double precision, and extended precision values. Note that internally @scheme[x] is converted to an exact rational number as part of converting to a string.}
Examples:

Loading…
Cancel
Save