جميع الكتب

مهني

1 Markets I: The Ecosystem and Exchange-Traded Marketsالأسواق عبر الإنترنت 2 Markets II: Rates, FX and Creditالأسواق عبر الإنترنت 3 Markets III: Commodities, Energy and Cryptoالأسواق عبر الإنترنت 4 Quantitative Methodsالأساليب عبر الإنترنت 5 Derivatives and Volatilityالمشتقات عبر الإنترنت 6 Rates, Credit, XVA and Riskالفائدة والائتمان والمخاطر عبر الإنترنت 7 Research Craft: Predictors, Backtests, Measurement, Portfoliosالبحث عبر الإنترنت 8 Strategies I: Equities and Futuresالاستراتيجيات عبر الإنترنت 9 Strategies II: Volatility, Relative Value, Macro and the Bank Desksالاستراتيجيات عبر الإنترنت 10 Microstructure and Executionالتنفيذ عبر الإنترنت 11 Market Making and High-Frequency Tradingصناعة السوق عبر الإنترنت 12 Machine Learning for Marketsتعلم الآلة عبر الإنترنت 13 Low-Latency Softwareالتكنولوجيا عبر الإنترنت 14 Networks, Hardware and Trading Infrastructureالتكنولوجيا عبر الإنترنت 15 Research, Data and Risk Platformsالتكنولوجيا عبر الإنترنت 16 The Desk and the Firmالشركة عبر الإنترنت 17 The Industry: Firms, Roles and Careersالمسارات المهنية عبر الإنترنت 18 Interviews I: Maths, Probability and Speedالمسارات المهنية عبر الإنترنت 19 Interviews II: Markets, Trading Games and the Final Roundالمسارات المهنية عبر الإنترنت 20 Interviews III: Codeالمسارات المهنية عبر الإنترنت
التطبيقات حول المدرب تسجيل الدخول ابدأ القراءة

Computer Science · المسرد

ما معنى Cast؟

Definition 2.4 University Computer Science — Year 1 · الفصل 2 — C: Types, Operators and Control Flow

A cast is an explicit conversion, written (type)expression. Converting a floating value to an integer type drops the fractional part (it truncates toward zero); converting an integer to a narrower unsigned type keeps it modulo 2N2^N.

Where the usual arithmetic conversions lead two operands. Narrow types are first promoted to int. Two signed or two unsigned operands meet at the greater rank, up their column (i). A signed operand goes to the unsigned operand’s type when that rank is equal or greater: right at the same rank, then up (ii). When the signed operand has the greater rank, the unsigned one moves to it along a dashed arrow if that type holds all its values, as unsigned into a 64-bit long; if not, both go to the unsigned type of the greater rank (iii). A floating operand makes the whole operation floating.
Where the usual arithmetic conversions lead two operands. Narrow types are first promoted to int. Two signed or two unsigned operands meet at the greater rank, up their column (i). A signed operand goes to the unsigned operand’s type when that rank is equal or greater: right at the same rank, then up (ii). When the signed operand has the greater rank, the unsigned one moves to it along a dashed arrow if that type holds all its values, as unsigned into a 64-bit long; if not, both go to the unsigned type of the greater rank (iii). A floating operand makes the whole operation floating.

أمثلة

Example 2.5 (Why -1 < 1u is false)

In minus_one < one, both operands have rank int and one is unsigned, so by case (ii) minus_one is converted to unsigned: −1 mod 232=4294967295-1 \bmod 2^{32} = 4294967295, which is not less than 1. In big < one, big is a long, of greater rank, and on this machine long can hold every unsigned value: by case (iii) one is converted to long, and −1<1-1 < 1 is true. The same expression gives the opposite answer on a system where long has 32 bits: long then cannot hold 4294967295, so case (iii) sends both operands to unsigned long, and big becomes 4294967295 again.

اقرأ في الفصل →