Folgender Code sollte die überflüssigen Nullen in Nachkommastellen abschneiden, aber das scheitert an Rechenungenauigkeiten. Im Fall vom Ausgangswert 1.7000 zeigt Debug(y.f) tatsächlich exakt Null an, aber TROTZDEM bleibt der Wert x Null!!! Das kann demnach nur daran liegen, daß jenseits der sechsten Nachkommastelle im Debugger auch noch Zahlen existieren, sodaß der Debugger nur scheinbar für den Wert x exakt Null anzeigt.
Code: Alles auswählen
OpenWindow(0,0,0,606,300,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_minimizeGadget|#PB_Window_maximizeGadget,"")
CreateGadgetList(WindowID(0))
TextGadget(1,200,100,100,20,"",#PB_text_border)
h.f = 1.700
Repeat
y.f = (h.f - Int(h.f))
If y.f = 0
x = 0
Goto A
EndIf
y.f = (h.f * 10 - Int(h.f * 10))
Debug(y.f)
If y.f = 0
x = 1
Goto A
EndIf
y.f = (h.f * 100 - Int(h.f * 100))
If y.f = 0
x = 2
Goto A
EndIf
y.f = (h.f * 1000 - Int(h.f * 1000))
If y.f = 0
x = 3
Goto A
EndIf
y.f = (h.f * 10000 - Int(h.f * 10000))
If y.f = 0
x = 4
Goto A
EndIf
A:
SetGadgetText(1,StrF(h.f,x))
EventID = WaitWindowEvent()
Until EventID = #PB_EventCloseWindow
PB42