Relative roundoff error in the simple precision.












0














I am struggling with a simple problem from the computer arithmetics. The goal is to find $|(fl(0.1)-0.1)/0.1|$. I have computed the binary representation of $0.1$, which is $(1.1001)_{2}times2^{-4}$, where the $1001$ after the decimal point is periodic. I know that $fl(0.1)$ is rounding the $0.1$ up, so we get $(1.1001...101)_{2}times2^{-4}$, where the last digit is on the $-23$rd position. But I don't know how to compute the relative error. Thank you for any help.










share|cite|improve this question
























  • Yes, thank you, I edited
    – Vwann
    yesterday
















0














I am struggling with a simple problem from the computer arithmetics. The goal is to find $|(fl(0.1)-0.1)/0.1|$. I have computed the binary representation of $0.1$, which is $(1.1001)_{2}times2^{-4}$, where the $1001$ after the decimal point is periodic. I know that $fl(0.1)$ is rounding the $0.1$ up, so we get $(1.1001...101)_{2}times2^{-4}$, where the last digit is on the $-23$rd position. But I don't know how to compute the relative error. Thank you for any help.










share|cite|improve this question
























  • Yes, thank you, I edited
    – Vwann
    yesterday














0












0








0







I am struggling with a simple problem from the computer arithmetics. The goal is to find $|(fl(0.1)-0.1)/0.1|$. I have computed the binary representation of $0.1$, which is $(1.1001)_{2}times2^{-4}$, where the $1001$ after the decimal point is periodic. I know that $fl(0.1)$ is rounding the $0.1$ up, so we get $(1.1001...101)_{2}times2^{-4}$, where the last digit is on the $-23$rd position. But I don't know how to compute the relative error. Thank you for any help.










share|cite|improve this question















I am struggling with a simple problem from the computer arithmetics. The goal is to find $|(fl(0.1)-0.1)/0.1|$. I have computed the binary representation of $0.1$, which is $(1.1001)_{2}times2^{-4}$, where the $1001$ after the decimal point is periodic. I know that $fl(0.1)$ is rounding the $0.1$ up, so we get $(1.1001...101)_{2}times2^{-4}$, where the last digit is on the $-23$rd position. But I don't know how to compute the relative error. Thank you for any help.







numerical-methods computer-arithmetic






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited yesterday

























asked yesterday









Vwann

225




225












  • Yes, thank you, I edited
    – Vwann
    yesterday


















  • Yes, thank you, I edited
    – Vwann
    yesterday
















Yes, thank you, I edited
– Vwann
yesterday




Yes, thank you, I edited
– Vwann
yesterday










1 Answer
1






active

oldest

votes


















0














Just plug into the formula. You have $fl(0.1)$ and $0.1$ so now subtract. Starting from the last position in your $fl(0.1)$ the true value continues $011 001 100ldots$ so if we subtract we get (about) $001$ with the first $0$ matching the last $1$ in $fl(0.1)$. That is $22$ places to the right of the radix point, so the difference is $2^{-4}cdot 2^{-22}cdot 2^{-2}=2^{-28}$ where the first factor is from the exponent of $fl(0.1)$, the second is from all the places to the right of the radix point, and the third is the two places the $1$ in the error is to the right of the end of $fl(0.1)$. The relative error is then $frac {2^{-28}}{0.1}approx 3.7cdot 10^{-8}$



If you want the exact answer, you need the exact value of $fl(0.1)$. I asked Alpha and got $frac {6710885}{16cdot4194304}$. Then the relative error is $10(frac {6710885}{16cdot4194304}-frac 1{10})=-frac 7{33554432}$






share|cite|improve this answer























  • I have a slightly different answer
    – Vwann
    yesterday










  • For the absolute error I get 1/10×2^(-26)
    – Vwann
    yesterday










  • And relative is therefore 2^(-26)
    – Vwann
    yesterday










  • My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
    – Ross Millikan
    yesterday












  • Well, not in this case. The question is about the precise value. Thank you anyway
    – Vwann
    yesterday











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3062055%2frelative-roundoff-error-in-the-simple-precision%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Just plug into the formula. You have $fl(0.1)$ and $0.1$ so now subtract. Starting from the last position in your $fl(0.1)$ the true value continues $011 001 100ldots$ so if we subtract we get (about) $001$ with the first $0$ matching the last $1$ in $fl(0.1)$. That is $22$ places to the right of the radix point, so the difference is $2^{-4}cdot 2^{-22}cdot 2^{-2}=2^{-28}$ where the first factor is from the exponent of $fl(0.1)$, the second is from all the places to the right of the radix point, and the third is the two places the $1$ in the error is to the right of the end of $fl(0.1)$. The relative error is then $frac {2^{-28}}{0.1}approx 3.7cdot 10^{-8}$



If you want the exact answer, you need the exact value of $fl(0.1)$. I asked Alpha and got $frac {6710885}{16cdot4194304}$. Then the relative error is $10(frac {6710885}{16cdot4194304}-frac 1{10})=-frac 7{33554432}$






share|cite|improve this answer























  • I have a slightly different answer
    – Vwann
    yesterday










  • For the absolute error I get 1/10×2^(-26)
    – Vwann
    yesterday










  • And relative is therefore 2^(-26)
    – Vwann
    yesterday










  • My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
    – Ross Millikan
    yesterday












  • Well, not in this case. The question is about the precise value. Thank you anyway
    – Vwann
    yesterday
















