Re: scheme math
Dominik Pantůček via Chicken-users <[email protected]> Tue, 2 Dec 2025 21:08:57 +0100
| Newsgroups | gmane.lisp.scheme.chicken |
|---|---|
| Message-ID | <[email protected]> |
Hi, just use the right one: #;3> (define (F->C fahr) (inexact->exact (truncate (* 0.5556 (- fahr 32))))) #;4> (F->C 29) -1 Cheers, Dominik On 12/2/25 21:04, Duke Normandin via Chicken-users wrote: > On Tue, 02 Dec 2025 20:59:31 +0100 > Mario Domenech Goulart <[email protected]> wrote: > >> Hi, >> >> On Tue, 2 Dec 2025 12:16:11 -0700 Duke Normandin via >> Chicken-users <[email protected]> wrote: >> >>> I have a function that sometimes returns a negative real number, >>> like "-2.0" or "-2.65" >>> For both negative and positive returned numbers, I want to >>> remove the decimal portion and return only the quotient and the >>> sign. >>> >>> I've tried `floor", 'flonum->inexact", and the list goes on, but >>> with no success. >>> >>> I'm NOT a mathematician or even very strong in arithmetic. LOL >>> So I'm asking for a possible solution. TIA ... >> >> You can use something like (inexact->exact (round the-number)). > > Thx Mario ... > >> (define (F->C fahr) > (exact->inexact (round (* 0.5556 (- fahr 32))))) >> (F->C 29) > -2.0 >