Fiat Coupe Forum
- Founded by Kayjey & James Northam
- Funded by the Club for the benefit of all owners
Fiat Coupe Club UK
join the club
Fiat Coupe Forum
 
» Announced
    Posting images


» Related sites
    Main club site
    fiatcoupe.net


» External data
    owners listed
 
Who's Online Now
0 registered members (), 167 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Forum Statistics
Forums70
Topics113,778
Posts1,340,834
Members1,715
Most Online2,346
Apr 14th, 2025
Top Posters(All Time)
barnacle 33,785
stan 32,122
Theresa 23,329
PeteP 21,879
bockers 21,079
JimO 17,917
Edinburgh 17,904
Nigel 17,374
RSS Feeds
Club Events
Club Information
Track Events
Rolling Road/RWYB
Social Events
Non-UK Events
Coupé Related Chat
Coupé Spotting
Coupé News/Press
Buying/Selling Advice
Insuring a Coupé
Basic FAQ's
How to Guides
Forum Issues
Technical Problems
General Maintenance
Styling
Tuning
Handling
ICE and Alarm
Coupés for Sale
Coupés Wanted
Parts for Sale
Parts Wanted
Group Buys
Business Forum
Other Vehicles for Sale/Wanted
Other Items for Sale/Wanted
Haggling/Offers
Ebay links
Other Cars
Other Websites
General Chat
Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
A quick maths question... #1372754
30/08/2012 12:03
30/08/2012 12:03
Joined: Sep 2009
Posts: 5,112
ation
szkom Offline OP
Club member 2000
szkom  Offline OP
Club member 2000
Forum is my life

Joined: Sep 2009
Posts: 5,112
ation
3+3x4=

So, go on then what do people think is the answer?

Show your working for extra credit laugh

Re: A quick maths question... [Re: szkom] #1372757
30/08/2012 12:07
30/08/2012 12:07

T
Turbo_Verde
Unregistered
Turbo_Verde
Unregistered
T



BODMAS!

Thus the answer is 15.

Just look at it like 3+(3x4) rather than (3+3)x4.

