Changeset 8596 in project
- Timestamp:
- 02/20/08 23:30:53 (12 years ago)
- Location:
- release/3/mathh/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
release/3/mathh/trunk/doc.scm
r8595 r8596 232 232 "violates R6RS.") 233 233 234 (procedure "(fixnum->string FX [RADIX])"235 (p "") )236 237 234 (procedure "(fixnum-width)" 238 235 (p "") ) -
release/3/mathh/trunk/fixnum-extras.scm
r8595 r8596 9 9 (no-procedure-checks-for-usual-bindings) 10 10 (bound-to-procedure 11 ##sys#signal-hook 12 ##sys#make-string 13 ##sys#string-append ) 11 ##sys#signal-hook ) 14 12 (export 15 fixnum->string16 13 fixnum-width 17 14 least-fixnum … … 515 512 ;;; 516 513 517 (define fixnum->string518 (let ([digits "0123456789ABCDEF"])519 (lambda (fx #!optional (radix 10))520 (letrec ([fx-digits521 (lambda (fx from to)522 (if (##core#inline "C_eqp" 0 fx)523 (values (##sys#make-string from)524 to)525 (let* ([quo526 (##core#inline "C_fixnum_divide" fx radix)]527 [digit528 (##core#inline "C_i_string_ref"529 digits530 (##core#inline "C_fixnum_difference"531 fx532 (##core#inline "C_fixnum_times" quo radix)))])533 (let-values ([(str to)534 (fx-digits535 quo536 (##core#inline "C_fixnum_plus" from 1)537 to)])538 (##core#inline "C_i_string_set" str to digit)539 (values str540 (##core#inline "C_fixnum_plus" to 1)) ) ) ) ) ]541 [fx->str542 (lambda (fx)543 (cond [(##core#inline "C_eqp" 0 fx)544 (##sys#make-string 1 #\0)]545 [(##core#inline "C_fixnum_lessp" 0 fx)546 (let ([str (fx-digits fx 0 0)])547 (noop str)548 str ) ]549 [(##core#inline "C_eqp" most-negative-fixnum fx)550 (##sys#string-append551 (fx->str (##core#inline "C_fixnum_divide" fx radix))552 (fx->str (##core#inline "C_fixnum_difference"553 radix554 (##core#inline "C_fixnum_modulo" fx radix))))]555 [else556 (let ([str (fx-digits (##core#inline "C_fixnum_negate" fx) 1 1)])557 (##core#inline "C_i_string_set" str 0 #\-)558 str ) ] ) ) ] )559 ;560 (check-fixnum 'fixnum->string fx)561 (case radix562 [(2 8 10 16)563 (fx->str fx)]564 [else565 (##sys#signal-hook #:type-error 'fixnum->string566 "bad argument type - invalid radix" radix) ] ) ) ) ) )567 568 ;;;569 570 514 (define (fxif mask true false) 571 515 (check-fixnum 'fxif mask)
Note: See TracChangeset
for help on using the changeset viewer.