Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page 71 "money" #45

Open
VictorEijkhout opened this issue Oct 3, 2022 · 4 comments
Open

page 71 "money" #45

VictorEijkhout opened this issue Oct 3, 2022 · 4 comments

Comments

@VictorEijkhout
Copy link

First: "as remarked earlier". Please give exact reference. I'm kinda interested in the justification for using int types for money, but I don't remember where you said this and I don't feel like rereading 70 pages.

Secondly: int types for money? That's expressed in cents? How about the non-base-10 English money? I wouldn't make such sweeping statements. And even in the US system using int means expressing everything in cents? Don't banks use 1/10 of a cent?

@VictorEijkhout
Copy link
Author

Same chapter, page 77 feels like you were getting tired with the topic because the description is getting more and more condensed. For instance last line of the page: "In both examples [no comma! have someone proofread your book with the Chicago Manual in hand!] we have induced abstractions from the parameters." Except that the unabstracted "before" code is missing.

Top of page 78: "There is another way of identifying a range". I'm sure there is. But what does it have to do with the guideline topic under discussion? You're being much too terse here.

@hatcat
Copy link
Owner

hatcat commented Oct 4, 2022

I must press you into service to proof my next book...

The rationale for using int types for money is that floating point operations are prone to error as operations accumulate. Sticking with integral types, counting the smallest unit of division, avoids this problem. Converting to floating point can be done at the last moment of presentation if necessary.

The book WAS reviewed by Pearson's editing desk: Audrey Doyle, a Bostonian with a strong insight into Chicago Style, which is Pearson's reference, was the person with whom I would argue. She is very good, but I guess we all miss things from time to time...

@VictorEijkhout
Copy link
Author

VictorEijkhout commented Oct 4, 2022 via email

@j-silver
Copy link

The rationale for using int types for money is that floating point operations are prone to error as operations accumulate.

Of course. MS Excel has been regretting for decades going with floating point arithmetic. (Is there a 754 for Decimal arithmetic?)

I'm not sure if this is ironic, but the (few) quant libraries I have worked with use floating point types, usually double, for money. Maybe because if you round to the smallest unit of currency at every single step of a calculation, you introduce a bigger error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants