Round robin calculation for Float

Just starting out? Need help? Post your questions and find answers here.
User avatar
oryaaaaa
Addict
Addict
Posts: 833
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Round robin calculation for Float

Post by oryaaaaa »

Why doesn't this work?

Code: Select all

Repeat
  PokeL(@y.f,x.l)
  Debug y ; 0.0 0.0 0.0 0.0 0.0 0.0
  ; Calculation program
  x+1
Until x=0
Thank you
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

What are you expecting?

y never changes and x is never zero?

cheers
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Poking a long into a float? You need to use PokeF(), then it works
BERESHEIT
User avatar
oryaaaaa
Addict
Addict
Posts: 833
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Post by oryaaaaa »

Will not you be able to do this from the ActiveBasic user in Japan?

I worry where to be corrected it. Is PureBasic a loser?
User avatar
oryaaaaa
Addict
Addict
Posts: 833
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Post by oryaaaaa »

I don’t want to put the numerical value in PokeF().

I want to output all numerical values to be able to imagine Float.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

I'm sorry, I can't understand what it is you're trying to do.
BERESHEIT
User avatar
oryaaaaa
Addict
Addict
Posts: 833
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Post by oryaaaaa »

Thanks. My writing was bad, sorry.
b1be
User
User
Posts: 25
Joined: Sat Mar 19, 2005 5:47 pm

Post by b1be »

i cant understand either .. but ... why poke?

Code: Select all

Repeat 
  y.f=x.l ;?? 
  Debug y ; 0.0 0.0 0.0 0.0 0.0 0.0 
  ; Calculation program 
  x+1 
Until x=0
I want to output all numerical values to be able to imagine Float.
you mean to transform a number from long (or any) to float?
Last edited by b1be on Fri Jul 07, 2006 2:23 pm, edited 2 times in total.
Jan Vooijs
Enthusiast
Enthusiast
Posts: 196
Joined: Tue Sep 30, 2003 4:32 pm
Location: The Netherlands

Post by Jan Vooijs »

oryaaaaa wrote:Will not you be able to do this from the ActiveBasic user in Japan?

I worry where to be corrected it. Is PureBasic a loser?
Since when is PureBasic a loser??? Blashfamy!! Never is PureBasic a loser, it is a winner!!

I think your translation to english is wrong!!

But an answer is that you can NOT poke a Long as a Float it will not fit (amazing the programs does not crash...

This works (amazingly) you can poke a LONG as a float:

Code: Select all

y.f = 1.0
x.l = 0

Repeat
  PokeL(@y.f,x.l)
  PokeF(@y.f,x.l)
  Debug y ; 0.0 0.0 0.0 0.0 0.0 0.0
  CallDebugger
  ; Calculation program
  x+1
Until x=0


End
I presume that PB is making a conversion.

Hope this helps oryaaaaa

Jan V.

[edit]
I think he is writing to memory so he can save a whole region of memory to a file, think games it is an old trick used it myself to 'decode' game settings...
[/edit]
Life goes to Fast, Enjoy!!

PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!

AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)
User avatar
oryaaaaa
Addict
Addict
Posts: 833
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Post by oryaaaaa »

Challenge from ActiveBasic User (It was ordered that write to me. ) :cry:
I want to give the real number to a specific equation of higher degree and to search for the solution. I want to obtain the combination of all the real numbers input to the Float type. The Long type is the same byte as the Float type, and obtaining all the combinations besides for the Long type : because it is easy.

Memory copy from Long type in Float type (For the unit of bit).
It is possible to translate correctly or I am uneasy.

Thank you
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: Round robin calculation for Float

Post by Psychophanta »

oryaaaaa wrote:Why doesn't this work?

Code: Select all

Repeat
  PokeL(@y.f,x.l)
  Debug y ; 0.0 0.0 0.0 0.0 0.0 0.0
  ; Calculation program
  x+1
Until x=0
Thank you
It works perfectly here!
Where is the problem???

EDIT: By the way, what about taking a look at Dioxin's explanation here:
http://www.purebasic.fr/english/viewtopic.php?t=22032
?
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

is something like this you want to do oryaaa ?

Code: Select all

x.l = 12
y.f = 35.456


Debug y

y = x + ( y - Int(y) )

Debug y

No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
breeze4me
Enthusiast
Enthusiast
Posts: 637
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

Post by breeze4me »

Code: Select all

Repeat 
  PokeL(@y.f, x) 
  Debug StrF(y,70)
  ; Calculation program 
  x+1
ForEver
works fine.
the problem is that it's very small number, so all digits are not displayed.

result is...
0.0000000000000000000000000000000000000000000000000000000000000000000000
0.0000000000000000000000000000000000000000000014012984643248171000000000
0.0000000000000000000000000000000000000000000028025969286496341000000000
0.0000000000000000000000000000000000000000000042038953929744512000000000
0.0000000000000000000000000000000000000000000056051938572992683000000000
0.0000000000000000000000000000000000000000000070064923216240854000000000
0.0000000000000000000000000000000000000000000084077907859489024000000000
0.0000000000000000000000000000000000000000000098090892502737195000000000
0.0000000000000000000000000000000000000000000112103877145985370000000000
0.0000000000000000000000000000000000000000000126116861789233540000000000
0.0000000000000000000000000000000000000000000140129846432481710000000000
0.0000000000000000000000000000000000000000000154142831075729880000000000
...
User avatar
oryaaaaa
Addict
Addict
Posts: 833
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Post by oryaaaaa »

Great!!!

I did not think as displayed by the debugger. Thanks :D
Post Reply