(Hope I'm right now tongue )

Re: A quick maths question... [Re: szkom] #1372761
30/08/2012 12:15
30/08/2012 12:15
Joined: Dec 2005
Posts: 1,789
In the driving seat!
Guzbod Offline
My life on the forum
Guzbod  Offline
My life on the forum

Joined: Dec 2005
Posts: 1,789
In the driving seat!
correct TV


[Linked Image]
Re: A quick maths question... [Re: szkom] #1372763
30/08/2012 12:22
30/08/2012 12:22
Joined: Dec 2005
Posts: 33,785
Berlin
barnacle Offline
Club Member 18 - ex-Minister without Portfolio
barnacle  Offline
Club Member 18 - ex-Minister without Portfolio
Forum Demigod

Joined: Dec 2005
Posts: 33,785
Berlin
Addition is subordinate to multiplication.

But you haven't stated the base:

Base 5 - the lowest it can be = 30
Base 6 = 23
Base 7 = 21
Base 8 = 17
Base 9 = 16
Base 10 = 15
Base 11 = 14
Base 12 = 13
Base 13 = 12
Base 14 = 11
Base 15 = 10
Base 16 (and all higher) = F


[Linked Image]
Don't get no respect! Coupe Fiat 1994-2000 - an owner's guide <-- clicky!
Re: A quick maths question... [Re: szkom] #1372764
30/08/2012 12:22
30/08/2012 12:22
Joined: Sep 2009
Posts: 5,112
ation
szkom Offline OP
Club member 2000
szkom  Offline OP
Club member 2000
Forum is my life

Joined: Sep 2009
Posts: 5,112
ation
It is indeed correct. I solved a puzzle on 100 floors with that sum in.

It was very frustrating as you had to input the operators between the numbers to balance the equation from left to right.

What I did wonder, and probably should know, would it be more correct to have brackets around the groupings as in TV's example?

Re: A quick maths question... [Re: barnacle] #1372765
30/08/2012 12:26
30/08/2012 12:26
Joined: Sep 2009
Posts: 5,112
ation
szkom Offline OP
Club member 2000
szkom  Offline OP
Club member 2000
Forum is my life

Joined: Sep 2009
Posts: 5,112
ation
I had assumed people would assume base 10. I'd not accounted for those who would speak in hexadecimal smile

Last edited by szkom; 30/08/2012 12:32. Reason: spelling
Re: A quick maths question... [Re: szkom] #1372766
30/08/2012 12:27
30/08/2012 12:27

T
Turbo_Verde
Unregistered
Turbo_Verde
Unregistered
T



Firstly I admit what ever Barnacle is going on about has gone miles over my head.

Secondly it is not 'more correct' to add the brackets. It may make it easier to understand for many (me included as don't have to think about it then) but it is just as accurate with or without the brackets.

Re: A quick maths question... [Re: szkom] #1372767
30/08/2012 12:28
30/08/2012 12:28
Joined: Sep 2009
Posts: 5,112
ation
szkom Offline OP
Club member 2000
szkom  Offline OP
Club member 2000
Forum is my life

Joined: Sep 2009
Posts: 5,112
ation
I'd hoped that brackets were good practice. It took me a while to suss without. Back to school for me...

Re: A quick maths question... [Re: barnacle] #1372776
30/08/2012 13:14
30/08/2012 13:14
Joined: Dec 2005
Posts: 12,546
Northumberland
AndrewR Offline
I AM a Coop
Happy Birthday AndrewR  Offline
I AM a Coop

Joined: Dec 2005
Posts: 12,546
Northumberland
Originally Posted By: barnacle
Addition is subordinate to multiplication.

But you haven't stated the base:


Well if we're going to be fancy about it neither has the modulo been stated, so:

Mod 5 (lowest possible) = 0
Mod 6 = 3
Mod 7 = 1
Mod 8 = 7
Mod 9 = 6
Mod 10 = 5
Mod 11 = 4
Mod 12 = 3
Mod 13 = 2
Mod 14 = 1
Mod 15 = 0
Mod 16 (and higher) = 15

Combining the moduli and base combinations is left as an exercise for the reader wink


Dear monos, a secret truth.
Re: A quick maths question... [Re: szkom] #1372780
30/08/2012 13:30
30/08/2012 13:30
Joined: Dec 2005
Posts: 33,785
Berlin
barnacle Offline
Club Member 18 - ex-Minister without Portfolio
barnacle  Offline
Club Member 18 - ex-Minister without Portfolio
Forum Demigod

Joined: Dec 2005
Posts: 33,785
Berlin
No, brackets are used when you need to *break* the precedence rules.

So 3+3*4 is always implicitly 3+(3*4) because of the precedence of the multiplication operator over addition. You use brackets when you want to change that precedence:

(3+3) * 4 <--- says do the addition first, out of order.


[Linked Image]
Don't get no respect! Coupe Fiat 1994-2000 - an owner's guide <-- clicky!
Re: A quick maths question... [Re: AndrewR] #1372781
30/08/2012 13:31
30/08/2012 13:31
Joined: Dec 2005
Posts: 33,785
Berlin
barnacle Offline
Club Member 18 - ex-Minister without Portfolio
barnacle  Offline
Club Member 18 - ex-Minister without Portfolio
Forum Demigod

Joined: Dec 2005
Posts: 33,785
Berlin
Originally Posted By: AndrewR
neither has the modulo been stated, so:


Modulus is the singular of moduli; modulo is the name of the operation...


[Linked Image]
Don't get no respect! Coupe Fiat 1994-2000 - an owner's guide <-- clicky!
Re: A quick maths question... [Re: szkom] #1372783
30/08/2012 13:36
30/08/2012 13:36
Joined: Dec 2005
Posts: 6,731
Surrey
E
Emjay Offline
Forum is my life
Emjay  Offline
Forum is my life
E

Joined: Dec 2005
Posts: 6,731
Surrey
Well if we're worried about sloppiness, those are parentheses. Parentheses are one type of bracket, but not all brackets are parentheses.


Does our law condemn a man without first hearing him to find out what he has been doing? (John 7:51)
Re: A quick maths question... [Re: szkom] #1372785
30/08/2012 13:38
30/08/2012 13:38
Joined: Dec 2005
Posts: 6,731
Surrey
E
Emjay Offline
Forum is my life
Emjay  Offline
Forum is my life
E

Joined: Dec 2005
Posts: 6,731
Surrey
Originally Posted By: szkom
3+3x4=

So, go on then what do people think is the answer?


What do you want it to be? [/lawyer mode]


Does our law condemn a man without first hearing him to find out what he has been doing? (John 7:51)
Re: A quick maths question... [Re: barnacle] #1372786
30/08/2012 13:39
30/08/2012 13:39
Joined: Dec 2005
Posts: 12,546
Northumberland
AndrewR Offline
I AM a Coop
Happy Birthday AndrewR  Offline
I AM a Coop

Joined: Dec 2005
Posts: 12,546
Northumberland
Originally Posted By: barnacle
Modulus is the singular of moduli; modulo is the name of the operation...


You're just cranky because you didn't think of it smile


Dear monos, a secret truth.
Re: A quick maths question... [Re: szkom] #1372790
30/08/2012 13:47
30/08/2012 13:47
Joined: Dec 2005
Posts: 33,785
Berlin
barnacle Offline
Club Member 18 - ex-Minister without Portfolio
barnacle  Offline
Club Member 18 - ex-Minister without Portfolio
Forum Demigod

Joined: Dec 2005
Posts: 33,785
Berlin
Here's what I've just had to write (and debug) in PIC machine code this morning:

Code:
static uint32 random
  random ^= random << 1;
  random ^= random >> 3;
  random ^= random << 10;


Pseudo random number generator with good properties and a (2^32)-1 repeat cycle.

I had need of some random!


[Linked Image]
Don't get no respect! Coupe Fiat 1994-2000 - an owner's guide <-- clicky!
Re: A quick maths question... [Re: szkom] #1372791
30/08/2012 13:49
30/08/2012 13:49
Joined: Dec 2005
Posts: 12,546
Northumberland
AndrewR Offline
I AM a Coop
Happy Birthday AndrewR  Offline
I AM a Coop

Joined: Dec 2005
Posts: 12,546
Northumberland
My morning's coding is still a work-in-progress:

Code:
Sub MakeSummary()

Const sSUMMARY_TAG As String = "Summary"
Const sQUESTION_DELIMITER As String = " "
Const sPRODUCT_RANGE As String = "A8"
Const sPRODUCT_DELIMITER As String = "..."
Const sSTART_RANGE As String = "B10"

Dim wshLoop As Worksheet
Dim sQuestion As String
Dim asSheetName() As String
Dim asProduct() As String
Dim bFirstPass As Boolean
Dim rngThisQ As Range
Dim sThisProduct As String
Dim bSheetMatched As Boolean
Dim lSheetLoop As Long
Dim wshSource As Worksheet
Dim sStatement As String
Dim rngFindStat As Range

bFirstPass = True
For Each wshLoop In ActiveWorkbook.Sheets
  If bFirstPass Then
    ReDim asSheetName(1 To 1)
    ReDim asProduct(1 To 1)
    bFirstPass = False
  Else
    ReDim Preserve asSheetName(1 To UBound(asSheetName) + 1)
    ReDim Preserve asProduct(1 To UBound(asProduct) + 1)
  End If
  asSheetName(UBound(asSheetName)) = wshLoop.Name
  If InStr(wshLoop.Range(sPRODUCT_RANGE).Value, sPRODUCT_DELIMITER) = 0 Then
    asProduct(UBound(asProduct)) = "NULL"
  Else
    asProduct(UBound(asProduct)) = Mid(wshLoop.Range(sPRODUCT_RANGE), InStr(wshLoop.Range(sPRODUCT_RANGE), sPRODUCT_DELIMITER) + Len(sPRODUCT_DELIMITER))
    'MsgBox asProduct(UBound(asProduct))
  End If
  If InStr(wshLoop.Name, sSUMMARY_TAG) > 0 Then
    sQuestion = Left(wshLoop.Name, InStr(wshLoop.Name, sQUESTION_DELIMITER))
    If sQuestion <> "Q11" Then
      Set rngThisQ = wshLoop.Range(sSTART_RANGE)
      While rngThisQ.Row <= wshLoop.Cells(wshLoop.Rows.Count, rngThisQ.Column).End(xlUp).Row
        lSheetLoop = 1
        bSheetMatched = False
        While lSheetLoop <= UBound(asSheetName) And Not (bSheetMatched)
          If Left(asSheetName(lSheetLoop), InStr(wshLoop.Name, " ") - 1) = Left(wshLoop.Name, InStr(wshLoop.Name, " ") - 1) And InStr(asProduct(lSheetLoop), rngThisQ.Value) > 0 Then
            bSheetMatched = True
          Else
            lSheetLoop = lSheetLoop + 1
          End If
        Wend
      
        If Not bSheetMatched Then
          MsgBox rngThisQ.Value & " could not be found"
        Else
          'MsgBox ActiveWorkbook.Sheets(lSheetLoop).Name
          Set wshSource = ActiveWorkbook.Sheets(lSheetLoop)
          
        End If
      
      Set rngThisQ = rngThisQ.End(xlDown)
      
    Wend
  End If
Next wshLoop

End Sub


Dear monos, a secret truth.
Re: A quick maths question... [Re: Emjay] #1372795
30/08/2012 13:54
30/08/2012 13:54
Joined: Jun 2006
Posts: 6,144
Southampton, Hants
Roadking Offline
Club member 1809
Roadking  Offline
Club member 1809
Forum is my life

Joined: Jun 2006
Posts: 6,144
Southampton, Hants
Originally Posted By: Emjay
Originally Posted By: szkom
3+3x4=

So, go on then what do people think is the answer?


What do you want it to be? [/lawyer mode]


So a hefty bill incoming for that written response wink


"RK's way seems the most sensible to me". ali_hire 16 Dec 2010
Re: A quick maths question... [Re: szkom] #1372796
30/08/2012 13:54
30/08/2012 13:54
Joined: Dec 2005
Posts: 16,603
Corridor of Uncertainty
J
Jim_Clennell Offline
Forum veteran
Jim_Clennell  Offline
Forum veteran
J

Joined: Dec 2005
Posts: 16,603
Corridor of Uncertainty
No wonder you two find time to post on here.

Re: A quick maths question... [Re: ] #1372799
30/08/2012 14:26
30/08/2012 14:26

T
TimR
Unregistered
TimR
Unregistered
T



Originally Posted By: Turbo_Verde
BODMAS!

Thus the answer is 15.

Just look at it like 3+(3x4) rather than (3+3)x4.

(Hope I'm right now tongue )


I think I always got told BOMDAS but it was 25 years ago.
Can't believe you didn't get the 'what would you like it to be' question in first.
Aren't you an accountant?

Re: A quick maths question... [Re: ] #1372800
30/08/2012 14:33
30/08/2012 14:33

T
Turbo_Verde
Unregistered
Turbo_Verde
Unregistered
T



Originally Posted By: TimR
Originally Posted By: Turbo_Verde
BODMAS!

Thus the answer is 15.

Just look at it like 3+(3x4) rather than (3+3)x4.

(Hope I'm right now tongue )


I think I always got told BOMDAS but it was 25 years ago.
Can't believe you didn't get the 'what would you like it to be' question in first.
Aren't you an accountant?


HAHA, good point. If you paid me I can make 3+3x4 equal anything you want and justify it to the tax man laugh

As for whether it is BODMAS or BOMDAS, it doesn't matter. Divison and multiplication have the same authority, as do addition and subtraction. So really it looks like this:

BO/D\/A\
---\M/\S/

Re: A quick maths question... [Re: szkom] #1372816
30/08/2012 15:49
30/08/2012 15:49
Joined: Dec 2005
Posts: 33,785
Berlin
barnacle Offline
Club Member 18 - ex-Minister without Portfolio
barnacle  Offline
Club Member 18 - ex-Minister without Portfolio
Forum Demigod

Joined: Dec 2005
Posts: 33,785
Berlin
Um, no they don't... formally, they are at the same level of precedence but must be evaluated left to right. Sometimes this makes a difference - I can't think of a real world example right now, but it's significant in computer code where word length or floating point precision may affect intermediate results.

e.g. Pi ~= 355/113, so you can calculate the volume of a sphere radius 2 in integers as either:

v = 4/3 pi r^3 = (4 * 355 * 2 * 2 * 2)/(3 * 113) = 33

or (4/3) * (355/113) * (2 * 2 * 2) = 1 * 3 * 8 = 24

The first is the more correct.


[Linked Image]
Don't get no respect! Coupe Fiat 1994-2000 - an owner's guide <-- clicky!
Re: A quick maths question... [Re: barnacle] #1372821
30/08/2012 16:00
30/08/2012 16:00

J
jonnybgt1759
Unregistered
jonnybgt1759
Unregistered
J



Originally Posted By: barnacle
Um, no they don't... formally, they are at the same level of precedence but must be evaluated left to right. Sometimes this makes a difference - I can't think of a real world example right now, but it's significant in computer code where word length or floating point precision may affect intermediate results.

e.g. Pi ~= 355/113, so you can calculate the volume of a sphere radius 2 in integers as either:

v = 4/3 pi r^3 = (4 * 355 * 2 * 2 * 2)/(3 * 113) = 33

or (4/3) * (355/113) * (2 * 2 * 2) = 1 * 3 * 8 = 24



The first is the more correct.



you should work for nasa! lol whats your IQ?

Re: A quick maths question... [Re: szkom] #1372825
30/08/2012 16:11
30/08/2012 16:11
Joined: Dec 2005
Posts: 12,546
Northumberland
AndrewR Offline
I AM a Coop
Happy Birthday AndrewR  Offline
I AM a Coop

Joined: Dec 2005
Posts: 12,546
Northumberland
Is there really a computer language which arbitrarily assigns integer values to intermediate calculations?

As I had a VBA editor open this line of code:

Code:
Debug.Print Int((4 / 3) * (355 / 113) * (2 * 2 * 2))


Returns 33, as any reasonable person would expect.


Dear monos, a secret truth.
Re: A quick maths question... [Re: AndrewR] #1372827
30/08/2012 16:25
30/08/2012 16:25

J
jonnybgt1759
Unregistered
jonnybgt1759
Unregistered
J



Originally Posted By: AndrewR
Is there really a computer language which arbitrarily assigns integer values to intermediate calculations?

As I had a VBA editor open this line of code:

Code:
Debug.Print Int((4 / 3) * (355 / 113) * (2 * 2 * 2))


Returns 33, as any reasonable person would expect.


If the answer is not already yes. Then a protocal could be created for the question.

Re: A quick maths question... [Re: szkom] #1372844
30/08/2012 17:06
30/08/2012 17:06
Joined: Dec 2005
Posts: 33,785
Berlin
barnacle Offline
Club Member 18 - ex-Minister without Portfolio
barnacle  Offline
Club Member 18 - ex-Minister without Portfolio
Forum Demigod

Joined: Dec 2005
Posts: 33,785
Berlin
VBA uses floating point numbers by default.

C, C++, Java, C#, Mono, Python, and many others from the Algol-derived school use integers by default. (Machine code uses bytes by default, unless you explicitly use a floating point unit.)

Not only are integers the default, but you can have integers of different length depending on target processor... 16 bits is the usual minimum for C but they can be up to 64 bits.

When an operation between to variables of different size/type is performed, the protocol requires that the smaller be extended to the larger though this can be over-ridden by casting in most languages - so multiplying an integer by a floating point will produce a floating point result - but does *not* require that intermediate products are increased in size. For example, multiplying two sixteen-bit numbers produces a 32-bit result. Since that result has to fit in a sixteen bit target, if the top sixteen bits are anything other than zero, there's an overflow and the answer will not be what you thought. This is not an issue as long as you are aware of what's going on...

Johnny - according to a Mensa test I did thirty-odd years ago to settle a bet, it's high enough to be in the top 0.003%. It's probably worn off a bit since then...


[Linked Image]
Don't get no respect! Coupe Fiat 1994-2000 - an owner's guide <-- clicky!
Re: A quick maths question... [Re: barnacle] #1372852
30/08/2012 17:22
30/08/2012 17:22

J
jonnybgt1759
Unregistered
jonnybgt1759
Unregistered
J



Originally Posted By: barnacle
VBA uses floating point numbers by default.

C, C++, Java, C#, Mono, Python, and many others from the Algol-derived school use integers by default. (Machine code uses bytes by default, unless you explicitly use a floating point unit.)

Not only are integers the default, but you can have integers of different length depending on target processor... 16 bits is the usual minimum for C but they can be up to 64 bits.

When an operation between to variables of different size/type is performed, the protocol requires that the smaller be extended to the larger though this can be over-ridden by casting in most languages - so multiplying an integer by a floating point will produce a floating point result - but does *not* require that intermediate products are increased in size. For example, multiplying two sixteen-bit numbers produces a 32-bit result. Since that result has to fit in a sixteen bit target, if the top sixteen bits are anything other than zero, there's an overflow and the answer will not be what you thought. This is not an issue as long as you are aware of what's going on...

Johnny - according to a Mensa test I did thirty-odd years ago to settle a bet, it's high enough to be in the top 0.003%. It's probably worn off a bit since then...


Thats very good does your family share this or are you the brainy one of the bunch?

A little off topic a question for you do you believe computers will always talk binary beyond ipv6?

Re: A quick maths question... [Re: ] #1372854
30/08/2012 17:24
30/08/2012 17:24
Joined: Dec 2005
Posts: 6,731
Surrey
E
Emjay Offline
Forum is my life
Emjay  Offline
Forum is my life
E

Joined: Dec 2005
Posts: 6,731
Surrey
Originally Posted By: Turbo_Verde
BO/D\/A\
---\M/\S/

Whereas I look at that and it reminds me of Darth Vader's little spaceship, so suspect I am with the other 99.997% who are not barnacle


Does our law condemn a man without first hearing him to find out what he has been doing? (John 7:51)
Re: A quick maths question... [Re: Emjay] #1372857
30/08/2012 17:27
30/08/2012 17:27
Joined: Aug 2011
Posts: 2,595
angus, scotland
jimbob13 Offline
I need some sleep
jimbob13  Offline
I need some sleep

Joined: Aug 2011
Posts: 2,595
angus, scotland
Originally Posted By: Emjay
Originally Posted By: Turbo_Verde
BO/D\/A\
---\M/\S/

Whereas I look at that and it reminds me of Darth Vader's little spaceship, so suspect I am with the other 99.997% who are not barnacle


rofl Me too. I think the term should in fact be barnaclesque, there's only one barnacle...


[Linked Image]
Re: A quick maths question... [Re: barnacle] #1372860
30/08/2012 17:42
30/08/2012 17:42
Joined: Dec 2005
Posts: 12,546
Northumberland
AndrewR Offline
I AM a Coop
Happy Birthday AndrewR  Offline
I AM a Coop

Joined: Dec 2005
Posts: 12,546
Northumberland
Originally Posted By: barnacle
C, C++, Java, C#, Mono, Python, and many others from the Algol-derived school use integers by default. (Machine code uses bytes by default, unless you explicitly use a floating point unit.)


So if I have:

Code:
x=15*(2/3)


The value of x will depend on whether I've declared x as a FP variable or an integer and could produce a vastly different result to:

Code:
x=15*2/3


Is that right? If so I'm glad I have no truck with any of the languages you've listed smile


Dear monos, a secret truth.
Re: A quick maths question... [Re: szkom] #1372867
30/08/2012 17:58
30/08/2012 17:58
Joined: Dec 2005
Posts: 33,785
Berlin
barnacle Offline
Club Member 18 - ex-Minister without Portfolio
barnacle  Offline
Club Member 18 - ex-Minister without Portfolio
Forum Demigod

Joined: Dec 2005
Posts: 33,785
Berlin
The result will be x=0.0 in the first case and x=10.0 in the second; the numbers themselves are integers, so the integer divide of 2 by 3 is zero. The type of the answer means only that the result is promoted to that type.

To use floats directly, you need to either explicitly cast them:

Code:
 x = (float)15 * (float)2/(float)3


or explicitly use something the compiler understands as float:

[code] x = 15.0 * 2.0/3.0 [code]


[Linked Image]
Don't get no respect! Coupe Fiat 1994-2000 - an owner's guide <-- clicky!
Page 1 of 2 1 2

Powered by UBB.threads™ PHP Forum Software 7.7.1
(Release build 20190129)
PHP: 7.3.33 Page Time: 0.013s Queries: 15 (0.005s) Memory: 0.8967 MB (Peak: 1.1322 MB) Data Comp: Off Server Time: 2025-06-21 04:16:02 UTC