Hi Ross,
Thank you very much for your concise advices and references,
I remembered or recognized that there were such things in the computer world,
then I have been reading some documents about such theme because it
is necessary for me to know something more before reading references
you wrote.
>> Now back to computers, IEEE 754 floating point arithmetic[1], which uses
>> a fixed number of binary digits for its representaion (typically 32 or
>> 64 bits per number), can not precisely represent all rational numbers
>> one thing that's confusing you because it confuses
>> everyone when they start to deal with non-integer numbers in a computer.
>> What you're observing is analogous to using a finite number of decimal
>> digits (decimal "fixed point").
Yes, I remembered what you pointed out, though not so exact things, of course,
when I found these....
(inexact->exact (modulo 61.2 12.0 )) ;inexact->exact: not integral: 1.20000000000000284217094
(inexact->exact 1.2);inexact->exact: not integral: 1.19999999999999995559108
You wtote these ....
>> 3(1/3) = 3(0.333) = 0.999 != 1
>> and this should not be surprising.
Yes, I think it is not surprising at all because I remembered
somehow about the computer numerical calculation/operation....
maybe, just even the operation order makes differences of the results, too ...
due to rounding etc, error and precision etc, binary and decimal etc ....
round to even .......
but I found these .. now, some of these examples are surprising
and interesting for me after remembering/knowing something like
above, that is, limitation/errors of computation,
(/ 1 3) ; 1/3
(* (/ 1 3) 3) ;1/1
(/ 1.0 3.0) ;0.333333
(* 3 (/ 1.0 3.0)) ;1.000000 wow!
(* 3.0 (/ 1.0 3.0)) ;1.000000 wow!
(= (* 3 (/ 1.0 3.0)) 1.0) ;t !
(= (* 3.0 (/ 1.0 3.0)) 1.0) ;t !
(* 3 1/3) ;1/1
(= (* 3 1/3) 1) ;t
(= (* 3 1/3) 1.) ;t
(= (* 3. 1/3) 1.) ;t
(= (* 3. 0.333) 1.) ;f
(= (* 3. 0.33333333333333333333333333333333) 1.) ;t wow !
(* 3. 0.33333333333333333333333333333333) ;1.000000 wow !!!
(= (* 3. 0.333333333333333) 1.) ;f
(* 3. 0.333333333333333) ;1.000000 ????
(= (* 3. 0.3333333333333333) 1.) ;t, oh this seems critical line ....
(* 3. 0.3333333333333333) ;1.000000 !
maybe this number of digit indicates something important ???
changing binary floating point to decimal one ???
just a shot in the dark .... maybe no relations ????
(* 3. 0.333) ;0.999999
(* 3. 0.333333) ;0.999999
(* 3. 0.3333333) ;1.000000
but, of course ....
(= (* 3. 0.3333333) 1.0) ;f
(= (/ 1. 3.) (/ 1 3)) ;t
(= (/ 1. 3.) 1/3) ;t
and
(= 0.1 (+ 0.1 0.0)); t
(= 0.2 (+ 0.1 0.1)); t
(= 0.3 (+ 0.1 0.1 0.1)) ;f
(inexact->exact 0.1);inexact->exact: not integral: 0.10000000000000000555112
(+ 0.10000000000000000555112 0.10000000000000000555112 ) ;0.2000000
(= 0.2 (+ 0.10000000000000000555112 0.10000000000000000555112 )) ;t
(+ 0.10000000000000000555112 0.10000000000000000555112 0.10000000000000000555112) ;0.3000000
(= 0.3 (+ 0.10000000000000000555112 0.10000000000000000555112 0.10000000000000000555112)) ;f
(= 0.10000000000000000555112 0.10000000000000000555112) ;t
(= 0.10000000000000000 0.10000000000000000555112) ;t
(= 0.1 0.10000000000000000555112) ;t
(= 0.3 (+ 0.1 0.1 0.1)) ;f
(= (* 0.10000000000000000555112 3)
(+ 0.10000000000000000555112 0.10000000000000000555112 0.10000000000000000555112)) ;t
(= (* 0.1 3.0)
(+ 0.10000000000000000555112 0.10000000000000000555112 0.10000000000000000555112)) ;t
(= (* 0.1 3.0) (+ 0.1 0.1 0.1)) ; t
(= 0.3 (+ 0.1 0.1 0.1)) ;f
(= (* 1.0 0.3) (+ 0.1 0.1 0.1)) ;f
(= (* 0.1 3.0) (+ 0.1 0.1 0.1)) ;t
(= 3/10 (+ 1/10 1/10 1/10)) ;t
(+ 1/10 1/10 1/10) ; 3/10
1/10 ;1/10
(= .3 (+ 1/10 1/10 1/10)) ;t
(= .300000000000000002 (+ 1/10 1/10 1/10)) ;t
maybe, due to binary <--> decimal, finite number of digits,
significand, nomalization etc etc ....
and finally, it depends on how extempore implements those .....
I don't understand them so completely, but maybe grasp the gist
and the the consequences .... the variety of them ...
therefore, I will return to my routin work now,
making the music by this extempore with these knowledges .....
Ross, I appreciate your advices very much, thank you again.
2023年2月18日土曜日 15:10:17 UTC+9 Ross Bencina: