P ossible Alternatives β’ Exhaustive testing β’ feasible for 32-bit float: ~ 30 seconds (with 1 core for sinf ) β’ infeasible for 64-bit double: > 4000 years ( = 30 seconds Γ 2 32 ) β’ infeasible even for input range X = β1, 1 1 β΅ (# of doubles between β1 and 1 ) = 2 (# of all doubles) β’ Machine-checkable proofs β’ Harrison used transcendental functions are very accurate [ ] β’ construction of these proofs often requires considerable persistence 24
P ossible Alternatives β’ Exhaustive testing β’ feasible for 32-bit float: ~ 30 seconds (with 1 core for sinf ) β’ infeasible for 64-bit double: > 4000 years ( = 30 seconds Γ 2 32 ) β’ infeasible even for input range X = β1, 1 1 β΅ (# of doubles between β1 and 1 ) = 2 (# of all doubles) β’ Machine-checkable proofs β’ Harrison used transcendental functions are very accurate [ ] β’ construction of these proofs often requires considerable persistence 25
P ossible Alternatives β’ Exhaustive testing β’ feasible for 32-bit float: ~ 30 seconds (with 1 core for sinf ) β’ infeasible for 64-bit double: > 4000 years ( = 30 seconds Γ 2 32 ) β’ infeasible even for input range X = β1, 1 1 β΅ (# of doubles between β1 and 1 ) = 2 (# of all doubles) β’ Machine-checkable proofs β’ Harrison used transcendental functions are very accurate [ ] β’ construction of these proofs often requires considerable persistence 26
P ossible Alternatives β’ Exhaustive testing β’ feasible for 32-bit float: ~ 30 seconds (with 1 core for sinf ) β’ infeasible for 64-bit double: > 4000 years ( = 30 seconds Γ 2 32 ) β’ infeasible even for input range X = β1, 1 1 β΅ (# of doubles between β1 and 1 ) = 2 (# of all doubles) β’ Machine-checkable proofs β’ Harrison used transcendental functions are very accurate [ ] β’ construction of these proofs often requires considerable persistence. 27
P ossible Automatic Alternatives β’ If only floating-point operations are used, various automatic techniques can be applied β’ e.g., Astree , Fluctuat , ROSA , FPTaylor β’ Several commercial tools (e.g., Astree, Fluctuat) can handle certain bit-trick routines β’ We are unaware of a general technique for verifying mixed floating-point and bit-level code 28
P ossible Automatic Alternatives β’ If only floating-point operations are used, various automatic techniques can be applied β’ e.g., Astree , Fluctuat , ROSA , FPTaylor β’ Several commercial tools (e.g., Astree, Fluctuat) can handle certain bit-trick routines β’ We are unaware of a general technique for verifying mixed floating-point and bit-level code 29
Our Method 30
π π¦ Explained 1 vmovddup %xmm0, %xmm0 2 vmulpd L2E, %xmm0, %xmm2 3 vroundpd $0, %xmm2, %xmm2 4 vcvtpd2dqx %xmm2, %xmm3 5 vpaddd B, %xmm3, %xmm3 6 vpslld $20, %xmm3, %xmm3 7 vpshufd $114, %xmm3, %xmm3 8 vmulpd C1, %xmm2, %xmm1 9 vmulpd C2, %xmm2, %xmm2 10 vaddpd %xmm1, %xmm0, %xmm1 11 vaddpd %xmm2, %xmm1, %xmm1 12 vmovapd T1, %xmm0 13 vmulpd T12, %xmm1, %xmm2 14 vaddpd T11, %xmm2, %xmm2 ... 36 vaddpd %xmm0, %xmm1, %xmm0 37 vmulpd %xmm3, %xmm0, %xmm0 38 retq 31
π π¦ Explained π¦ 1 vmovddup %xmm0, %xmm0 2 vmulpd L2E, %xmm0, %xmm2 π = round π¦ β log 2 π 3 vroundpd $0, %xmm2, %xmm2 4 vcvtpd2dqx %xmm2, %xmm3 5 vpaddd B, %xmm3, %xmm3 6 vpslld $20, %xmm3, %xmm3 7 vpshufd $114, %xmm3, %xmm3 8 vmulpd C1, %xmm2, %xmm1 9 vmulpd C2, %xmm2, %xmm2 10 vaddpd %xmm1, %xmm0, %xmm1 11 vaddpd %xmm2, %xmm1, %xmm1 12 vmovapd T1, %xmm0 13 vmulpd T12, %xmm1, %xmm2 14 vaddpd T11, %xmm2, %xmm2 ... 36 vaddpd %xmm0, %xmm1, %xmm0 37 vmulpd %xmm3, %xmm0, %xmm0 38 retq 32
π π¦ Explained π¦ 1 vmovddup %xmm0, %xmm0 2 vmulpd L2E, %xmm0, %xmm2 π = round π¦ β log 2 π 3 vroundpd $0, %xmm2, %xmm2 4 vcvtpd2dqx %xmm2, %xmm3 5 vpaddd B, %xmm3, %xmm3 2 π 6 vpslld $20, %xmm3, %xmm3 7 vpshufd $114, %xmm3, %xmm3 8 vmulpd C1, %xmm2, %xmm1 9 vmulpd C2, %xmm2, %xmm2 10 vaddpd %xmm1, %xmm0, %xmm1 11 vaddpd %xmm2, %xmm1, %xmm1 12 vmovapd T1, %xmm0 13 vmulpd T12, %xmm1, %xmm2 14 vaddpd T11, %xmm2, %xmm2 ... 36 vaddpd %xmm0, %xmm1, %xmm0 37 vmulpd %xmm3, %xmm0, %xmm0 38 retq 33
π π¦ Explained π¦ 1 vmovddup %xmm0, %xmm0 2 vmulpd L2E, %xmm0, %xmm2 π = round π¦ β log 2 π 3 vroundpd $0, %xmm2, %xmm2 4 vcvtpd2dqx %xmm2, %xmm3 5 vpaddd B, %xmm3, %xmm3 2 π 6 vpslld $20, %xmm3, %xmm3 7 vpshufd $114, %xmm3, %xmm3 8 vmulpd C1, %xmm2, %xmm1 9 vmulpd C2, %xmm2, %xmm2 π = π¦ β π β ln 2 10 vaddpd %xmm1, %xmm0, %xmm1 11 vaddpd %xmm2, %xmm1, %xmm1 12 vmovapd T1, %xmm0 12 π π 13 vmulpd T12, %xmm1, %xmm2 π π β ΰ· 14 vaddpd T11, %xmm2, %xmm2 π! ... π=0 36 vaddpd %xmm0, %xmm1, %xmm0 37 vmulpd %xmm3, %xmm0, %xmm0 π π¦ = π πβln 2 β π π β 2 π β π π 38 retq 34
π π¦ Explained π¦ 1 vmovddup %xmm0, %xmm0 2 vmulpd L2E, %xmm0, %xmm2 π = round π¦ β log 2 π 3 vroundpd $0, %xmm2, %xmm2 4 vcvtpd2dqx %xmm2, %xmm3 5 vpaddd B, %xmm3, %xmm3 2 π 6 vpslld $20, %xmm3, %xmm3 7 vpshufd $114, %xmm3, %xmm3 8 vmulpd C1, %xmm2, %xmm1 9 vmulpd C2, %xmm2, %xmm2 π = π¦ β π β ln 2 10 vaddpd %xmm1, %xmm0, %xmm1 11 vaddpd %xmm2, %xmm1, %xmm1 12 vmovapd T1, %xmm0 12 π π 13 vmulpd T12, %xmm1, %xmm2 π π β ΰ· 14 vaddpd T11, %xmm2, %xmm2 π! ... π=0 36 vaddpd %xmm0, %xmm1, %xmm0 37 vmulpd %xmm3, %xmm0, %xmm0 π π¦ = π πβln 2 β π π β 2 π β π π 38 retq Find a small Ξ > 0 such that Goal: π π¦ β2 π π π β€ Ξ for all π¦ β π π π¦ 35
1) Abstract Floating-P oint Operations β’ Assume only floating-point operations are used β’ 1 + π property β’ A standard way to model rounding errors β’ For 64-bit doubles, π = 2 β53 β’ This property has been used in previous automatic techniques (FPTaylor -point programs 36
1) Abstract Floating-P oint Operations β’ Assume only floating-point operations are used β’ 1 + π property β’ A standard way to model rounding errors β’ For 64-bit doubles, π = 2 β53 β’ This property has been used in previous automatic techniques (FPTaylor -point programs 37
1) Abstract Floating-P oint Operations β’ Assume only floating-point operations are used β’ 1 + π property β’ A standard way to model rounding errors π¦ β¨ f π§ β π¦β¨π§ 1 + π βΆ π < π β’ For 64-bit doubles, π = 2 β53 β’ This property has been used in previous automatic techniques (FPTaylor -point programs 38
1) Abstract Floating-P oint Operations β’ Assume only floating-point operations are used β’ 1 + π property β’ A standard way to model rounding errors π¦ β¨ f π§ β π¦β¨π§ 1 + π βΆ π < π 0 1 π¦β¨π§ β’ For 64-bit doubles, π = 2 β53 β’ This property has been used in previous automatic techniques (FPTaylor -point programs 39
1) Abstract Floating-P oint Operations β’ Assume only floating-point operations are used β’ 1 + π property β’ A standard way to model rounding errors π¦ β¨ f π§ β π¦β¨π§ 1 + π βΆ π < π 0 1 π¦β¨π§ β’ For 64-bit doubles, π = 2 β53 β’ This property has been used in previous automatic techniques (FPTaylor -point programs 40
1) Abstract Floating-P oint Operations β’ Assume only floating-point operations are used β’ 1 + π property β’ A standard way to model rounding errors π¦ β¨ f π§ β π¦β¨π§ 1 + π βΆ π < π 0 1 π¦β¨π§ π¦ β¨ f π§ β’ For 64-bit doubles, π = 2 β53 β’ This property has been used in previous automatic techniques (FPTaylor -point programs 41
1) Abstract Floating-P oint Operations β’ Assume only floating-point operations are used β’ 1 + π property β’ A standard way to model rounding errors π¦ β¨ f π§ β π¦β¨π§ 1 + π βΆ π < π π 0 1 π¦β¨π§ π¦ β¨ f π§ β’ For 64-bit doubles, π = 2 β53 β’ This property has been used in previous automatic techniques (FPTaylor -point programs 42
1) Abstract Floating-P oint Operations β’ Assume only floating-point operations are used β’ 1 + π property β’ A standard way to model rounding errors π¦ β¨ f π§ β π¦β¨π§ 1 + π βΆ π < π π 0 1 π¦β¨π§ π¦ β¨ f π§ β’ For 64-bit doubles, π = 2 β53 β’ This property has been used in previous automatic techniques (FPTaylor -point programs 43
1) Abstract Floating-P oint Operations β’ Compute a symbolic abstraction π΅ π π¦ of a program π β’ Example: β’ F π΅ π π¦ satisfies rom 1 + π property, π π¦ β π΅ π π¦ βΆ π π < π for all π¦ β’ Example: 44
1) Abstract Floating-P oint Operations β’ Compute a symbolic abstraction π΅ π π¦ of a program π β’ Example: π π¦ = 2 Γ f π¦ 1 + π 1 + f 3 1 + π 2 β’ F π΅ π π¦ satisfies rom 1 + π property, π π¦ β π΅ π π¦ βΆ π π < π for all π¦ β’ Example: 45
1) Abstract Floating-P oint Operations β’ Compute a symbolic abstraction π΅ π π¦ of a program π β’ Example: π΅ π π¦ π π¦ = 2 Γ f π¦ 1 + π 1 + f 3 1 + π 2 β’ F π΅ π π¦ satisfies rom 1 + π property, π π¦ β π΅ π π¦ βΆ π π < π for all π¦ β’ Example: 46
1) Abstract Floating-P oint Operations β’ Compute a symbolic abstraction π΅ π π¦ of a program π β’ Example: π΅ π π¦ π π¦ = 2 Γ f π¦ Γ 1 + π 1 + f 3 + 1 + π 2 β’ F π΅ π π¦ satisfies rom 1 + π property, π π¦ β π΅ π π¦ βΆ π π < π for all π¦ β’ Example: 47
1) Abstract Floating-P oint Operations β’ Compute a symbolic abstraction π΅ π π¦ of a program π β’ Example: π΅ π π¦ π π¦ = 2 Γ f π¦ Γ 1 + π 1 + f 3 + 1 + π 2 β’ F π΅ π π¦ satisfies rom 1 + π property, π π¦ β π΅ π π¦ βΆ π π < π for all π¦ β’ Example: 48
1) Abstract Floating-P oint Operations β’ Compute a symbolic abstraction π΅ π π¦ of a program π β’ Example: π΅ π π¦ π π¦ = 2 Γ f π¦ Γ 1 + π 1 + f 3 + 1 + π 2 β’ F π΅ π π¦ satisfies rom 1 + π property, π π¦ β π΅ π π¦ βΆ π π < π for all π¦ β’ Example: 49
1) Abstract Floating-P oint Operations β’ Compute a symbolic abstraction π΅ π π¦ of a program π β’ Example: π΅ π π¦ π π¦ = 2 Γ f π¦ Γ 1 + π 1 + f 3 + 1 + π 2 β’ F π΅ π π¦ satisfies rom 1 + π property, π π¦ β π΅ π π¦ βΆ π π < π for all π¦ β’ Example: π π¦ = 2 Γ f π¦ 1 + π 1 + f 3 1 + π 2 βΆ π 1 , π 2 < π 50
1) Abstract Floating-P oint Operations β’ Compute a symbolic abstraction π΅ π π¦ of a program π β’ Example: π΅ π π¦ π π¦ = 2 Γ f π¦ Γ 1 + π 1 + + f 3 1 + π 2 β’ F π΅ π π¦ satisfies rom 1 + π property, π π¦ β π΅ π π¦ βΆ π π < π for all π¦ β’ Example: { } π π¦ = 2 Γ f π¦ Γ 1 + π 1 + f 3 + 1 + π 2 βΆ π 1 , π 2 < π 51
1) Abstract Floating-P oint Operations β’ Compute a symbolic abstraction π΅ π π¦ of a program π β’ Example: π΅ π π¦ π π¦ = 2 Γ f π¦ Γ 1 + π 1 + + f 3 1 + π 2 β’ F π΅ π π¦ satisfies rom 1 + π property, π π¦ β π΅ π π¦ βΆ π π < π for all π¦ β’ Example: { } π π¦ = β 2 Γ f π¦ Γ 1 + π 1 + f 3 + 1 + π 2 βΆ π 1 , π 2 < π 52
Our Method: Overview π(π¦) β1 1 π ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 53
Our Method: Overview π(π¦) β1 1 π ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 54
Our Method: Overview π(π¦) β1 1 π ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 55
Our Method: Overview π(π¦) hard to find β1 1 π ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... 56
Our Method: Overview π(π¦) hard to find β1 1 π n ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... abstract using 57
Our Method: Overview π(π¦) hard to find β1 1 π π½ 1 π½ 2 π½ π n ... vpslld $20, ... vpshufd $114, ... vmulpd C1, ... vmulpd C2, ... ... abstract using 58
Our Method: Overview π(π¦) hard to find β1 1 π π½ 1 π½ 2 π½ π n ... ... vpslld $20, ... vpslld $20, ... vpshufd $114, ... vpshufd $114, ... vmulpd C1, ... vmulpd C1, ... ... vmulpd C2, ... vmulpd C2, ... ... vpslld $20, ... ... ... vpslld $20, ... vpshufd $114, ... vpshufd $114, ... vmulpd C1, ... vmulpd C1, ... abstract using vmulpd C2, ... vmulpd C2, ... ... ... 59
Our Method: Overview π(π¦) hard to find β1 1 π π½ 1 π½ 2 π½ π n ... ... 1 vpslld $20, ... vpslld $20, ... vpshufd $114, ... vpshufd $114, ... 3 vmulpd C1, ... vmulpd C1, ... ... vmulpd C2, ... vmulpd C2, ... ... vpslld $20, ... ... ... π vpslld $20, ... vpshufd $114, ... vpshufd $114, ... ππ + π vmulpd C1, ... vmulpd C1, ... abstract using vmulpd C2, ... vmulpd C2, ... ... partial evaluation ... of bit-level operations 60
Our Method: Overview π(π¦) hard to find β1 1 π π½ 1 π½ 2 π½ π n ... ... 1 vpslld $20, ... vpslld $20, ... vpshufd $114, ... vpshufd $114, ... 3 vmulpd C1, ... vmulpd C1, ... ... vmulpd C2, ... vmulpd C2, ... ... vpslld $20, ... ... ... π vpslld $20, ... vpshufd $114, ... vpshufd $114, ... ππ + π vmulpd C1, ... only floating-point vmulpd C1, ... abstract using vmulpd C2, ... vmulpd C2, ... ... operations partial evaluation ... of bit-level operations 61
Our Method: Overview π(π¦) π΅ 2,π (π¦) π΅ 1,π (π¦) hard to find π΅ π,π (π¦) β1 1 π π½ 1 π½ 2 π½ π n ... ... 1 vpslld $20, ... vpslld $20, ... vpshufd $114, ... vpshufd $114, ... 3 vmulpd C1, ... vmulpd C1, ... ... vmulpd C2, ... vmulpd C2, ... ... vpslld $20, ... ... ... π vpslld $20, ... vpshufd $114, ... vpshufd $114, ... ππ + π vmulpd C1, ... only floating-point vmulpd C1, ... abstract using vmulpd C2, ... vmulpd C2, ... ... operations partial evaluation ... of bit-level operations 62
Our Method: Overview π΅ 2,π (π¦) π΅ 1,π (π¦) π΅ π,π (π¦) π½ 1 π½ 2 π½ π ... 1 vpslld $20, ... vpshufd $114, ... 3 vmulpd C1, ... ... vmulpd C2, ... ... vpslld $20, ... ... π vpslld $20, ... vpshufd $114, ... vpshufd $114, ... ππ + π vmulpd C1, ... vmulpd C1, ... vmulpd C2, ... vmulpd C2, ... ... partial evaluation ... of bit-level operations 63
Our Method: Overview π΅ 2,π (π¦) π΅ 1,π (π¦) π΅ π,π (π¦) π π¦ β π΅ π,π π¦ π π¦ β π΅ 1,π π¦ π(π¦) π(π¦) π½ 1 π½ 2 π½ π π½ 1 π½ 2 π½ π ... 1 vpslld $20, ... vpshufd $114, ... 3 vmulpd C1, ... ... vmulpd C2, ... ... vpslld $20, ... ... π vpslld $20, ... vpshufd $114, ... vpshufd $114, ... ππ + π vmulpd C1, ... vmulpd C1, ... vmulpd C2, ... vmulpd C2, ... ... partial evaluation ... of bit-level operations 64
Our Method: Overview π΅ 2,π (π¦) π΅ 1,π (π¦) solve optimization problems π΅ π,π (π¦) π π¦ β π΅ π,π π¦ π π¦ β π΅ 1,π π¦ max π(π¦) max π(π¦) π½ 1 π½ 2 π½ π π½ 1 π½ 2 π½ π ... 1 vpslld $20, ... vpshufd $114, ... 3 vmulpd C1, ... ... vmulpd C2, ... ... vpslld $20, ... ... π vpslld $20, ... vpshufd $114, ... vpshufd $114, ... ππ + π vmulpd C1, ... vmulpd C1, ... vmulpd C2, ... vmulpd C2, ... ... partial evaluation ... of bit-level operations 65
Our Method: Overview π΅ 2,π (π¦) π΅ 1,π (π¦) solve optimization problems π΅ π,π (π¦) π π¦ β π΅ π,π π¦ π π¦ β π΅ 1,π π¦ max π(π¦) max π(π¦) π½ 1 π½ 2 π½ π π½ 1 π½ 2 π½ π ... 1 vpslld $20, ... answer! vpshufd $114, ... 3 vmulpd C1, ... ... vmulpd C2, ... ... vpslld $20, ... ... π vpslld $20, ... vpshufd $114, ... vpshufd $114, ... ππ + π vmulpd C1, ... vmulpd C1, ... vmulpd C2, ... vmulpd C2, ... ... partial evaluation ... of bit-level operations 66
2) Divide the Input Range β’ Assume bit-level operations are used as well β’ To handle bit-level operations, divide π into intervals π½ π , on each π½ π , so that, we can statically know the result of each bit-level operation β’ Example: 67
2) Divide the Input Range β’ Assume bit-level operations are used as well β’ To handle bit-level operations, divide π into intervals π½ π , on each π½ π , so that, we can statically know the result of each bit-level operation β’ Example: 68
2) Divide the Input Range β’ Assume bit-level operations are used as well β’ To handle bit-level operations, divide π into intervals π½ π , on each π½ π , so that, we can statically know the result of each bit-level operation β1 π 1 β’ Example: input x y β x Γ f C (C = 0x3ff71547652b82fe) N β round(y) z β int(N) + i 0x3ff w β z << 52 ... 69
2) Divide the Input Range β’ Assume bit-level operations are used as well β’ To handle bit-level operations, divide π into intervals π½ π , on each π½ π , so that, we can statically know the result of each bit-level operation β1 π 1 β’ Example: π½ β1 π½ 0 π½ 1 input x y β x Γ f C (C = 0x3ff71547652b82fe) N β round(y) z β int(N) + i 0x3ff w β z << 52 ... 70
2) Divide the Input Range β’ Assume bit-level operations are used as well β’ To handle bit-level operations, divide π into intervals π½ π , on each π½ π , so that, we can statically know the result of each bit-level operation β1 β1 π π 1 1 β’ Example: π½ β1 π½ β1 π½ 0 π½ 0 π½ 1 π½ 1 input x y β x Γ f C (C = 0x3ff71547652b82fe) N β round(y) z β int(N) + i 0x3ff w β z << 52 ... 71
2) Divide the Input Range β’ Assume bit-level operations are used as well β’ To handle bit-level operations, divide π into intervals π½ π , on each π½ π , so that, we can statically know the result of each bit-level operation β1 β1 π π 1 1 β’ Example: π½ β1 π½ β1 π½ 0 π½ 0 π½ 1 π½ 1 input x y β x Γ f C (C = 0x3ff71547652b82fe) N β round(y) β1 z β int(N) + i 0x3ff w β z << 52 ... 72
2) Divide the Input Range β’ Assume bit-level operations are used as well β’ To handle bit-level operations, divide π into intervals π½ π , on each π½ π , so that, we can statically know the result of each bit-level operation β1 β1 π π 1 1 β’ Example: π½ β1 π½ β1 π½ 0 π½ 0 π½ 1 π½ 1 input x input x y β x Γ f C y β x Γ f C (C = 0x3ff71547652b82fe) (C = 0x3ff71547652b82fe) N β round(y) partial evaluation N β β1 β1 z β int(N) + i 0x3ff z β 1022 w β z << 52 w β 0.5 ... ... 73
2) Divide the Input Range β’ Assume bit-level operations are used as well β’ To handle bit-level operations, divide π into intervals π½ π , on each π½ π , so that, we can statically know the result of each bit-level operation β1 β1 π π 1 1 β’ Example: π½ β1 π½ β1 π½ 0 π½ 0 π½ 1 π½ 1 input x input x y β x Γ f C y β x Γ f C (C = 0x3ff71547652b82fe) (C = 0x3ff71547652b82fe) N β round(y) partial evaluation N β β1 β1 z β int(N) + i 0x3ff z β 1022 Only floating-point operations are left w β z << 52 w β 0.5 ... ... β Can compute π΅ π π¦ on each π½ π 74
2) Divide the Input Range β’ How to find such intervals? β’ Use symbolic abstractions β’ Example: β’ π = round π¦ Γ f C β’ (symbolic abstraction of π¦ Γ f C ) = π¦ Γ C 1 + π β’ Let π½ π = largest interval contained in π¦ β π βΆ π π¦ β π β 0.5, π + 0.5 β’ Then π is evaluated to π for every input in π½ π 75
2) Divide the Input Range β’ How to find such intervals? β1 π 1 β’ Use symbolic abstractions π½ β1 π½ 0 π½ 1 β’ Example: β’ π = round π¦ Γ f C β’ (symbolic abstraction of π¦ Γ f C ) = π¦ Γ C 1 + π β’ Let π½ π = largest interval contained in π¦ β π βΆ π π¦ β π β 0.5, π + 0.5 β’ Then π is evaluated to π for every input in π½ π 76
2) Divide the Input Range β’ How to find such intervals? β1 π 1 β’ Use symbolic abstractions π½ β1 π½ 0 π½ 1 π = β1 π = 0 π = 1 β’ Example: β’ π = round π¦ Γ f C β’ (symbolic abstraction of π¦ Γ f C ) = π¦ Γ C 1 + π β’ Let π½ π = largest interval contained in π¦ β π βΆ π π¦ β π β 0.5, π + 0.5 β’ Then π is evaluated to π for every input in π½ π 77
2) Divide the Input Range β’ How to find such intervals? β1 π 1 β’ Use symbolic abstractions π½ β1 π½ 0 π½ 1 π = β1 π = 0 π = 1 β’ Example: β’ π = round π¦ Γ f C β’ (symbolic abstraction of π¦ Γ f C ) = π¦ Γ C 1 + π β’ Let π½ π = largest interval contained in π¦ β π βΆ π π¦ β π β 0.5, π + 0.5 β’ Then π is evaluated to π for every input in π½ π 78
2) Divide the Input Range β’ How to find such intervals? β1 π 1 β’ Use symbolic abstractions π½ β1 π½ 0 π½ 1 π = β1 π = 0 π = 1 β’ Example: β’ π = round π¦ Γ f C β’ (symbolic abstraction of π¦ Γ f C ) = π¦ Γ C 1 + π β’ Let π½ π = largest interval contained in π¦ β π βΆ π π¦ β π β 0.5, π + 0.5 β’ Then π is evaluated to π for every input in π½ π 79
2) Divide the Input Range β’ How to find such intervals? β1 π 1 β’ Use symbolic abstractions π½ β1 π½ 0 π½ 1 π = β1 π = 0 π = 1 β’ Example: β’ π = round π¦ Γ f C β’ (symbolic abstraction of π¦ Γ f C ) = π¦ Γ C 1 + π β’ Let π½ π = largest interval contained in π¦ β π βΆ π π¦ β π β 0.5, π + 0.5 β’ Then π is evaluated to π for every input in π½ π 80
2) Divide the Input Range β’ How to find such intervals? β1 π 1 β’ Use symbolic abstractions π½ β1 π½ 0 π½ 1 π = β1 π = 0 π = 1 β’ Example: β’ π = round π¦ Γ f C β’ (symbolic abstraction of π¦ Γ f C ) = π¦ Γ C 1 + π π¦ Γ f C π(π¦) = π¦ Γ C 1 + π : π < π β’ Let π½ π = largest interval contained in π¦ β π βΆ π π¦ β π β 0.5, π + 0.5 β’ Then π is evaluated to π for every input in π½ π 81
2) Divide the Input Range β’ How to find such intervals? β1 π 1 β’ Use symbolic abstractions π½ β1 π½ 0 π½ 1 π = β1 π = 0 π = 1 β’ Example: β’ π = round π¦ Γ f C β’ (symbolic abstraction of π¦ Γ f C ) = π¦ Γ C 1 + π π¦ Γ f C π(π¦) = π¦ Γ C 1 + π : π < π π β 0.5 π + 0.5 β’ Let π½ π = largest interval contained in π¦ β π βΆ π π¦ β π β 0.5, π + 0.5 β’ Then π is evaluated to π for every input in π½ π 82
2) Divide the Input Range β’ How to find such intervals? β1 π 1 β’ Use symbolic abstractions π½ β1 π½ 0 π½ 1 π = β1 π = 0 π = 1 β’ Example: β’ π = round π¦ Γ f C β’ (symbolic abstraction of π¦ Γ f C ) = π¦ Γ C 1 + π π¦ Γ f C π(π¦) = π¦ Γ C 1 + π : π < π π = π π β 0.5 π + 0.5 β’ Let π½ π = largest interval contained in π¦ β π βΆ π π¦ β π β 0.5, π + 0.5 β’ Then π is evaluated to π for every input in π½ π 83
2) Divide the Input Range β’ How to find such intervals? β1 π 1 β’ Use symbolic abstractions π½ β1 π½ 0 π½ 1 π = β1 π = 0 π = 1 β’ Example: β’ π = round π¦ Γ f C β’ (symbolic abstraction of π¦ Γ f C ) = π¦ Γ C 1 + π π¦ Γ f C π(π¦) = π¦ Γ C 1 + π : π < π π = π π β 0.5 π + 0.5 β’ Let π½ π = largest interval contained in π¦ β π βΆ π π¦ β π β 0.5, π + 0.5 β’ Then π is evaluated to π for every input in π½ π 84
2) Divide the Input Range β’ How to find such intervals? β1 π 1 β’ Use symbolic abstractions π½ β1 π½ 0 π½ 1 π = β1 π = 0 π = 1 β’ Example: β’ π = round π¦ Γ f C β’ (symbolic abstraction of π¦ Γ f C ) = π¦ Γ C 1 + π π¦ Γ f C π(π¦) = π¦ Γ C 1 + π : π < π π = π π β 0.5 π + 0.5 β’ Let π½ π = largest interval contained in π¦ β π βΆ π π¦ β π β 0.5, π + 0.5 β’ Then π is evaluated to π for every input in π½ π 85
3) Compute a Bound on Precision Loss β’ Precision loss on each interval π½ π β’ Let π΅ π π¦ be a symbolic abstraction on π½ π β’ Analytical optimization: π π¦ βπ΅ π π¦ max π π¦ π¦βπ½ π , |π π |<π β’ Use Mathematica to solve optimization problems analytically 86
3) Compute a Bound on Precision Loss β’ Precision loss on each interval π½ π β’ Let π΅ π π¦ be a symbolic abstraction on π½ π β’ Analytical optimization: π π¦ βπ΅ π π¦ max π π¦ π¦βπ½ π , |π π |<π β’ Use Mathematica to solve optimization problems analytically 87
Are We Done? β’ No. The constructed intervals do not cover π in general β’ Because we made sound approximations β1 input range π 1 π½ β1 π½ 0 π½ 1 88
Are We Done? β’ No. The constructed intervals do not cover π in general β’ Because we made sound approximations β1 input range π 1 floating-point numbers π½ β1 π½ 0 π½ 1 89
Are We Done? β’ No. The constructed intervals do not cover π in general β’ Because we made sound approximations β1 input range π 1 floating-point numbers π½ β1 π½ 0 π½ 1 between intervals 90
Are We Done? β’ No. The constructed intervals do not cover π in general β’ Because we made sound approximations β1 input range π 1 floating-point numbers π½ β1 π½ 0 π½ 1 between intervals 91
Are We Done? β’ Example: π = round π¦ Γ f π· abstraction of π¦ Γ f π· : 0 1 0.5 1 For π¦ = π would be 0 or 1 2π· , β’ Let πΌ = {floating- β’ We observe that |πΌ| is small in experiment 92
Are We Done? β’ Example: π = round π¦ Γ f π· abstraction of π¦ Γ f π· : 0 1 π¦ = 1/(1.5π·) π¦ = 1/(3π·) 0.5 1 For π¦ = π would be 0 or 1 2π· , β’ Let πΌ = {floating- β’ We observe that |πΌ| is small in experiment 93
Are We Done? β’ Example: π = round π¦ Γ f π· abstraction of π¦ Γ f π· : 0 1 π¦ = 1/(1.5π·) π¦ = 1/(3π·) π = 0 0.5 π = 1 1 For π¦ = π would be 0 or 1 2π· , β’ Let πΌ = {floating- β’ We observe that |πΌ| is small in experiment 94
Are We Done? β’ Example: π = round π¦ Γ f π· abstraction of π¦ Γ f π· : 0 1 π¦ = 1/(1.5π·) π¦ = 1/(3π·) π¦ = 1/(2π·) π = 0 0.5 π = 1 1 For π¦ = π would be 0 or 1 2π· , β’ Let πΌ = {floating- β’ We observe that |πΌ| is small in experiment 95
Are We Done? β’ Example: π = round π¦ Γ f π· π¦ Γ f π· abstraction of π¦ Γ f π· : ? ? ? ? ? ? 0 1 π¦ = 1/(1.5π·) π¦ = 1/(3π·) π¦ = 1/(2π·) π = 0 0.5 π = 1 1 For π¦ = π would be 0 or 1 2π· , β’ Let πΌ = {floating- β’ We observe that |πΌ| is small in experiment 96
Are We Done? β’ Example: π = round π¦ Γ f π· π¦ Γ f π· abstraction of π¦ Γ f π· : ? ? ? ? ? ? 0 1 π¦ = 1/(1.5π·) π¦ = 1/(3π·) π¦ = 1/(2π·) π = 0 0.5 π = 1 1 For π¦ = π would be 0 or 1 2π· , β’ Let πΌ = {floating- β’ We observe that |πΌ| is small in experiment 97
Are We Done? β’ Example: π = round π¦ Γ f π· π¦ Γ f π· abstraction of π¦ Γ f π· : ? ? ? ? ? ? 0 1 π¦ = 1/(1.5π·) π¦ = 1/(3π·) π¦ = 1/(2π·) π = 0 0.5 π = 1 1 For π¦ = π would be 0 or 1 2π· , β’ Let πΌ = {floating- β’ We observe that |πΌ| is small in experiment 98
3) Compute a Bound on Precision Loss β’ Precision loss on each interval π½ π β’ Let π΅ π π¦ be a symbolic abstraction on π½ π β’ Analytical optimization: π π¦ βπ΅ π π¦ max π π¦ π¦βπ½ π , |π π |<π β’ Use Mathematica to solve optimization problems analytically β’ Precision loss on πΌ β’ For each π¦ β πΌ , obtain π π¦ by executing the binary β’ Brute force: π π¦ βπ π¦ max π π¦ π¦βπΌ β’ Use Mathematica to compute π π¦ and precision loss exactly 99
3) Compute a Bound on Precision Loss β’ Precision loss on each interval π½ π β’ Let π΅ π π¦ be a symbolic abstraction on π½ π β’ Analytical optimization: take maximum π π¦ βπ΅ π π¦ β answer! max π π¦ π¦βπ½ π , |π π |<π β’ Use Mathematica to solve optimization problems analytically β’ Precision loss on πΌ β’ For each π¦ β πΌ , obtain π π¦ by executing the binary β’ Brute force: π π¦ βπ π¦ max π π¦ π¦βπΌ β’ Use Mathematica to compute π π¦ and precision loss exactly 100
Recommend
More recommend