• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/obsolete/

Lines Matching +defs:string +defs:to +defs:int

23 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
34 ;; range of -(2**23) to +(2**23)-1, or -8388608 to 8388607 decimal.
36 ;; be anything in the range -(2**23) to +(2**23)-1.
39 ;; function f converts from integer to floating point
40 ;; function string-to-float converts from string to floating point
41 ;; function fint converts a floating point to integer (with truncation)
42 ;; function float-to-string converts from floating point to string
46 ;; functions (especially conversion routines) to take forever.
66 "Number of decimal digits expected to be accurate.")
85 "Regular expression to match floating point numbers. Extract matches:
127 (if (> (car fnum) 0) ; make sure next-to-highest bit is set
148 (defun extract-match (str i) ; used after string-match
173 (setq f1 (fashr f1) ; shift right to avoid overflow
206 (signal 'arith-error (list "attempt to divide by zero" a1 a2))
248 "Returns t if first floating point number is greater than or equal to
258 "Returns t if first floating point number is less than or equal to
263 "Returns t if first floating point number is not equal to second,
284 (defun f (int)
285 "Convert the integer argument to floating point, like a C cast operator."
286 (normalize (cons int '0)))
288 (defun int-to-hex-string (int)
289 "Convert the integer argument to a C-style hexadecimal string."
294 (setq str (concat str (char-to-string
296 (logand (lsh int shiftval) 15))))
314 (defun fint (fnum) ; truncate and convert to integer
315 "Convert the floating point number to integer, with truncation,
325 (defun float-to-string (fnum &optional sci)
326 "Convert the floating point number to a decimal string.
349 ; get value in range 100000 to 999999
352 (let (int)
354 (setq int (1+ (fint result)))
355 (setq int (fint result)))
356 (setq str (int-to-string int))
357 (if (>= int 1000000)
362 "E" (int-to-string power)))
364 ; regular decimal string
391 ;; string to float conversion.
394 (defun string-to-float (str)
395 "Convert the string to a floating point number.
396 Accepts a decimal string in scientific notation, with exponent preceded
402 (if (string-match floating-point-regexp str 0)
406 (let* ((int-subst (extract-match str 2))
408 (digit-string (concat int-subst fract-subst))
413 (setq power (- (length int-subst) decimal-digits))
414 (while (and (< leading-0s (length digit-string))
415 (= (aref digit-string leading-0s) ?0))
418 digit-string (substring digit-string leading-0s))
421 (if (> (length digit-string) decimal-digits)
422 (setq round-up (>= (aref digit-string decimal-digits) ?5)
423 digit-string (substring digit-string 0 decimal-digits))
424 (setq power (+ power (- decimal-digits (length digit-string)))))
427 (f (* (+ (string-to-number digit-string)
437 (setq expt (+ (* (string-to-number
444 func 'f/)) ; and set up to divide, not multiply