Hickerson series of almost integers: Difference between revisions

Content added Content deleted
m (corrected a misspelling.)
m (replaced backtick constants with proper literals (e.g. `(/ 1.0 10) to 0.1))
Line 1,432: Line 1,432:
PicoLisp does not have floating point, but does have library functions to make fixed-point math easier. I use a scale factor of 25 to ensure that there is enough precision.
PicoLisp does not have floating point, but does have library functions to make fixed-point math easier. I use a scale factor of 25 to ensure that there is enough precision.
<lang PicoLisp>
<lang PicoLisp>
(load "@lib/misc.l")

(scl 25)

(load "@lib/misc.l")
(load "@lib/misc.l")


Line 1,439: Line 1,443:


(de almost-int? (N)
(de almost-int? (N)
(bool (member (% (/ N `(/ 1.0 10)) 10) (0 9))))
(bool (member (% (/ N 0.1) 10) (0 9))))


(de fmt4 (N)
(de fmt4 (N)
(format (/ N `(/ 1.0 10000)) 4))
(format (/ N 0.0001) 4))


(de h (N)
(de h (N)
Line 1,490: Line 1,494:
no: h(18) = 3385534663256845326.3904
no: h(18) = 3385534663256845326.3904
</pre>
</pre>

=={{header|PL/I}}==
=={{header|PL/I}}==
<lang pli>Hickerson: procedure options (main); /* 12 January 2014 */
<lang pli>Hickerson: procedure options (main); /* 12 January 2014 */