0














Just plug into the formula. You have $fl(0.1)$ and $0.1$ so now subtract. Starting from the last position in your $fl(0.1)$ the true value continues $011 001 100ldots$ so if we subtract we get (about) $001$ with the first $0$ matching the last $1$ in $fl(0.1)$. That is $22$ places to the right of the radix point, so the difference is $2^{-4}cdot 2^{-22}cdot 2^{-2}=2^{-28}$ where the first factor is from the exponent of $fl(0.1)$, the second is from all the places to the right of the radix point, and the third is the two places the $1$ in the error is to the right of the end of $fl(0.1)$. The relative error is then $frac {2^{-28}}{0.1}approx 3.7cdot 10^{-8}$



If you want the exact answer, you need the exact value of $fl(0.1)$. I asked Alpha and got $frac {6710885}{16cdot4194304}$. Then the relative error is $10(frac {6710885}{16cdot4194304}-frac 1{10})=-frac 7{33554432}$






share|cite|improve this answer























  • I have a slightly different answer
    – Vwann
    yesterday










  • For the absolute error I get 1/10×2^(-26)
    – Vwann
    yesterday










  • And relative is therefore 2^(-26)
    – Vwann
    yesterday










  • My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
    – Ross Millikan
    yesterday












  • Well, not in this case. The question is about the precise value. Thank you anyway
    – Vwann
    yesterday














0












0








0






Just plug into the formula. You have $fl(0.1)$ and $0.1$ so now subtract. Starting from the last position in your $fl(0.1)$ the true value continues $011 001 100ldots$ so if we subtract we get (about) $001$ with the first $0$ matching the last $1$ in $fl(0.1)$. That is $22$ places to the right of the radix point, so the difference is $2^{-4}cdot 2^{-22}cdot 2^{-2}=2^{-28}$ where the first factor is from the exponent of $fl(0.1)$, the second is from all the places to the right of the radix point, and the third is the two places the $1$ in the error is to the right of the end of $fl(0.1)$. The relative error is then $frac {2^{-28}}{0.1}approx 3.7cdot 10^{-8}$



If you want the exact answer, you need the exact value of $fl(0.1)$. I asked Alpha and got $frac {6710885}{16cdot4194304}$. Then the relative error is $10(frac {6710885}{16cdot4194304}-frac 1{10})=-frac 7{33554432}$






share|cite|improve this answer














Just plug into the formula. You have $fl(0.1)$ and $0.1$ so now subtract. Starting from the last position in your $fl(0.1)$ the true value continues $011 001 100ldots$ so if we subtract we get (about) $001$ with the first $0$ matching the last $1$ in $fl(0.1)$. That is $22$ places to the right of the radix point, so the difference is $2^{-4}cdot 2^{-22}cdot 2^{-2}=2^{-28}$ where the first factor is from the exponent of $fl(0.1)$, the second is from all the places to the right of the radix point, and the third is the two places the $1$ in the error is to the right of the end of $fl(0.1)$. The relative error is then $frac {2^{-28}}{0.1}approx 3.7cdot 10^{-8}$



If you want the exact answer, you need the exact value of $fl(0.1)$. I asked Alpha and got $frac {6710885}{16cdot4194304}$. Then the relative error is $10(frac {6710885}{16cdot4194304}-frac 1{10})=-frac 7{33554432}$







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited yesterday

























answered yesterday









Ross Millikan

292k23197371




292k23197371












  • I have a slightly different answer
    – Vwann
    yesterday










  • For the absolute error I get 1/10×2^(-26)
    – Vwann
    yesterday










  • And relative is therefore 2^(-26)
    – Vwann
    yesterday










  • My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
    – Ross Millikan
    yesterday












  • Well, not in this case. The question is about the precise value. Thank you anyway
    – Vwann
    yesterday


















  • I have a slightly different answer
    – Vwann
    yesterday










  • For the absolute error I get 1/10×2^(-26)
    – Vwann
    yesterday










  • And relative is therefore 2^(-26)
    – Vwann
    yesterday










  • My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
    – Ross Millikan
    yesterday












  • Well, not in this case. The question is about the precise value. Thank you anyway
    – Vwann
    yesterday
















I have a slightly different answer
– Vwann
yesterday




I have a slightly different answer
– Vwann
yesterday












For the absolute error I get 1/10×2^(-26)
– Vwann
yesterday




For the absolute error I get 1/10×2^(-26)
– Vwann
yesterday












And relative is therefore 2^(-26)
– Vwann
yesterday




And relative is therefore 2^(-26)
– Vwann
yesterday












My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
– Ross Millikan
yesterday






My computation of $fl(0.1)-0.1$ was not exact. Usually we are only interested in the magnitude of errors like this. $2^{-26}$ is not correct because that is the whole value of the last $1$ in your expression, but $0.1$ is greater than your expression with the last $1$ changed to a $0$.
– Ross Millikan
yesterday














Well, not in this case. The question is about the precise value. Thank you anyway
– Vwann
yesterday




Well, not in this case. The question is about the precise value. Thank you anyway
– Vwann
yesterday


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3062055%2frelative-roundoff-error-in-the-simple-precision%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Mario Kart Wii

The Binding of Isaac: Rebirth/Afterbirth

What does “Dominus providebit” mean?